Skip to content

Commit

Permalink
add autoApprovalEnabled property to frontend (Create, Import, Update …
Browse files Browse the repository at this point in the history
…forms)
  • Loading branch information
Sofia Sazonova committed Jan 18, 2024
1 parent 64af891 commit 3a11f2e
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 11 deletions.
39 changes: 34 additions & 5 deletions frontend/src/modules/Datasets/views/DatasetCreateForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Grid,
Link,
MenuItem,
Switch,
TextField,
Typography
} from '@mui/material';
Expand Down Expand Up @@ -54,6 +55,7 @@ const DatasetCreateForm = (props) => {
'Secret'
]);


const topicsData = Topics.map((t) => ({ label: t, value: t }));

const fetchEnvironments = useCallback(async () => {
Expand Down Expand Up @@ -106,6 +108,10 @@ const DatasetCreateForm = (props) => {
}
}, [client, fetchEnvironments, dispatch]);

function test(x){
console.log(x);
}

async function submit(values, setStatus, setSubmitting, setErrors) {
try {
const response = await client.mutate(
Expand All @@ -119,7 +125,8 @@ const DatasetCreateForm = (props) => {
tags: values.tags,
description: values.description,
topics: values.topics ? values.topics.map((t) => t.value) : [],
confidentiality: values.confidentiality
confidentiality: values.confidentiality,
autoApprovalEnabled: values.autoApprovalEnabled
})
);
if (!response.errors) {
Expand Down Expand Up @@ -214,7 +221,8 @@ const DatasetCreateForm = (props) => {
confidentiality: '',
SamlGroupName: '',
tags: [],
topics: []
topics: [],
autoApprovalEnabled: false
}}
validationSchema={Yup.object().shape({
label: Yup.string()
Expand All @@ -230,7 +238,9 @@ const DatasetCreateForm = (props) => {
stewards: Yup.string().max(255).nullable(),
confidentiality: Yup.string()
.max(255)
.required('*Confidentiality is required')
.required('*Confidentiality is required'),
autoApprovalEnabled: Yup.boolean()
.required('*AutoApproval property is required'),
})}
onSubmit={async (
values,
Expand Down Expand Up @@ -263,7 +273,6 @@ const DatasetCreateForm = (props) => {
name="label"
onBlur={handleBlur}
onChange={handleChange}
value={values.label}
variant="outlined"
/>
</CardContent>
Expand Down Expand Up @@ -300,7 +309,7 @@ const DatasetCreateForm = (props) => {
)}
</CardContent>
</Card>
<Card sx={{ mt: 3 }}>
<Card sx={{ mt: 4 }}>
<CardHeader title="Classification" />
<CardContent>
<TextField
Expand Down Expand Up @@ -368,6 +377,26 @@ const DatasetCreateForm = (props) => {
/>
</Box>
</CardContent>
<CardContent>
<TextField
fullWidth
label="Auto Approval"
name="autoApprovalEnabled"
onChange={handleChange}
select
value={values.autoApprovalEnabled}
variant="outlined"
>

<MenuItem key={'Enabled'} value={true}>
Enabled
</MenuItem>
<MenuItem key={'Enabled'} value={false}>
Disabled
</MenuItem>

</TextField>
</CardContent>
</Card>
</Grid>
<Grid item lg={5} md={5} xs={12}>
Expand Down
32 changes: 29 additions & 3 deletions frontend/src/modules/Datasets/views/DatasetEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ const DatasetEditForm = (props) => {
? values.terms.nodes.map((t) => t.nodeUri)
: values.terms.map((t) => t.nodeUri),
confidentiality: values.confidentiality,
KmsAlias: values.KmsAlias
KmsAlias: values.KmsAlias,
autoApprovalEnabled: values.autoApprovalEnabled

}
})
);
Expand Down Expand Up @@ -261,7 +263,9 @@ const DatasetEditForm = (props) => {
terms: dataset.terms || [],
stewards: dataset.stewards,
confidentiality: dataset.confidentiality,
KmsAlias: dataset.KmsAlias
KmsAlias: dataset.KmsAlias,
autoApprovalEnabled: dataset.autoApprovalEnabled

}}
validationSchema={Yup.object().shape({
label: Yup.string()
Expand All @@ -273,7 +277,9 @@ const DatasetEditForm = (props) => {
tags: Yup.array().min(1).required('*Tags are required'),
confidentiality: Yup.string().required(
'*Confidentiality is required'
)
),
autoApprovalEnabled: Yup.boolean()
.required('*AutoApproval property is required'),
})}
onSubmit={async (
values,
Expand Down Expand Up @@ -453,6 +459,26 @@ const DatasetEditForm = (props) => {
/>
</Box>
</CardContent>
<CardContent>
<TextField
fullWidth
label="Auto Approval"
name="autoApprovalEnabled"
onChange={handleChange}
select
value={values.autoApprovalEnabled}
variant="outlined"
>

<MenuItem key={'Enabled'} value={true}>
Enabled
</MenuItem>
<MenuItem key={'Enabled'} value={false}>
Disabled
</MenuItem>

</TextField>
</CardContent>
</Card>
</Grid>
<Grid item lg={5} md={5} xs={12}>
Expand Down
30 changes: 27 additions & 3 deletions frontend/src/modules/Datasets/views/DatasetImportForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ const DatasetImportForm = (props) => {
KmsKeyAlias: values.KmsKeyAlias,
glueDatabaseName: values.glueDatabaseName,
stewards: values.stewards,
confidentiality: values.confidentiality
confidentiality: values.confidentiality,
autoApprovalEnabled: values.autoApprovalEnabled
})
);
if (!response.errors) {
Expand Down Expand Up @@ -222,7 +223,8 @@ const DatasetImportForm = (props) => {
glueDatabaseName: '',
bucketName: '',
KmsKeyAlias: '',
confidentiality: ''
confidentiality: '',
autoApprovalEnabled: false,
}}
validationSchema={Yup.object().shape({
label: Yup.string()
Expand All @@ -242,7 +244,9 @@ const DatasetImportForm = (props) => {
.required('*S3 bucket name is required'),
confidentiality: Yup.string()
.max(255)
.required('*Confidentiality is required')
.required('*Confidentiality is required'),
autoApprovalEnabled: Yup.boolean()
.required('*AutoApproval property is required'),
})}
onSubmit={async (
values,
Expand Down Expand Up @@ -380,6 +384,26 @@ const DatasetImportForm = (props) => {
/>
</Box>
</CardContent>
<CardContent>
<TextField
fullWidth
label="Auto Approval"
name="autoApprovalEnabled"
onChange={handleChange}
select
value={values.autoApprovalEnabled}
variant="outlined"
>

<MenuItem key={'Enabled'} value={true}>
Enabled
</MenuItem>
<MenuItem key={'Enabled'} value={false}>
Disabled
</MenuItem>

</TextField>
</CardContent>
</Card>
</Grid>
<Grid item lg={5} md={5} xs={12}>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/services/graphql/Datasets/getDataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const getDataset = (datasetUri) => ({
topics
language
confidentiality
autoApprovalEnabled
organization {
organizationUri
label
Expand Down

0 comments on commit 3a11f2e

Please sign in to comment.