-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added templating and access requests buttons to the new model create screen #1563
Changes from 1 commit
f471a60
6eed242
167b3c0
d8d46d3
236c0ea
808d465
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { ArrowBack, FileUpload, Lock, LockOpen } from '@mui/icons-material' | ||
import { ArrowBack, FileUpload, FolderCopy, Lock, LockOpen } from '@mui/icons-material' | ||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore' | ||
import LoadingButton from '@mui/lab/LoadingButton' | ||
import { | ||
|
@@ -7,12 +7,14 @@ import { | |
AccordionSummary, | ||
Box, | ||
Button, | ||
Checkbox, | ||
Divider, | ||
FormControlLabel, | ||
Paper, | ||
Radio, | ||
RadioGroup, | ||
Stack, | ||
Switch, | ||
Tooltip, | ||
Typography, | ||
} from '@mui/material' | ||
|
@@ -60,6 +62,8 @@ export default function CreateEntry({ createEntryKind, onBackClick }: CreateEntr | |
const [collaborators, setCollaborators] = useState<CollaboratorEntry[]>( | ||
currentUser ? [{ entity: `${EntityKind.USER}:${currentUser?.dn}`, roles: ['owner'] }] : [], | ||
) | ||
const [ungovernedAccess, setungovernedAccess] = useState<boolean>(false) | ||
const [allowTemplating, setAllowTemplating] = useState<boolean>(true) | ||
const [errorMessage, setErrorMessage] = useState('') | ||
const [loading, setLoading] = useState(false) | ||
|
||
|
@@ -86,6 +90,8 @@ export default function CreateEntry({ createEntryKind, onBackClick }: CreateEntr | |
visibility, | ||
collaborators, | ||
settings: { | ||
ungovernedAccess, | ||
allowTemplating, | ||
mirror: { | ||
sourceModelId, | ||
}, | ||
|
@@ -130,6 +136,20 @@ export default function CreateEntry({ createEntryKind, onBackClick }: CreateEntr | |
) | ||
} | ||
|
||
const templateLabel = () => { | ||
return ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<Stack direction='row' justifyContent='center' alignItems='center' spacing={1}> | ||
<FolderCopy /> | ||
<Stack sx={{ my: 1 }}> | ||
<Typography fontWeight='bold'>Templating</Typography> | ||
<Typography variant='caption'> | ||
{`Allow this to be used as a template for another ${EntryKindLabel[createEntryKind]}`} | ||
</Typography> | ||
</Stack> | ||
</Stack> | ||
) | ||
} | ||
|
||
if (isCurrentUserError) { | ||
return <MessageAlert message={isCurrentUserError.info.message} severity='error' /> | ||
} | ||
|
@@ -174,24 +194,36 @@ export default function CreateEntry({ createEntryKind, onBackClick }: CreateEntr | |
<Typography component='h3' variant='h6'> | ||
Access control | ||
</Typography> | ||
<RadioGroup | ||
defaultValue='public' | ||
value={visibility} | ||
onChange={(e) => setVisibility(e.target.value as EntryForm['visibility'])} | ||
> | ||
<FormControlLabel | ||
value='public' | ||
control={<Radio />} | ||
label={publicLabel()} | ||
data-test='publicButtonSelector' | ||
/> | ||
<FormControlLabel | ||
value='private' | ||
control={<Radio />} | ||
label={privateLabel()} | ||
data-test='privateButtonSelector' | ||
/> | ||
</RadioGroup> | ||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}> | ||
<RadioGroup | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to use this |
||
defaultValue='public' | ||
value={visibility} | ||
onChange={(e) => setVisibility(e.target.value as EntryForm['visibility'])} | ||
> | ||
<FormControlLabel | ||
value='public' | ||
control={<Radio />} | ||
label={publicLabel()} | ||
data-test='publicButtonSelector' | ||
/> | ||
<FormControlLabel | ||
value='private' | ||
control={<Radio />} | ||
label={privateLabel()} | ||
data-test='privateButtonSelector' | ||
/> | ||
<FormControlLabel | ||
value='false' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The option to allow for templating should appear at the bottom of the expansion menu under or above the choice to allow for ungoverned access. Although I can see why you'd put it under "Access control", this section is accessing the model card page - easy mistake to make though! |
||
control={ | ||
<Checkbox | ||
onChange={(event) => setAllowTemplating(event.target.checked)} | ||
checked={allowTemplating} | ||
/> | ||
} | ||
label={templateLabel()} | ||
/> | ||
</RadioGroup> | ||
</Box> | ||
</> | ||
<Accordion sx={{ borderTop: 'none' }}> | ||
<AccordionSummary | ||
|
@@ -224,6 +256,16 @@ export default function CreateEntry({ createEntryKind, onBackClick }: CreateEntr | |
]} | ||
/> | ||
</Box> | ||
<FormControlLabel | ||
label='Ungoverned access requests' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put the "allow templating" option here, and I'd suggest adding a sub-heading of "Additional settings", a bit like how the user selector appears under the heading of "Manage access list". To easily space out different components you can use the MUI
|
||
control={ | ||
<Switch | ||
onChange={(e) => setungovernedAccess(e.target.checked)} | ||
checked={ungovernedAccess} | ||
size='small' | ||
/> | ||
} | ||
/> | ||
</AccordionDetails> | ||
</Accordion> | ||
<Box sx={{ textAlign: 'right' }}> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean
andstring
can be inferred from their defaults so we don't need to declare the types, so we can just douseState(false)
.