Skip to content

Commit

Permalink
#OBS-I304 : p1 issues fix after test
Browse files Browse the repository at this point in the history
  • Loading branch information
yashashkumar committed Nov 13, 2024
1 parent 73e0f34 commit 175cb69
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ const Processing: React.FC = () => {
dialog={<AddPIIDialog />}
transformationOptions={transformationOptions}
addedSuggestions={piiSuggestions}
setPiiSuggestions={setPiiSuggestions}
data={_.map(_.get(processingData, 'pii'), (obj1) => {
const matchingObj = _.find(piiSuggestions, {
column: _.get(obj1, 'column')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const AddTransformationExpression = (props: any) => {
}, [data]);

const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setEvaluationData(transformationType)
setAnchorEl(event.currentTarget);
};

Expand All @@ -100,6 +101,13 @@ const AddTransformationExpression = (props: any) => {
};

const closeTransformations = () => {
setFormData((prevState: any) => ({
...prevState,
section: {
...prevState.section,
transformationType: ''
}
}));
setAnchorEl(null);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const AddNewField = (props: any) => {
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
const [evaluationData, setEvaluationData] = useState<string>('');
const [transformErrors, setTransformErrors] = useState<boolean>(false);
const [transformationError, setTransformationError] = useState<string | null>(null);
const [transformationTypeError, setTransformationTypeError] = useState<string | null>(null);

const open = Boolean(anchorEl);

Expand Down Expand Up @@ -74,6 +76,7 @@ const AddNewField = (props: any) => {
}, [data]);

const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setEvaluationData(transformationType)
setAnchorEl(event.currentTarget);
};

Expand All @@ -92,6 +95,13 @@ const AddNewField = (props: any) => {
};

const closeTransformations = () => {
setFormData((prevState: any) => ({
...prevState,
section: {
...prevState.section,
transformationType: ''
}
}));
setAnchorEl(null);
};

Expand Down Expand Up @@ -131,9 +141,6 @@ const AddNewField = (props: any) => {
onClose();
};

const [transformationError, setTransformationError] = useState<string | null>(null);
const [transformationTypeError, setTransformationTypeError] = useState<string | null>(null);

const transformation = _.get(formData, ['section', 'transformations']);
const transformationType = _.get(formData, ['section', 'transformationType']);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ const AddPIIDialog = (props: any) => {

useEffect(() => {
const transformations = _.get(data, ['column'], '');

console.log({data})
if (!_.isEmpty(data)) {
const existingData = {
section: {
transformations,
transformationType: _.get(data, ['transformationType']),
transformationMode: _.get(data, ['transformationMode'])
transformations: transformations,
transformationType: _.capitalize(_.get(data, ['transformationType'])),
transformationMode: _.capitalize(_.get(data, ['transformationMode']))
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const ProcessingSection = (props: any) => {
dialog,
transformationOptions,
jsonData,
addedSuggestions
addedSuggestions,
setPiiSuggestions
} = props;

const [dialogOpen, setDialogOpen] = useState(false);
Expand Down Expand Up @@ -180,43 +181,41 @@ const ProcessingSection = (props: any) => {
const renderSuggestedFields = () => {
const suggestedFields = _.differenceBy(addedSuggestions, data, 'column');

if (!_.isEmpty(suggestedFields))
const handleRemoveSuggestion = (suggestion: any) => {
setPiiSuggestions((prevSuggestions:any) =>
prevSuggestions.filter((item:any) => !_.isEqual(_.get(item, 'column'), _.get(suggestion, 'column')))
);
};

if (!_.isEmpty(suggestedFields))
return (
<Grid>
<Box sx={{ pt: 1, textAlign: 'start' }}>
<Typography variant="body2" fontWeight="500">
Add suggested fields :
</Typography>
</Box>
<Box
sx={{
textAlign: 'start',
overflowY: 'scroll',
scrollbarWidth: 'none',
height: '5rem',
mt: 2
}}
>
{_.map(suggestedFields, (ele: any) => (
<Chip
onDelete={() => {
addedSuggestions.filter(
(item: any) =>
!_.isEqual(
_.get(item, ['column']),
_.get(ele, ['column'])
)
);
}}
key={_.get(ele, ['column'])}
label={_.get(ele, ['column'])}
onClick={() => handleEditValues(ele)}
sx={{ ml: 1, mb: 1 }}
variant="outlined"
/>
))}
</Box>
</Grid>
<Grid>
<Box sx={{ pt: 1, textAlign: 'start' }}>
<Typography variant="body2" fontWeight="500">
Add suggested fields:
</Typography>
</Box>
<Box
sx={{
textAlign: 'start',
overflowY: 'scroll',
scrollbarWidth: 'none',
height: '5rem',
mt: 2
}}
>
{_.map(suggestedFields, (ele: any) => (
<Chip
onDelete={() => handleRemoveSuggestion(ele)}
key={_.get(ele, ['column'])}
label={_.get(ele, ['column'])}
onClick={() => handleEditValues(ele)}
sx={{ ml: 1, mb: 1 }}
variant="outlined"
/>
))}
</Box>
</Grid>
);
};

Expand Down
2 changes: 1 addition & 1 deletion web-console-v2/src/pages/dashboardV1/draftDatasetsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const DraftDatasetsList = (props: any) => {
setIsLoading(true);
try {
await deleteDataset({ id: _.get(selection, "dataset_id") })
showAlert("Dataset retired successfully", 'success');
showAlert("Dataset deleted successfully", 'success');
} catch (err: any) {
const errMessage = _.get(err, 'response.data.params.errmsg') || en["dataset-delete-failure"];
showAlert(errMessage, 'error');
Expand Down
2 changes: 1 addition & 1 deletion web-console-v2/src/pages/datasetV1/ImportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const ImportDailog = (props: any) => {
<Box sx={{ p: 1, py: 1.5 }}>
<DialogTitle>
<Alert severity="error" sx={{ lineHeight: 0, display: "flex", justifyContent: "flex-start", mt: 1 }}>
<Typography variant="caption" fontSize={14}>
<Typography variant="body1" fontSize={14}>
Dataset Already Exists. Please select the option given below.
</Typography>
</Alert>
Expand Down

0 comments on commit 175cb69

Please sign in to comment.