1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2025-02-16 12:43:58 +00:00

💥 stuff

This commit is contained in:
Stefano Pigozzi 2021-05-11 19:42:04 +02:00
parent 8d3d7afa3d
commit 2bba121cae
Signed by untrusted user who does not match committer: steffo
GPG key ID: 6965406171929D01
5 changed files with 47 additions and 15 deletions

View file

@ -25,7 +25,7 @@ export default function BoxRepositoriesArchived({ repositories, refresh, ...prop
repo={repo} repo={repo}
icon={faSearch} icon={faSearch}
refresh={refresh} refresh={refresh}
canArchive={true} canArchive={false}
canEdit={false} canEdit={false}
canDelete={repo["owner"]["username"] === user["username"]} canDelete={repo["owner"]["username"] === user["username"]}
/> />

View file

@ -26,7 +26,6 @@ export default function SummaryRepository(
const { fetchDataAuth } = useContext(ContextUser) const { fetchDataAuth } = useContext(ContextUser)
const history = useHistory() const history = useHistory()
const { fetchNow: archiveThis } = useBackend(fetchDataAuth, "PATCH", `/api/v1/repositories/${repo.id}`, { "close": true }) 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 { fetchNow: deletThis } = useBackend(fetchDataAuth, "DELETE", `/api/v1/repositories/${repo.id}`)
const onEditClick = () => { const onEditClick = () => {
@ -38,11 +37,6 @@ export default function SummaryRepository(
await refresh() await refresh()
} }
const onUnarchiveClick = async () => {
await unarchiveThis()
await refresh()
}
const onDeleteClick = async () => { const onDeleteClick = async () => {
await deletThis() await deletThis()
await refresh() await refresh()
@ -71,9 +65,9 @@ export default function SummaryRepository(
<Button <Button
color={"Grey"} color={"Grey"}
icon={faArchive} icon={faArchive}
onClick={repo.is_active ? onArchiveClick : onUnarchiveClick} onClick={onArchiveClick}
> >
{repo.is_active ? "Archive" : "Unarchive"} {"Archive"}
</Button> </Button>
: null} : null}
</> </>
@ -83,9 +77,9 @@ export default function SummaryRepository(
icon={repo.is_active ? faFolderOpen : faFolder} icon={repo.is_active ? faFolderOpen : faFolder}
title={repo.name} title={repo.name}
subtitle={repo.owner ? repo.owner.username : null} subtitle={repo.owner ? repo.owner.username : null}
upperLabel={"Start"} upperLabel={"Created"}
upperValue={repo.start ? new Date(repo.start).toLocaleString() : null} upperValue={repo.start ? new Date(repo.start).toLocaleString() : null}
lowerLabel={"End"} lowerLabel={"Archived"}
lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null} lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null}
buttons={buttons} buttons={buttons}
{...props} {...props}

View file

@ -55,13 +55,13 @@ export default function RepositoryEditor({
() => { () => {
return { return {
"conditions": _conditions, "conditions": _conditions,
"end": _end, "end": null,
"evaluation_mode": _evaluationMode, "evaluation_mode": _evaluationMode,
"id": id, "id": id,
"is_active": true, "is_active": true,
"name": _name, "name": _name,
"owner": user, "owner": user,
"start": _start, "start": null,
} }
}, },
[_conditions, _end, _evaluationMode, id, _name, user, _start], [_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 { error, loading, fetchNow } = useBackend(fetchDataAuth, method, path, body)
const save = useCallback( const save = useCallback(
() => { async () => {
if(!id) { if(!id) {
console.info("Creating new repository with body: ", body) console.info("Creating new repository with body: ", body)
} }
else { else {
console.info("Editing repository ", id, " with body: ", body) console.info("Editing repository ", id, " with body: ", body)
} }
fetchNow() await fetchNow()
}, },
[id, body, fetchNow], [id, body, fetchNow],
) )

View file

@ -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 (
<div className={classNames(Style.PageHome, className)} {...props}>
<BoxHeader className={Style.Header}>
Manage users
</BoxHeader>
</div>
)
}

View file

@ -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;
}