Skip to content

Commit

Permalink
rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig O'Donnell committed Jan 25, 2024
1 parent 655d6f8 commit ab2ae95
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type State = {
appSlugFromMetadata: string | null;
adminConsoleMetadata: Metadata | null;
connectionTerminated: boolean;
showClusterUpgradeModal: boolean;
shouldShowClusterUpgradeModal: boolean;
errLoggingOut: string;
featureFlags: object;
fetchingMetadata: boolean;
Expand All @@ -121,7 +121,7 @@ const Root = () => {
appNameSpace: null,
adminConsoleMetadata: null,
connectionTerminated: false,
showClusterUpgradeModal: false,
shouldShowClusterUpgradeModal: false,
errLoggingOut: "",
featureFlags: {},
isHelmManaged: false,
Expand Down Expand Up @@ -707,11 +707,11 @@ const Root = () => {
isEmbeddedCluster={Boolean(
state.adminConsoleMetadata?.isEmbeddedCluster
)}
setShowClusterUpgradeModal={(
showClusterUpgradeModal: boolean
setShouldShowClusterUpgradeModal={(
shouldShowClusterUpgradeModal: boolean
) => {
setState({
showClusterUpgradeModal: showClusterUpgradeModal,
shouldShowClusterUpgradeModal: shouldShowClusterUpgradeModal,
});
}}
/>
Expand All @@ -732,9 +732,9 @@ const Root = () => {
isEmbeddedCluster={Boolean(
state.adminConsoleMetadata?.isEmbeddedCluster
)}
setShowClusterUpgradeModal={(showUpgradeModal: boolean) => {
setShouldShowClusterUpgradeModal={(showUpgradeModal: boolean) => {
setState({
showClusterUpgradeModal: showUpgradeModal,
shouldShowClusterUpgradeModal: showUpgradeModal,
});
}}
/>
Expand Down Expand Up @@ -866,7 +866,7 @@ const Root = () => {
ariaHideApp={false}
className="ConnectionTerminated--wrapper Modal DefaultSize"
>
{!state.showClusterUpgradeModal && (
{!state.shouldShowClusterUpgradeModal && (
<ConnectionTerminated
connectionTerminated={state.connectionTerminated}
appLogo={state.appLogo}
Expand All @@ -875,7 +875,7 @@ const Root = () => {
}
/>
)}
{state.showClusterUpgradeModal && (
{state.shouldShowClusterUpgradeModal && (
<EmbeddedClusterUpgrading
setTerminatedState={(status: boolean) =>
setState({ connectionTerminated: status })
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/apps/AppDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Props = {
refetchAppMetadata: () => void;
snapshotInProgressApps: string[];
isEmbeddedCluster: boolean;
setShowClusterUpgradeModal: (showClusterUpgradeModal: boolean) => void;
setShouldShowClusterUpgradeModal: (shouldShowClusterUpgradeModal: boolean) => void;
};

type State = {
Expand Down Expand Up @@ -114,8 +114,8 @@ function AppDetailPage(props: Props) {
});
} else {
const shouldShowUpgradeModal =
Utilities.showClusterUpgradeModal(appsList);
props.setShowClusterUpgradeModal(shouldShowUpgradeModal);
Utilities.shouldShowClusterUpgradeModal(appsList);
props.setShouldShowClusterUpgradeModal(shouldShowUpgradeModal);
if (!appsIsError) {
if (appsList?.length === 0 || !params.slug) {
redirectToFirstAppOrInstall();
Expand Down Expand Up @@ -367,7 +367,7 @@ function AppDetailPage(props: Props) {
if (
appIsFetching &&
!selectedApp &&
!Utilities.showClusterUpgradeModal(appsList)
!Utilities.shouldShowClusterUpgradeModal(appsList)
) {
return centeredLoader;
}
Expand All @@ -377,7 +377,7 @@ function AppDetailPage(props: Props) {
if (
(downstream?.currentVersion &&
isAwaitingResults([downstream.currentVersion])) ||
Utilities.showClusterUpgradeModal(appsList)
Utilities.shouldShowClusterUpgradeModal(appsList)
) {
if (appsRefetchInterval === false) {
setAppsRefetchInterval(2000);
Expand Down
2 changes: 1 addition & 1 deletion web/src/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ export const Utilities = {
);
},

showClusterUpgradeModal(apps) {
shouldShowClusterUpgradeModal(apps) {
if (!apps || apps.length === 0) {
return false;
}
Expand Down
16 changes: 8 additions & 8 deletions web/src/utilities/utilities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ describe("Utilities", () => {
});
});

describe("showClusterUpgradeModal", () => {
describe("shouldShowClusterUpgradeModal", () => {
it("should return false if apps is null or empty", () => {
expect(Utilities.showClusterUpgradeModal(null)).toBe(false);
expect(Utilities.showClusterUpgradeModal([])).toBe(false);
expect(Utilities.shouldShowClusterUpgradeModal(null)).toBe(false);
expect(Utilities.shouldShowClusterUpgradeModal([])).toBe(false);
});

it("should return false if the user has not tried to deploy the current version", () => {
Expand All @@ -31,7 +31,7 @@ describe("Utilities", () => {
},
},
];
expect(Utilities.showClusterUpgradeModal(apps)).toBe(false);
expect(Utilities.shouldShowClusterUpgradeModal(apps)).toBe(false);
});

it("should return false if the user has tried to deploy the current version, but a cluster upgrade is not required", () => {
Expand All @@ -47,7 +47,7 @@ describe("Utilities", () => {
},
},
];
expect(Utilities.showClusterUpgradeModal(apps)).toBe(false);
expect(Utilities.shouldShowClusterUpgradeModal(apps)).toBe(false);
});

it("should return false if the user has tried to deploy the current version and a cluster upgrade is already completed", () => {
Expand All @@ -64,7 +64,7 @@ describe("Utilities", () => {
},
},
];
expect(Utilities.showClusterUpgradeModal(apps)).toBe(false);
expect(Utilities.shouldShowClusterUpgradeModal(apps)).toBe(false);
});

it("should return true if the user has tried to deploy the current version and a cluster upgrade is required", () => {
Expand All @@ -81,7 +81,7 @@ describe("Utilities", () => {
},
},
];
expect(Utilities.showClusterUpgradeModal(apps)).toBe(true);
expect(Utilities.shouldShowClusterUpgradeModal(apps)).toBe(true);
});

it("should return true if the user has tried to deploy the current version and a cluster upgrade is in progress", () => {
Expand All @@ -98,7 +98,7 @@ describe("Utilities", () => {
},
},
];
expect(Utilities.showClusterUpgradeModal(apps)).toBe(true);
expect(Utilities.shouldShowClusterUpgradeModal(apps)).toBe(true);
});
});
});

0 comments on commit ab2ae95

Please sign in to comment.