Skip to content

Commit

Permalink
Fixing of linting error (#627)
Browse files Browse the repository at this point in the history
Fixing the frontend linting errors to make pipelines green again!

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
nikpodsh authored Aug 3, 2023
1 parent cb399c6 commit 1af8f08
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 231 deletions.
2 changes: 1 addition & 1 deletion frontend/src/api/ShareObject/rejectShareObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const rejectShareObject = ({ shareUri, rejectPurpose }) => ({
},
mutation: gql`
mutation RejectShareObject($shareUri: String!, $rejectPurpose: String!) {
rejectShareObject(shareUri: $shareUri,rejectPurpose: $rejectPurpose) {
rejectShareObject(shareUri: $shareUri, rejectPurpose: $rejectPurpose) {
shareUri
status
}
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/api/ShareObject/updateShareRejectReason.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ const updateShareRejectReason = ({ shareUri, rejectPurpose }) => ({
rejectPurpose
},
mutation: gql`
mutation updateShareRejectReason($shareUri: String!,$rejectPurpose: String!) {
updateShareRejectReason(shareUri: $shareUri, rejectPurpose: $rejectPurpose)
mutation updateShareRejectReason(
$shareUri: String!
$rejectPurpose: String!
) {
updateShareRejectReason(
shareUri: $shareUri
rejectPurpose: $rejectPurpose
)
}
`
});
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/api/ShareObject/updateShareRequestReason.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ const updateShareRequestReason = ({ shareUri, requestPurpose }) => ({
requestPurpose
},
mutation: gql`
mutation updateShareRequestReason($shareUri: String!, $requestPurpose: String!) {
updateShareRequestReason(shareUri: $shareUri, requestPurpose: $requestPurpose)
mutation updateShareRequestReason(
$shareUri: String!
$requestPurpose: String!
) {
updateShareRequestReason(
shareUri: $shareUri
requestPurpose: $requestPurpose
)
}
`
});
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import ReactDOM from 'react-dom';
import { HelmetProvider } from 'react-helmet-async';
import { BrowserRouter } from 'react-router-dom';
import { Provider as ReduxProvider } from 'react-redux';
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import StyledEngineProvider from '@mui/material/StyledEngineProvider';
import App from './App';
import { AuthProvider } from './contexts/AmplifyContext';
Expand Down
22 changes: 10 additions & 12 deletions frontend/src/views/Datasets/DatasetConsoleAccess.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import PropTypes from 'prop-types';
import {
Box,
Card,
CardContent,
CardHeader,
Divider,
Typography
Card,
CardContent,
CardHeader,
Divider,
Typography
} from '@mui/material';

const DatasetConsoleAccess = (props) => {
Expand Down Expand Up @@ -48,7 +47,7 @@ const DatasetConsoleAccess = (props) => {
{dataset.IAMDatasetAdminRoleArn}
</Typography>
</CardContent>
{ dataset.KmsAlias === "SSE-S3" || dataset.KmsAlias === "Undefined" ?
{dataset.KmsAlias === 'SSE-S3' || dataset.KmsAlias === 'Undefined' ? (
<CardContent>
<Typography color="textSecondary" variant="subtitle2">
S3 Encryption
Expand All @@ -57,17 +56,16 @@ const DatasetConsoleAccess = (props) => {
{`${dataset.KmsAlias}`}
</Typography>
</CardContent>
:
<CardContent>
) : (
<CardContent>
<Typography color="textSecondary" variant="subtitle2">
S3 Encryption SSE-KMS
</Typography>
<Typography color="textPrimary" variant="body2">
{`arn:aws:kms:${dataset.region}:${dataset.AwsAccountId}/alias:${dataset.KmsAlias}`}
</Typography>
</CardContent>

}
</CardContent>
)}
</Card>
);
};
Expand Down
35 changes: 18 additions & 17 deletions frontend/src/views/Datasets/DatasetEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,23 +483,24 @@ const DatasetEditForm = (props) => {
variant="outlined"
/>
</CardContent>
{ dataset.imported && dataset.KmsAlias === 'Undefined' &&
<CardContent>
<TextField
error={Boolean(
touched.KmsAlias && errors.KmsAlias
)}
fullWidth
helperText={touched.KmsAlias && errors.KmsAlias}
label="Amazon KMS key Alias (if SSE-KMS encryption is used). Otherwise leave empty."
name="KmsAlias"
onBlur={handleBlur}
onChange={handleChange}
value={values.KmsAlias}
variant="outlined"
/>
</CardContent>
}
{dataset.imported &&
dataset.KmsAlias === 'Undefined' && (
<CardContent>
<TextField
error={Boolean(
touched.KmsAlias && errors.KmsAlias
)}
fullWidth
helperText={touched.KmsAlias && errors.KmsAlias}
label="Amazon KMS key Alias (if SSE-KMS encryption is used). Otherwise leave empty."
name="KmsAlias"
onBlur={handleBlur}
onChange={handleChange}
value={values.KmsAlias}
variant="outlined"
/>
</CardContent>
)}
</Card>
<Card>
<CardHeader title="Governance" />
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/views/Datasets/DatasetImportForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const DatasetImportForm = (props) => {
tags: values.tags,
description: values.description,
topics: values.topics ? values.topics.map((t) => t.value) : [],
bucketName: values.bucketName,
bucketName: values.bucketName,
KmsKeyAlias: values.KmsKeyAlias,
glueDatabaseName: values.glueDatabaseName,
stewards: values.stewards,
Expand Down Expand Up @@ -463,7 +463,9 @@ const DatasetImportForm = (props) => {
touched.KmsKeyAlias && errors.KmsKeyAlias
)}
fullWidth
helperText={touched.KmsKeyAlias && errors.KmsKeyAlias}
helperText={
touched.KmsKeyAlias && errors.KmsKeyAlias
}
label="Amazon KMS key Alias (if SSE-KMS encryption is used)"
name="KmsKeyAlias"
onBlur={handleBlur}
Expand Down
29 changes: 16 additions & 13 deletions frontend/src/views/Environments/EnvironmentCreateForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ const EnvironmentCreateForm = (props) => {
};

const getCDKExecPolicyUrl = async () => {
const response = await client.query(getCDKExecPolicyPresignedUrl(params.uri));
const response = await client.query(
getCDKExecPolicyPresignedUrl(params.uri)
);
if (!response.errors) {
window.open(response.data.getCDKExecPolicyPresignedUrl, '_blank');
} else {
Expand Down Expand Up @@ -310,20 +312,21 @@ const EnvironmentCreateForm = (props) => {
</Box>
<Box>
<Typography color="textSecondary" variant="subtitle2">
Use the below CloudFormation stack to create the custom IAM policy.
Use the below CloudFormation stack to create the custom IAM
policy.
</Typography>
<Button
color="primary"
startIcon={<CloudDownloadOutlined fontSize="small" />}
sx={{ mt: 1, mb: 2, ml: 2 }}
variant="outlined"
onClick={() => {
getCDKExecPolicyUrl().catch((e) =>
dispatch({ type: SET_ERROR, error: e.message })
);
}}
>
CloudFormation stack for CDK custom execution policy
color="primary"
startIcon={<CloudDownloadOutlined fontSize="small" />}
sx={{ mt: 1, mb: 2, ml: 2 }}
variant="outlined"
onClick={() => {
getCDKExecPolicyUrl().catch((e) =>
dispatch({ type: SET_ERROR, error: e.message })
);
}}
>
CloudFormation stack for CDK custom execution policy
</Button>
<Typography color="textPrimary" variant="subtitle2">
<CopyToClipboard
Expand Down
10 changes: 4 additions & 6 deletions frontend/src/views/Shares/ShareRejectModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@mui/material';
import { LoadingButton } from '@mui/lab';
import SendIcon from '@mui/icons-material/Send';
import React, { useState } from 'react';
import React from 'react';

const ShareRejectModal = (props) => {
const { share, onApply, onClose, open, rejectFunction, ...other } = props;
Expand All @@ -36,14 +36,12 @@ const ShareRejectModal = (props) => {
<Box sx={{ p: 3 }}>
<Formik
initialValues={{
comment: share.rejectPurpose ? share.rejectPurpose: ''
comment: share.rejectPurpose ? share.rejectPurpose : ''
}}
validationSchema={Yup.object().shape({
comment: Yup.string().max(200)
})}
onSubmit={async (
values
) => {
onSubmit={async (values) => {
await rejectFunction(values.comment);
}}
>
Expand Down Expand Up @@ -113,7 +111,7 @@ ShareRejectModal.propTypes = {
onApply: PropTypes.func,
onClose: PropTypes.func,
rejectFunction: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,
open: PropTypes.bool.isRequired
};

export default ShareRejectModal;
49 changes: 31 additions & 18 deletions frontend/src/views/Shares/ShareUpdateReject.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,27 @@ import React, { useState } from 'react';
import updateShareRejectReason from '../../api/ShareObject/updateShareRejectReason';

const UpdateRejectReason = (props) => {
const { share, client, dispatch, enqueueSnackbar, fetchItem, ...other } = props;
const { share, client, dispatch, enqueueSnackbar, fetchItem, ...other } =
props;
const [isUpdateRejectModalOpen, setIsUpdateRejectModalOpen] = useState(false);
const [updating, setUpdating] = useState(false);

const handleUpdateRejectModalOpen = () => {setIsUpdateRejectModalOpen(true);};
const handleUpdateRejectModalClose = () => {setIsUpdateRejectModalOpen(false);};
const handleUpdateRejectModalOpen = () => {
setIsUpdateRejectModalOpen(true);
};
const handleUpdateRejectModalClose = () => {
setIsUpdateRejectModalOpen(false);
};
const update = async (comment) => {
setUpdating(true);
const response = await client.mutate(
updateShareRejectReason(
{
shareUri: share.shareUri,
rejectPurpose: comment
}
)
updateShareRejectReason({
shareUri: share.shareUri,
rejectPurpose: comment
})
);
if (!response.errors) {
handleUpdateRejectModalClose()
handleUpdateRejectModalClose();
enqueueSnackbar('Share reject reason updated', {
anchorOrigin: {
horizontal: 'right',
Expand Down Expand Up @@ -61,7 +64,13 @@ const UpdateRejectReason = (props) => {
>
Edit
</LoadingButton>
<Dialog maxWidth="sm" fullWidth onClose={handleUpdateRejectModalClose} open={isUpdateRejectModalOpen} {...other}>
<Dialog
maxWidth="sm"
fullWidth
onClose={handleUpdateRejectModalClose}
open={isUpdateRejectModalOpen}
{...other}
>
<Box sx={{ p: 3 }}>
<Typography
align="center"
Expand All @@ -72,21 +81,23 @@ const UpdateRejectReason = (props) => {
Update Share Reject Reason
</Typography>
<Box sx={{ mt: 2 }}>
<Typography align="center" variant="subtitle2" color="textSecondary">
<Typography
align="center"
variant="subtitle2"
color="textSecondary"
>
Update a reason to reject the share request:
</Typography>
</Box>
<Box sx={{ p: 3 }}>
<Formik
initialValues={{
comment: share.rejectPurpose ? share.rejectPurpose: ''
comment: share.rejectPurpose ? share.rejectPurpose : ''
}}
validationSchema={Yup.object().shape({
comment: Yup.string().max(200)
})}
onSubmit={async (
values
) => {
onSubmit={async (values) => {
await update(values.comment);
}}
>
Expand Down Expand Up @@ -125,7 +136,9 @@ const UpdateRejectReason = (props) => {
/>
{touched.comment && errors.comment && (
<Box sx={{ mt: 2 }}>
<FormHelperText error>{errors.comment}</FormHelperText>
<FormHelperText error>
{errors.comment}
</FormHelperText>
</Box>
)}
</CardContent>
Expand Down Expand Up @@ -157,7 +170,7 @@ UpdateRejectReason.propTypes = {
client: PropTypes.any,
dispatch: PropTypes.any,
enqueueSnackbar: PropTypes.any,
fetchItem: PropTypes.func,
fetchItem: PropTypes.func
};

export default UpdateRejectReason;
Loading

0 comments on commit 1af8f08

Please sign in to comment.