mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
💥 stuff
This commit is contained in:
parent
8d3d7afa3d
commit
2bba121cae
5 changed files with 47 additions and 15 deletions
|
@ -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"]}
|
||||
/>
|
||||
|
|
|
@ -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(
|
|||
<Button
|
||||
color={"Grey"}
|
||||
icon={faArchive}
|
||||
onClick={repo.is_active ? onArchiveClick : onUnarchiveClick}
|
||||
onClick={onArchiveClick}
|
||||
>
|
||||
{repo.is_active ? "Archive" : "Unarchive"}
|
||||
{"Archive"}
|
||||
</Button>
|
||||
: 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}
|
||||
|
|
|
@ -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],
|
||||
)
|
||||
|
|
15
code/frontend/src/routes/PageUsers.js
Normal file
15
code/frontend/src/routes/PageUsers.js
Normal 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>
|
||||
)
|
||||
}
|
23
code/frontend/src/routes/PageUsers.module.css
Normal file
23
code/frontend/src/routes/PageUsers.module.css
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue