Skip to content

Commit fb9f3e3

Browse files
authored
Fix fe warnings when running yarn start (#2387)
1 parent 987a8a2 commit fb9f3e3

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

ui-cra/src/components/GitAuth/OAuthCallback.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function OAuthCallback({
5151
const { setNotifications } = useNotifications();
5252
const { gitAuthClient } = React.useContext(GitAuth);
5353
const params = qs.parse(history.location.search);
54-
const errorState = error || paramsError;
5554

5655
React.useEffect(() => {
5756
if (provider === GitProvider.GitLab) {
@@ -89,7 +88,7 @@ function OAuthCallback({
8988
history.push(linkResolver(state?.page || ''));
9089
return;
9190
}
92-
}, [res, history, linkResolver]);
91+
}, [res, history, linkResolver, params.error, provider]);
9392

9493
React.useEffect(() => {
9594
if (error) {

ui-cra/src/components/Pipelines/PipelineDetails/Workloads.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { Button, Flex, formatURL, Link } from '@weaveworks/weave-gitops';
1+
import { Flex, formatURL, Link } from '@weaveworks/weave-gitops';
22
import {
33
Pipeline,
44
PipelineTargetStatus,
55
} from '../../../api/pipelines/types.pb';
66
import { ClusterDashboardLink } from '../../Clusters/ClusterDashboardLink';
7-
87
import { Grid } from '@material-ui/core';
98
import { useListConfigContext } from '../../../contexts/ListConfig';
109
import {

ui-cra/src/components/Secrets/Create/PrviewPRModal.tsx renamed to ui-cra/src/components/Secrets/Create/PreviewPRModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import useNotifications from '../../../contexts/Notifications';
55
import { SecretPRPreview } from '../../../types/custom';
66
import { renderKustomization } from '../../Applications/utils';
77
import Preview from '../../Templates/Form/Partials/Preview';
8+
89
const { small } = theme.spacing;
910
const PreviewPRSection = styled.div`
1011
display: flex;
1112
justify-content: flex-end;
1213
padding: ${small};
1314
`;
1415

15-
export const PrviewPRModal = ({ formData, getClusterAutomations }: any) => {
16+
export const PreviewPRModal = ({ formData, getClusterAutomations }: any) => {
1617
const [openPreview, setOpenPreview] = useState(false);
1718
const [previewLoading, setPreviewLoading] = useState<boolean>(false);
1819
const [PRPreview, setPRPreview] = useState<SecretPRPreview | null>(null);
@@ -36,7 +37,6 @@ export const PrviewPRModal = ({ formData, getClusterAutomations }: any) => {
3637
})
3738
.finally(() => setPreviewLoading(false));
3839
}, [
39-
formData,
4040
getClusterAutomations,
4141
setOpenPreview,
4242
setPRPreview,

ui-cra/src/components/Secrets/Create/index.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Link,
77
LoadingPage,
88
theme,
9-
useListSources
9+
useListSources,
1010
} from '@weaveworks/weave-gitops';
1111
import { PageRoute } from '@weaveworks/weave-gitops/ui/lib/types';
1212
import { useCallback, useEffect, useMemo, useState } from 'react';
@@ -15,7 +15,7 @@ import styled from 'styled-components';
1515
import {
1616
ClusterAutomation,
1717
ExternalSecretStore,
18-
GitopsCluster
18+
GitopsCluster,
1919
} from '../../../cluster-services/cluster_services.pb';
2020
import CallbackStateContextProvider from '../../../contexts/GitAuth/CallbackStateContext';
2121
import useNotifications from '../../../contexts/Notifications';
@@ -26,7 +26,7 @@ import { Routes } from '../../../utils/nav';
2626
import { isUnauthenticated, removeToken } from '../../../utils/request';
2727
import {
2828
CreateDeploymentObjects,
29-
useClustersWithSources
29+
useClustersWithSources,
3030
} from '../../Applications/utils';
3131
import { getGitRepos } from '../../Clusters';
3232
import { clearCallbackState, getProviderToken } from '../../GitAuth/utils';
@@ -36,10 +36,10 @@ import { GitRepositoryEnriched } from '../../Templates/Form';
3636
import GitOps from '../../Templates/Form/Partials/GitOps';
3737
import {
3838
getInitialGitRepo,
39-
getRepositoryUrl
39+
getRepositoryUrl,
4040
} from '../../Templates/Form/utils';
4141
import { SelectSecretStore } from './Form/Partials/SelectSecretStore';
42-
import { PrviewPRModal } from './PrviewPRModal';
42+
import { PreviewPRModal } from './PreviewPRModal';
4343

4444
const { medium, large } = theme.spacing;
4545
const { neutral20, neutral10 } = theme.colors;
@@ -135,7 +135,6 @@ const CreateSecret = () => {
135135

136136
const [showAuthDialog, setShowAuthDialog] = useState<boolean>(false);
137137
const [formData, setFormData] = useState<any>(initialFormData);
138-
const [submitType, setSubmitType] = useState<string>('');
139138
const [selectedSecretStore, setSelectedSecretStore] =
140139
useState<ExternalSecretStore>({});
141140
const [enableCreatePR, setEnableCreatePR] = useState<boolean>(false);
@@ -335,12 +334,7 @@ const CreateSecret = () => {
335334
<FormWrapper
336335
noValidate
337336
onSubmit={event =>
338-
validateFormData(
339-
event,
340-
handleCreateSecret,
341-
setFormError,
342-
setSubmitType,
343-
)
337+
validateFormData(event, handleCreateSecret, setFormError)
344338
}
345339
>
346340
<div className="group-section">
@@ -425,7 +419,7 @@ const CreateSecret = () => {
425419
}
426420
/>
427421
</div>
428-
<PrviewPRModal
422+
<PreviewPRModal
429423
formData={formData}
430424
getClusterAutomations={getClusterAutomations}
431425
/>

ui-cra/src/utils/form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export const validateFormData = (
220220
event: any,
221221
onSubmit: any,
222222
setFormError: Dispatch<React.SetStateAction<any>>,
223-
setSubmitType: Dispatch<React.SetStateAction<string>>,
223+
setSubmitType?: Dispatch<React.SetStateAction<string>>,
224224
) => {
225225
event.preventDefault();
226226
const requiredButEmptyInputs = Array.from(event.target).filter(
@@ -234,5 +234,5 @@ export const validateFormData = (
234234
(firstEmpty as HTMLInputElement).focus();
235235
setFormError((firstEmpty as HTMLInputElement).name);
236236
}
237-
setSubmitType('');
237+
setSubmitType && setSubmitType('');
238238
};

0 commit comments

Comments
 (0)