mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 13:04: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 Button from "../base/Button"
|
||||||
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
|
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
|
||||||
import FormAlert from "../base/formparts/FormAlert"
|
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,
|
error,
|
||||||
} = useRepositoryEditor()
|
} = useRepositoryEditor()
|
||||||
|
|
||||||
|
const history = useHistory()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BoxFull header={"Create repository"} {...props}>
|
<BoxFull header={"Create repository"} {...props}>
|
||||||
<FormLabelled onSubmit={e => {e.preventDefault(); save()}}>
|
<FormLabelled onSubmit={e => {e.preventDefault(); save()}}>
|
||||||
|
@ -68,8 +72,7 @@ export default function BoxRepositoryCreate({ ...props }) {
|
||||||
style={{"gridColumn": "1 / 3"}}
|
style={{"gridColumn": "1 / 3"}}
|
||||||
icon={faPencilAlt}
|
icon={faPencilAlt}
|
||||||
color={"Green"}
|
color={"Green"}
|
||||||
goTo={"/repositories"}
|
onClick={e => goToOnSuccess(save, history, "/repositories")}
|
||||||
onClick={e => save()}
|
|
||||||
>
|
>
|
||||||
Edit repository
|
Edit repository
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -78,8 +81,7 @@ export default function BoxRepositoryCreate({ ...props }) {
|
||||||
style={{"gridColumn": "1 / 3"}}
|
style={{"gridColumn": "1 / 3"}}
|
||||||
icon={faPlus}
|
icon={faPlus}
|
||||||
color={"Green"}
|
color={"Green"}
|
||||||
goTo={"/repositories"}
|
onClick={e => goToOnSuccess(save, history, "/repositories")}
|
||||||
onClick={e => save()}
|
|
||||||
>
|
>
|
||||||
Create repository
|
Create repository
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -24,16 +24,16 @@ export default function RepositoryEditor({
|
||||||
className,
|
className,
|
||||||
}) {
|
}) {
|
||||||
/** The repository name. */
|
/** The repository name. */
|
||||||
const [_name, setName] = useState(name)
|
const [_name, setName] = useState(name ?? "")
|
||||||
|
|
||||||
/** The repository state (active / archived). */
|
/** The repository state (active / archived). */
|
||||||
const [_isActive, setActive] = useState(isActive)
|
const [_isActive, setActive] = useState(isActive ?? true)
|
||||||
|
|
||||||
/** The start date of the data gathering. */
|
/** 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. */
|
/** 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. */
|
/** The conditions of the data gathering. */
|
||||||
const {
|
const {
|
||||||
|
|
Loading…
Reference in a new issue