From 2bba121cae5f0bcf7b0bff799cd6498b1fd109cb Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi <256895@studenti.unimore.it> Date: Tue, 11 May 2021 19:42:04 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20stuff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/BoxRepositoriesArchived.js | 2 +- .../interactive/SummaryRepository.js | 14 ++++------- .../components/providers/RepositoryEditor.js | 8 +++---- code/frontend/src/routes/PageUsers.js | 15 ++++++++++++ code/frontend/src/routes/PageUsers.module.css | 23 +++++++++++++++++++ 5 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 code/frontend/src/routes/PageUsers.js create mode 100644 code/frontend/src/routes/PageUsers.module.css diff --git a/code/frontend/src/components/interactive/BoxRepositoriesArchived.js b/code/frontend/src/components/interactive/BoxRepositoriesArchived.js index af504c5..9e59b6e 100644 --- a/code/frontend/src/components/interactive/BoxRepositoriesArchived.js +++ b/code/frontend/src/components/interactive/BoxRepositoriesArchived.js @@ -25,7 +25,7 @@ export default function BoxRepositoriesArchived({ repositories, refresh, ...prop repo={repo} icon={faSearch} refresh={refresh} - canArchive={true} + canArchive={false} canEdit={false} canDelete={repo["owner"]["username"] === user["username"]} /> diff --git a/code/frontend/src/components/interactive/SummaryRepository.js b/code/frontend/src/components/interactive/SummaryRepository.js index ff724be..cb73f5f 100644 --- a/code/frontend/src/components/interactive/SummaryRepository.js +++ b/code/frontend/src/components/interactive/SummaryRepository.js @@ -26,7 +26,6 @@ export default function SummaryRepository( const { fetchDataAuth } = useContext(ContextUser) const history = useHistory() const { fetchNow: archiveThis } = useBackend(fetchDataAuth, "PATCH", `/api/v1/repositories/${repo.id}`, { "close": true }) - const { fetchNow: unarchiveThis } = useBackend(fetchDataAuth, "PATCH", `/api/v1/repositories/${repo.id}`, { "open": true }) const { fetchNow: deletThis } = useBackend(fetchDataAuth, "DELETE", `/api/v1/repositories/${repo.id}`) const onEditClick = () => { @@ -38,11 +37,6 @@ export default function SummaryRepository( await refresh() } - const onUnarchiveClick = async () => { - await unarchiveThis() - await refresh() - } - const onDeleteClick = async () => { await deletThis() await refresh() @@ -71,9 +65,9 @@ export default function SummaryRepository( : null} @@ -83,9 +77,9 @@ export default function SummaryRepository( icon={repo.is_active ? faFolderOpen : faFolder} title={repo.name} subtitle={repo.owner ? repo.owner.username : null} - upperLabel={"Start"} + upperLabel={"Created"} upperValue={repo.start ? new Date(repo.start).toLocaleString() : null} - lowerLabel={"End"} + lowerLabel={"Archived"} lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null} buttons={buttons} {...props} diff --git a/code/frontend/src/components/providers/RepositoryEditor.js b/code/frontend/src/components/providers/RepositoryEditor.js index aa3fdc1..793fe3f 100644 --- a/code/frontend/src/components/providers/RepositoryEditor.js +++ b/code/frontend/src/components/providers/RepositoryEditor.js @@ -55,13 +55,13 @@ export default function RepositoryEditor({ () => { return { "conditions": _conditions, - "end": _end, + "end": null, "evaluation_mode": _evaluationMode, "id": id, "is_active": true, "name": _name, "owner": user, - "start": _start, + "start": null, } }, [_conditions, _end, _evaluationMode, id, _name, user, _start], @@ -69,14 +69,14 @@ export default function RepositoryEditor({ const { error, loading, fetchNow } = useBackend(fetchDataAuth, method, path, body) const save = useCallback( - () => { + async () => { if(!id) { console.info("Creating new repository with body: ", body) } else { console.info("Editing repository ", id, " with body: ", body) } - fetchNow() + await fetchNow() }, [id, body, fetchNow], ) diff --git a/code/frontend/src/routes/PageUsers.js b/code/frontend/src/routes/PageUsers.js new file mode 100644 index 0000000..d70f7b3 --- /dev/null +++ b/code/frontend/src/routes/PageUsers.js @@ -0,0 +1,15 @@ +import React from "react" +import Style from "./PageDashboard.module.css" +import classNames from "classnames" +import BoxHeader from "../components/base/BoxHeader" + + +export default function PageDashboard({ children, className, ...props }) { + return ( +
+ + Manage users + +
+ ) +} diff --git a/code/frontend/src/routes/PageUsers.module.css b/code/frontend/src/routes/PageUsers.module.css new file mode 100644 index 0000000..4d65253 --- /dev/null +++ b/code/frontend/src/routes/PageUsers.module.css @@ -0,0 +1,23 @@ +.PageUsers { + display: grid; + + grid-template-areas: + "a a" + "b c" + "d d"; + grid-template-rows: auto auto 1fr; + grid-template-columns: 1fr 1fr; + + grid-gap: 10px; + + width: 100%; + height: 100%; +} + +.Header { + grid-area: a; +} + +.RepositoryEditor { + grid-area: b; +}