Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh committed Sep 27, 2023
1 parent 0782d1f commit 43a0b80
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 41 deletions.
61 changes: 32 additions & 29 deletions web/src/components/snapshots/SnapshotSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,37 @@ type Props = {
} & RouterProps;

type State = {
snapshotSettings: any | null,
isLoadingSnapshotSettings: boolean,
snapshotSettingsErr: boolean,
snapshotSettingsErrMsg: string,
toggleSnapshotView: boolean,
hideCheckVeleroButton: boolean,
updateConfirm: boolean,
updatingSettings: boolean,
updateErrorMsg: string,
showConfigureSnapshotsModal: boolean,
kotsadmRequiresVeleroAccess: boolean,
minimalRBACKotsadmNamespace: string,
showResetFileSystemWarningModal: boolean,
resetFileSystemWarningMessage: string,
snapshotSettingsJob: Repeater,
checkForVeleroAndNodeAgent: boolean,
isEmptyView?: boolean,
veleroUpdated?: boolean,
nodeAgentUpdated?: boolean,
snapshotSettings?: {
isVeleroRunning: boolean;
veleroVersion: string;
veleroPod?: object;
nodeAgentPods?: object[];
};
isLoadingSnapshotSettings: boolean;
snapshotSettingsErr: boolean;
snapshotSettingsErrMsg: string;
toggleSnapshotView: boolean;
hideCheckVeleroButton: boolean;
updateConfirm: boolean;
updatingSettings: boolean;
updateErrorMsg: string;
showConfigureSnapshotsModal: boolean;
kotsadmRequiresVeleroAccess: boolean;
minimalRBACKotsadmNamespace: string;
showResetFileSystemWarningModal: boolean;
resetFileSystemWarningMessage: string;
snapshotSettingsJob: Repeater;
checkForVeleroAndNodeAgent: boolean;
isEmptyView?: boolean;
veleroUpdated?: boolean;
nodeAgentUpdated?: boolean;
};

class SnapshotSettings extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
snapshotSettings: null,
snapshotSettings: undefined,
isLoadingSnapshotSettings: true,
snapshotSettingsErr: false,
snapshotSettingsErrMsg: "",
Expand Down Expand Up @@ -167,15 +172,15 @@ class SnapshotSettings extends Component<Props, State> {
this.setState({ veleroUpdated: true });
}

let sortedStateNodeAgentPods = [];
let sortedLastStateNodeAgentPods = [];
let sortedStateNodeAgentPods: object[] | undefined = [];
let sortedLastStateNodeAgentPods: object[] | undefined = [];
if (!isEmpty(this.state.snapshotSettings?.nodeAgentPods)) {
sortedStateNodeAgentPods =
this.state.snapshotSettings?.nodeAgentPods.sort();
this.state.snapshotSettings?.nodeAgentPods?.sort();
}
if (!isEmpty(lastState.snapshotSettings?.nodeAgentPods)) {
sortedLastStateNodeAgentPods =
lastState.snapshotSettings?.nodeAgentPods.sort();
lastState.snapshotSettings?.nodeAgentPods?.sort();
}
if (
!isEqual(sortedStateNodeAgentPods, sortedLastStateNodeAgentPods) &&
Expand Down Expand Up @@ -205,7 +210,7 @@ class SnapshotSettings extends Component<Props, State> {
}
}
}
}
};

toggleSnapshotView = (isEmptyView?: boolean) => {
this.setState({
Expand All @@ -214,7 +219,7 @@ class SnapshotSettings extends Component<Props, State> {
});
};

updateSettings = (payload: any) => {
updateSettings = (payload: object) => {
this.setState({
updatingSettings: true,
updateErrorMsg: "",
Expand Down Expand Up @@ -350,8 +355,6 @@ class SnapshotSettings extends Component<Props, State> {
);
}

console.log("this.props", this.props)

return (
<div className="flex1 flex-column u-overflow--auto">
<KotsPageTitle pageName="Snapshot Settings" />
Expand Down Expand Up @@ -404,4 +407,4 @@ class SnapshotSettings extends Component<Props, State> {
}
}

export default withRouter(SnapshotSettings);
export default withRouter(SnapshotSettings);
27 changes: 15 additions & 12 deletions web/src/components/snapshots/SnapshotStorageDestination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,20 @@ type Props = {
isKurlEnabled?: boolean;
kotsadmRequiresVeleroAccess: boolean;
minimalRBACKotsadmNamespace: string;
openConfigureSnapshotsMinimalRBACModal: (kotsadmRequiresVeleroAccess: boolean, minimalRBACKotsadmNamespace: string) => void;
openConfigureSnapshotsMinimalRBACModal: (
kotsadmRequiresVeleroAccess: boolean,
minimalRBACKotsadmNamespace: string
) => void;
renderNotVeleroMessage: () => void;
resetFileSystemWarningMessage: string;
showConfigureSnapshotsModal: boolean;
showResetFileSystemWarningModal: boolean;
snapshotSettings: {
snapshotSettings?: {
fileSystemConfig?: FileSystemConfig;
isKurl?: boolean;
isMinioDisabled?: boolean;
isVeleroRunning?: boolean;
store: StoreProvider;
store?: StoreProvider;
veleroPlugins?: string[];
veleroVersion?: string;
};
Expand Down Expand Up @@ -370,22 +373,22 @@ class SnapshotStorageDestination extends Component<Props, State> {
const { snapshotSettings } = this.props;

if (provider === "aws") {
if (snapshotSettings.store?.aws) {
if (snapshotSettings?.store?.aws) {
return (
snapshotSettings.store?.aws.region !== s3Region ||
snapshotSettings.store?.aws.accessKeyID !== s3KeyId ||
snapshotSettings.store?.aws.secretAccessKey !== s3KeySecret ||
snapshotSettings.store?.aws.useInstanceRole !== useIamAws
snapshotSettings?.store?.aws.region !== s3Region ||
snapshotSettings?.store?.aws.accessKeyID !== s3KeyId ||
snapshotSettings?.store?.aws.secretAccessKey !== s3KeySecret ||
snapshotSettings?.store?.aws.useInstanceRole !== useIamAws
);
}
return true;
}
if (provider === "gcp") {
if (snapshotSettings.store?.gcp) {
if (snapshotSettings?.store?.gcp) {
return (
snapshotSettings.store?.gcp.useInstanceRole !== gcsUseIam ||
snapshotSettings.store?.gcp.serviceAccount !== gcsServiceAccount ||
snapshotSettings.store?.gcp.jsonFile !== gcsJsonFile
snapshotSettings?.store?.gcp.useInstanceRole !== gcsUseIam ||
snapshotSettings?.store?.gcp.serviceAccount !== gcsServiceAccount ||
snapshotSettings?.store?.gcp.jsonFile !== gcsJsonFile
);
}
return true;
Expand Down

0 comments on commit 43a0b80

Please sign in to comment.