From 7a7dbc79b3ab3d750218784ca817405f5a33e68c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 25 May 2021 04:28:51 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Create=20Create=20a=20new=20alert?= =?UTF-8?q?=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/PageSwitcher.js | 4 ++ nest_frontend/routes/PageRepositoryAlerts.js | 2 +- .../routes/PageRepositoryAlertsCreate.js | 44 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 nest_frontend/routes/PageRepositoryAlertsCreate.js diff --git a/nest_frontend/PageSwitcher.js b/nest_frontend/PageSwitcher.js index 7a7e9d9..db7332f 100644 --- a/nest_frontend/PageSwitcher.js +++ b/nest_frontend/PageSwitcher.js @@ -13,6 +13,7 @@ import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons" import makeIcon from "./utils/makeIcon" import useStrings from "./hooks/useStrings" import Alert from "./components/base/Alert" +import PageRepositoryAlertsCreate from "./routes/PageRepositoryAlertsCreate" export default function PageSwitcher({ ...props }) { @@ -23,6 +24,9 @@ export default function PageSwitcher({ ...props }) { + + + diff --git a/nest_frontend/routes/PageRepositoryAlerts.js b/nest_frontend/routes/PageRepositoryAlerts.js index 114c8cd..02a2a1f 100644 --- a/nest_frontend/routes/PageRepositoryAlerts.js +++ b/nest_frontend/routes/PageRepositoryAlerts.js @@ -9,7 +9,7 @@ import ButtonHeader from "../components/base/ButtonHeader" import makeIcon from "../utils/makeIcon" -export default function PageRepositoryAlerts({ ...props }) { +export default function PageRepositoryAlerts() { const { strings } = useContext(ContextLanguage) const { id } = useParams() const history = useHistory() diff --git a/nest_frontend/routes/PageRepositoryAlertsCreate.js b/nest_frontend/routes/PageRepositoryAlertsCreate.js new file mode 100644 index 0000000..bd3ea08 --- /dev/null +++ b/nest_frontend/routes/PageRepositoryAlertsCreate.js @@ -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 ( + + {makeIcon(faPlus)} {strings.alertCreate} + + } + > + + {strings.notImplemented} + + + ) +}