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:
parent
9c96e20d4a
commit
3798a33452
2 changed files with 10 additions and 8 deletions
|
@ -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>
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue