1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00

🚧 Fix minor bugs in BoxRepositoryCreate

This commit is contained in:
Stefano Pigozzi 2021-05-10 17:24:32 +02:00
parent 9c96e20d4a
commit 3798a33452
Signed by untrusted user who does not match committer: steffo
GPG key ID: 6965406171929D01
2 changed files with 10 additions and 8 deletions

View file

@ -8,6 +8,8 @@ import Radio from "../base/Radio"
import Button from "../base/Button"
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import FormAlert from "../base/formparts/FormAlert"
import goToOnSuccess from "../../utils/goToOnSuccess"
import { useHistory } from "react-router"
/**
@ -28,6 +30,8 @@ export default function BoxRepositoryCreate({ ...props }) {
error,
} = useRepositoryEditor()
const history = useHistory()
return (
<BoxFull header={"Create repository"} {...props}>
<FormLabelled onSubmit={e => {e.preventDefault(); save()}}>
@ -68,8 +72,7 @@ export default function BoxRepositoryCreate({ ...props }) {
style={{"gridColumn": "1 / 3"}}
icon={faPencilAlt}
color={"Green"}
goTo={"/repositories"}
onClick={e => save()}
onClick={e => goToOnSuccess(save, history, "/repositories")}
>
Edit repository
</Button>
@ -78,8 +81,7 @@ export default function BoxRepositoryCreate({ ...props }) {
style={{"gridColumn": "1 / 3"}}
icon={faPlus}
color={"Green"}
goTo={"/repositories"}
onClick={e => save()}
onClick={e => goToOnSuccess(save, history, "/repositories")}
>
Create repository
</Button>

View file

@ -24,16 +24,16 @@ export default function RepositoryEditor({
className,
}) {
/** The repository name. */
const [_name, setName] = useState(name)
const [_name, setName] = useState(name ?? "")
/** The repository state (active / archived). */
const [_isActive, setActive] = useState(isActive)
const [_isActive, setActive] = useState(isActive ?? true)
/** The start date of the data gathering. */
const [_start, setStart] = useState(start)
const [_start, setStart] = useState(start ?? new Date().toISOString())
/** The end date of the data gathering. */
const [_end, setEnd] = useState(end)
const [_end, setEnd] = useState(end ?? new Date().toISOString())
/** The conditions of the data gathering. */
const {