1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

Create Create a new alert page

This commit is contained in:
Steffo 2021-05-25 04:28:51 +02:00
parent 34dec0d920
commit 7a7dbc79b3
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 49 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons"
import makeIcon from "./utils/makeIcon" import makeIcon from "./utils/makeIcon"
import useStrings from "./hooks/useStrings" import useStrings from "./hooks/useStrings"
import Alert from "./components/base/Alert" import Alert from "./components/base/Alert"
import PageRepositoryAlertsCreate from "./routes/PageRepositoryAlertsCreate"
export default function PageSwitcher({ ...props }) { export default function PageSwitcher({ ...props }) {
@ -23,6 +24,9 @@ export default function PageSwitcher({ ...props }) {
<Route path={"/repositories/create"} exact={true}> <Route path={"/repositories/create"} exact={true}>
<PageRepositoryCreate/> <PageRepositoryCreate/>
</Route> </Route>
<Route path={"/repositories/:id/alerts/create"} exact={true}>
<PageRepositoryAlertsCreate/>
</Route>
<Route path={"/repositories/:id/alerts"} exact={true}> <Route path={"/repositories/:id/alerts"} exact={true}>
<PageRepositoryAlerts/> <PageRepositoryAlerts/>
</Route> </Route>

View file

@ -9,7 +9,7 @@ import ButtonHeader from "../components/base/ButtonHeader"
import makeIcon from "../utils/makeIcon" import makeIcon from "../utils/makeIcon"
export default function PageRepositoryAlerts({ ...props }) { export default function PageRepositoryAlerts() {
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
const { id } = useParams() const { id } = useParams()
const history = useHistory() const history = useHistory()

View file

@ -0,0 +1,44 @@
import React, { useContext } from "react"
import BoxFull from "../components/base/BoxFull"
import ContextLanguage from "../contexts/ContextLanguage"
import BoxHeader from "../components/base/BoxHeader"
import { useHistory, useParams } from "react-router"
import { faPlus } from "@fortawesome/free-solid-svg-icons"
import PageWithHeader from "../components/base/layout/PageWithHeader"
import makeIcon from "../utils/makeIcon"
import useBackendViewset from "../hooks/useBackendViewset"
export default function PageRepositoryAlertsCreate() {
const { strings } = useContext(ContextLanguage)
const { id } = useParams()
const history = useHistory()
const {createResource} = useBackendViewset(
`/api/v1/repositories/${id}/alerts/`,
"name",
{
list: false,
create: true,
retrieve: false,
edit: false,
destroy: false,
command: false,
action: false,
}
)
return (
<PageWithHeader
header={
<BoxHeader>
{makeIcon(faPlus)} {strings.alertCreate}
</BoxHeader>
}
>
<BoxFull header={strings.alertTitle}>
{strings.notImplemented}
</BoxFull>
</PageWithHeader>
)
}