From 91c78ee3a718b957bdbaccb7d6ddaedb5f2b4860 Mon Sep 17 00:00:00 2001 From: Mia Wong Date: Thu, 15 Aug 2024 19:58:03 +0000 Subject: [PATCH 1/6] wip --- .../apps/AvailableUpdatesComponent.tsx | 76 ++++++++++++++----- .../components/DashboardVersionCard.tsx | 66 ++++++++++++++++ 2 files changed, 124 insertions(+), 18 deletions(-) diff --git a/web/src/components/apps/AvailableUpdatesComponent.tsx b/web/src/components/apps/AvailableUpdatesComponent.tsx index c817d1c57c..7bb5b84031 100644 --- a/web/src/components/apps/AvailableUpdatesComponent.tsx +++ b/web/src/components/apps/AvailableUpdatesComponent.tsx @@ -3,6 +3,7 @@ import MountAware from "@components/shared/MountAware"; import { AirgapUploader } from "@src/utilities/airgapUploader"; import { Utilities } from "@src/utilities/utilities"; import { AvailableUpdate } from "@types"; +import { useNavigate } from "react-router-dom"; import ReactTooltip from "react-tooltip"; const AvailableUpdatesComponent = ({ @@ -13,6 +14,8 @@ const AvailableUpdatesComponent = ({ airgapUploader, isAirgap, fetchAvailableUpdates, + dashboardView = false, + appSlug, }: { updates: AvailableUpdate[]; showReleaseNotes: (releaseNotes: string) => void; @@ -21,13 +24,22 @@ const AvailableUpdatesComponent = ({ isLoading?: boolean; error?: string; } | null; - startUpgradeService: (version: AvailableUpdate) => void; - airgapUploader: AirgapUploader | null; - isAirgap: boolean; + startUpgradeService?: (version: AvailableUpdate) => void; + airgapUploader?: AirgapUploader | null; + isAirgap?: boolean; fetchAvailableUpdates: () => void; + dashboardView?: boolean; + appSlug?: string; }) => { + const navigate = useNavigate(); return ( -
+

Available Updates @@ -46,7 +58,11 @@ const AvailableUpdatesComponent = ({

)} -
+
)} - + + {isCurrentVersionLoading ? "Preparing..." : "Deploy"} + + + )} + {dashboardView && ( + + )}
{upgradeService?.error && diff --git a/web/src/features/Dashboard/components/DashboardVersionCard.tsx b/web/src/features/Dashboard/components/DashboardVersionCard.tsx index 32e9c87294..66501b1426 100644 --- a/web/src/features/Dashboard/components/DashboardVersionCard.tsx +++ b/web/src/features/Dashboard/components/DashboardVersionCard.tsx @@ -27,6 +27,7 @@ import "@src/scss/components/watches/DashboardCard.scss"; import Icon from "@src/components/Icon"; import { + AvailableUpdate, Downstream, KotsParams, Metadata, @@ -36,11 +37,13 @@ import { } from "@types"; import { AirgapUploader } from "@src/utilities/airgapUploader"; import EditConfigIcon from "@components/shared/EditConfigIcon"; +import AvailableUpdatesComponent from "@components/apps/AvailableUpdatesComponent"; type Props = { adminConsoleMetadata: Metadata | null; airgapUploader: AirgapUploader | null; airgapUploadError: string | null; + checkingForUpdates: boolean; checkingForUpdateError: boolean; checkingUpdateText: string; @@ -71,6 +74,7 @@ type Props = { }; type State = { + availableUpdates: AvailableUpdate[]; confirmType: string; deployView: boolean; displayConfirmDeploymentModal: boolean; @@ -78,6 +82,7 @@ type State = { displayShowDetailsModal: boolean; firstSequence: string; secondSequence: string; + isFetchingAvailableUpdates: boolean; isRedeploy: boolean; isSkipPreflights: boolean; kotsUpdateChecker: Repeater; @@ -110,6 +115,11 @@ type State = { versionToDeploy: Version | null; viewLogsErrMsg: string; yamlErrorDetails: string[]; + upgradeService: { + versionLabel?: string; + isLoading?: boolean; + error?: string; + } | null; }; const DashboardVersionCard = (props: Props) => { @@ -119,12 +129,14 @@ const DashboardVersionCard = (props: Props) => { ...newState, }), { + availableUpdates: [], confirmType: "", deployView: false, displayConfirmDeploymentModal: false, displayKotsUpdateModal: false, displayShowDetailsModal: false, firstSequence: "", + isFetchingAvailableUpdates: false, isSkipPreflights: false, isRedeploy: false, kotsUpdateChecker: new Repeater(), @@ -156,6 +168,7 @@ const DashboardVersionCard = (props: Props) => { versionToDeploy: null, viewLogsErrMsg: "", yamlErrorDetails: [], + upgradeService: {}, } ); const navigate = useNavigate(); @@ -178,6 +191,9 @@ const DashboardVersionCard = (props: Props) => { if (props.links && props.links.length > 0) { setState({ selectedAction: props.links[0] }); } + if (props.adminConsoleMetadata?.isEmbeddedCluster) { + fetchAvailableUpdates(); + } }, []); useEffect(() => { @@ -1397,6 +1413,33 @@ const DashboardVersionCard = (props: Props) => { ); }; + const fetchAvailableUpdates = async (showSpinner = true) => { + const appSlug = params.slug; + setState({ isFetchingAvailableUpdates: showSpinner }); + const res = await fetch( + `${process.env.API_ENDPOINT}/app/${appSlug}/updates`, + { + headers: { + "Content-Type": "application/json", + }, + credentials: "include", + method: "GET", + } + ); + if (!res.ok) { + setState({ isFetchingAvailableUpdates: false }); + return; + } + const response = await res.json(); + + setState({ + isFetchingAvailableUpdates: false, + // only show the most recent available update + availableUpdates: response.updates && [response.updates[0]], + }); + return response; + }; + const { currentVersion, checkingForUpdates, @@ -1520,7 +1563,30 @@ const DashboardVersionCard = (props: Props) => {

)} + {props.adminConsoleMetadata?.isEmbeddedCluster && + state.availableUpdates?.length > 0 && ( + <> + {state.isFetchingAvailableUpdates ? ( +
+
+ +
+
+ ) : ( + + )} + + )} + {renderBottomSection()} +
Date: Fri, 16 Aug 2024 20:06:22 +0000 Subject: [PATCH 2/6] wip --- .../apps/AvailableUpdatesComponent.tsx | 81 ++++-------- .../components/AvailableUpdateCard.tsx | 121 ++++++++++++++++++ .../components/DashboardVersionCard.tsx | 77 +++++++---- 3 files changed, 194 insertions(+), 85 deletions(-) create mode 100644 web/src/features/Dashboard/components/AvailableUpdateCard.tsx diff --git a/web/src/components/apps/AvailableUpdatesComponent.tsx b/web/src/components/apps/AvailableUpdatesComponent.tsx index 7bb5b84031..afde1014ff 100644 --- a/web/src/components/apps/AvailableUpdatesComponent.tsx +++ b/web/src/components/apps/AvailableUpdatesComponent.tsx @@ -1,10 +1,10 @@ +import ReactTooltip from "react-tooltip"; + import Icon from "@components/Icon"; import MountAware from "@components/shared/MountAware"; import { AirgapUploader } from "@src/utilities/airgapUploader"; import { Utilities } from "@src/utilities/utilities"; import { AvailableUpdate } from "@types"; -import { useNavigate } from "react-router-dom"; -import ReactTooltip from "react-tooltip"; const AvailableUpdatesComponent = ({ updates, @@ -14,8 +14,6 @@ const AvailableUpdatesComponent = ({ airgapUploader, isAirgap, fetchAvailableUpdates, - dashboardView = false, - appSlug, }: { updates: AvailableUpdate[]; showReleaseNotes: (releaseNotes: string) => void; @@ -24,22 +22,13 @@ const AvailableUpdatesComponent = ({ isLoading?: boolean; error?: string; } | null; - startUpgradeService?: (version: AvailableUpdate) => void; - airgapUploader?: AirgapUploader | null; - isAirgap?: boolean; + startUpgradeService: (version: AvailableUpdate) => void; + airgapUploader: AirgapUploader | null; + isAirgap: boolean; fetchAvailableUpdates: () => void; - dashboardView?: boolean; - appSlug?: string; }) => { - const navigate = useNavigate(); return ( -
+

Available Updates @@ -58,11 +47,7 @@ const AvailableUpdatesComponent = ({

)} -
+
)} - {!dashboardView && ( - - )} + {isCurrentVersionLoading ? "Preparing..." : "Deploy"} + + + - {dashboardView && ( - - )}
{upgradeService?.error && diff --git a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx new file mode 100644 index 0000000000..cda6820988 --- /dev/null +++ b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx @@ -0,0 +1,121 @@ +import { useNavigate } from "react-router-dom"; +import ReactTooltip from "react-tooltip"; + +import Icon from "@components/Icon"; +import { Utilities } from "@src/utilities/utilities"; +import { AvailableUpdate } from "@types"; + +const AvailableUpdateCard = ({ + updates, + showReleaseNotes, + upgradeService, + appSlug, +}: { + updates: AvailableUpdate[]; + showReleaseNotes: (releaseNotes: string) => void; + upgradeService: { + versionLabel?: string; + isLoading?: boolean; + error?: string; + } | null; + appSlug: string; +}) => { + const navigate = useNavigate(); + const update = updates[0]; + const isCurrentVersionLoading = + upgradeService?.versionLabel === update.versionLabel && + upgradeService.isLoading; + return ( +
+
+

+ Latest Available Update +

+

+ {updates && updates.length > 0 && ( + + {updates.length} available + + )} +

+
+ {updates && updates.length > 0 && ( +
+
+
+
+
+

+ {update.versionLabel} +

+ {update.isRequired && ( + + {" "} + Required{" "} + + )} +
+ {update.upstreamReleasedAt && ( +

+ {" "} + Released{" "} + + {Utilities.dateFormat( + update.upstreamReleasedAt, + "MM/DD/YY @ hh:mm a z" + )} + +

+ )} +
+
+ {update?.releaseNotes && ( + <> + showReleaseNotes(update?.releaseNotes)} + data-tip="View release notes" + className="u-marginRight--5 clickable" + /> + + + )} + + + + +
+
+ {upgradeService?.error && + upgradeService?.versionLabel === update.versionLabel && ( +
+ + {upgradeService.error} + +
+ )} +
+
+ )} +
+ ); +}; + +export default AvailableUpdateCard; diff --git a/web/src/features/Dashboard/components/DashboardVersionCard.tsx b/web/src/features/Dashboard/components/DashboardVersionCard.tsx index 66501b1426..701b262b13 100644 --- a/web/src/features/Dashboard/components/DashboardVersionCard.tsx +++ b/web/src/features/Dashboard/components/DashboardVersionCard.tsx @@ -1,31 +1,29 @@ +import classNames from "classnames"; import { useEffect, useReducer } from "react"; +import Modal from "react-modal"; import { Link, useNavigate, useParams } from "react-router-dom"; import ReactTooltip from "react-tooltip"; -import DashboardGitOpsCard from "./DashboardGitOpsCard"; -import MarkdownRenderer from "@src/components/shared/MarkdownRenderer"; + +import EditConfigIcon from "@components/shared/EditConfigIcon"; +import { useSelectedApp } from "@features/App"; import VersionDiff from "@features/VersionDiff/VersionDiff"; -import Modal from "react-modal"; import AirgapUploadProgress from "@src/components/AirgapUploadProgress"; -import Loader from "@src/components/shared/Loader"; -import MountAware from "@src/components/shared/MountAware"; +import Icon from "@src/components/Icon"; import ShowDetailsModal from "@src/components/modals/ShowDetailsModal"; import ShowLogsModal from "@src/components/modals/ShowLogsModal"; +import Loader from "@src/components/shared/Loader"; +import MarkdownRenderer from "@src/components/shared/MarkdownRenderer"; import DeployWarningModal from "@src/components/shared/modals/DeployWarningModal"; import SkipPreflightsModal from "@src/components/shared/modals/SkipPreflightsModal"; -import classNames from "classnames"; +import MountAware from "@src/components/shared/MountAware"; +import { AirgapUploader } from "@src/utilities/airgapUploader"; +import { Repeater } from "@src/utilities/repeater"; import { getPreflightResultState, getReadableGitOpsProviderName, secondsAgo, Utilities, } from "@src/utilities/utilities"; -import { useNextAppVersionWithIntercept } from "../api/useNextAppVersion"; -import { useSelectedApp } from "@features/App"; -import { Repeater } from "@src/utilities/repeater"; - -import "@src/scss/components/watches/DashboardCard.scss"; -import Icon from "@src/components/Icon"; - import { AvailableUpdate, Downstream, @@ -35,9 +33,11 @@ import { VersionDownloadStatus, VersionStatus, } from "@types"; -import { AirgapUploader } from "@src/utilities/airgapUploader"; -import EditConfigIcon from "@components/shared/EditConfigIcon"; -import AvailableUpdatesComponent from "@components/apps/AvailableUpdatesComponent"; +import { useNextAppVersionWithIntercept } from "../api/useNextAppVersion"; +import AvailableUpdateCard from "./AvailableUpdateCard"; +import DashboardGitOpsCard from "./DashboardGitOpsCard"; + +import "@src/scss/components/watches/DashboardCard.scss"; type Props = { adminConsoleMetadata: Metadata | null; @@ -1413,9 +1413,9 @@ const DashboardVersionCard = (props: Props) => { ); }; - const fetchAvailableUpdates = async (showSpinner = true) => { + const fetchAvailableUpdates = async () => { const appSlug = params.slug; - setState({ isFetchingAvailableUpdates: showSpinner }); + setState({ isFetchingAvailableUpdates: true }); const res = await fetch( `${process.env.API_ENDPOINT}/app/${appSlug}/updates`, { @@ -1435,7 +1435,7 @@ const DashboardVersionCard = (props: Props) => { setState({ isFetchingAvailableUpdates: false, // only show the most recent available update - availableUpdates: response.updates && [response.updates[0]], + availableUpdates: response.updates, }); return response; }; @@ -1550,6 +1550,35 @@ const DashboardVersionCard = (props: Props) => { )}
)} + {props.adminConsoleMetadata?.isEmbeddedCluster && ( +
+ {!state.isFetchingAvailableUpdates && ( + fetchAvailableUpdates()} + > + + Check for update + + )} + {state.isFetchingAvailableUpdates && ( +
+ + + Checking for updates + +
+ )} +
+ )}
{currentVersion?.deployedAt ? (
@@ -1567,18 +1596,14 @@ const DashboardVersionCard = (props: Props) => { state.availableUpdates?.length > 0 && ( <> {state.isFetchingAvailableUpdates ? ( -
-
- -
+
+
) : ( - )} From 5a0a37f427595c08039f049b53ade3430ffa3650 Mon Sep 17 00:00:00 2001 From: Mia Wong Date: Fri, 16 Aug 2024 20:19:42 +0000 Subject: [PATCH 3/6] style update --- .../features/Dashboard/components/AvailableUpdateCard.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx index cda6820988..461698c3f6 100644 --- a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx +++ b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx @@ -27,14 +27,14 @@ const AvailableUpdateCard = ({ upgradeService.isLoading; return (
-
+

Latest Available Update

{updates && updates.length > 0 && ( - - {updates.length} available + + ({updates.length} available) )}

From 3e9982ec2ee09d931c76c6e8fec5af115581461e Mon Sep 17 00:00:00 2001 From: Mia Wong Date: Mon, 19 Aug 2024 15:10:47 +0000 Subject: [PATCH 4/6] clean up --- .../apps/AvailableUpdatesComponent.tsx | 5 +- .../components/DashboardVersionCard.tsx | 76 ++++++++----------- 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/web/src/components/apps/AvailableUpdatesComponent.tsx b/web/src/components/apps/AvailableUpdatesComponent.tsx index afde1014ff..c817d1c57c 100644 --- a/web/src/components/apps/AvailableUpdatesComponent.tsx +++ b/web/src/components/apps/AvailableUpdatesComponent.tsx @@ -1,10 +1,9 @@ -import ReactTooltip from "react-tooltip"; - import Icon from "@components/Icon"; import MountAware from "@components/shared/MountAware"; import { AirgapUploader } from "@src/utilities/airgapUploader"; import { Utilities } from "@src/utilities/utilities"; import { AvailableUpdate } from "@types"; +import ReactTooltip from "react-tooltip"; const AvailableUpdatesComponent = ({ updates, @@ -115,7 +114,6 @@ const AvailableUpdatesComponent = ({ /> )} - - { } = useNextAppVersionWithIntercept(); const { latestDeployableVersion } = newAppVersionWithInterceptData || {}; + const fetchAvailableUpdates = async () => { + const appSlug = params.slug; + setState({ isFetchingAvailableUpdates: true }); + const res = await fetch( + `${process.env.API_ENDPOINT}/app/${appSlug}/updates`, + { + headers: { + "Content-Type": "application/json", + }, + credentials: "include", + method: "GET", + } + ); + if (!res.ok) { + setState({ isFetchingAvailableUpdates: false }); + return; + } + const response = await res.json(); + + setState({ + isFetchingAvailableUpdates: false, + availableUpdates: response.updates, + }); + return response; + }; + // moving this out of the state because new repeater instances were getting created // and it doesn't really affect the UI const versionDownloadStatusJobs: { @@ -1413,33 +1438,6 @@ const DashboardVersionCard = (props: Props) => { ); }; - const fetchAvailableUpdates = async () => { - const appSlug = params.slug; - setState({ isFetchingAvailableUpdates: true }); - const res = await fetch( - `${process.env.API_ENDPOINT}/app/${appSlug}/updates`, - { - headers: { - "Content-Type": "application/json", - }, - credentials: "include", - method: "GET", - } - ); - if (!res.ok) { - setState({ isFetchingAvailableUpdates: false }); - return; - } - const response = await res.json(); - - setState({ - isFetchingAvailableUpdates: false, - // only show the most recent available update - availableUpdates: response.updates, - }); - return response; - }; - const { currentVersion, checkingForUpdates, @@ -1594,24 +1592,14 @@ const DashboardVersionCard = (props: Props) => { )} {props.adminConsoleMetadata?.isEmbeddedCluster && state.availableUpdates?.length > 0 && ( - <> - {state.isFetchingAvailableUpdates ? ( -
- -
- ) : ( - - )} - + )} - {renderBottomSection()} -
Date: Tue, 20 Aug 2024 13:32:12 +0000 Subject: [PATCH 5/6] clean up2 --- .../components/AvailableUpdateCard.tsx | 135 +++++++++--------- 1 file changed, 64 insertions(+), 71 deletions(-) diff --git a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx index 461698c3f6..a25042d39e 100644 --- a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx +++ b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx @@ -32,88 +32,81 @@ const AvailableUpdateCard = ({ Latest Available Update

- {updates && updates.length > 0 && ( - - ({updates.length} available) - - )} + + ({updates.length} available) +

- {updates && updates.length > 0 && ( -
-
-
-
-
-

- {update.versionLabel} -

- {update.isRequired && ( - - {" "} - Required{" "} - - )} -
- {update.upstreamReleasedAt && ( -

+

+
+
+
+
+

+ {update.versionLabel} +

+ {update.isRequired && ( + {" "} - Released{" "} - - {Utilities.dateFormat( - update.upstreamReleasedAt, - "MM/DD/YY @ hh:mm a z" - )} - -

+ Required{" "} +
)}
-
- {update?.releaseNotes && ( - <> - showReleaseNotes(update?.releaseNotes)} - data-tip="View release notes" - className="u-marginRight--5 clickable" - /> - - - )} + {update.upstreamReleasedAt && ( +

+ {" "} + Released{" "} + + {Utilities.dateFormat( + update.upstreamReleasedAt, + "MM/DD/YY @ hh:mm a z" + )} + +

+ )} +
+
+ {update?.releaseNotes && ( + <> + showReleaseNotes(update?.releaseNotes)} + data-tip="View release notes" + className="u-marginRight--5 clickable" + /> + + + )} - + - -
+ Go to Version history + +
- {upgradeService?.error && - upgradeService?.versionLabel === update.versionLabel && ( -
- - {upgradeService.error} - -
- )}
+ {upgradeService?.error && + upgradeService?.versionLabel === update.versionLabel && ( +
+ + {upgradeService.error} + +
+ )}
- )} +
); }; From d02382d83c06bd7e91ade00d7e7064cd887ef699 Mon Sep 17 00:00:00 2001 From: Mia Wong Date: Thu, 22 Aug 2024 20:10:58 +0000 Subject: [PATCH 6/6] refactor to reuse available updates component --- .../apps/AvailableUpdatesComponent.tsx | 171 ++++++++++-------- .../components/AvailableUpdateCard.tsx | 100 ++-------- .../components/DashboardVersionCard.tsx | 7 - 3 files changed, 120 insertions(+), 158 deletions(-) diff --git a/web/src/components/apps/AvailableUpdatesComponent.tsx b/web/src/components/apps/AvailableUpdatesComponent.tsx index c817d1c57c..cc47821f65 100644 --- a/web/src/components/apps/AvailableUpdatesComponent.tsx +++ b/web/src/components/apps/AvailableUpdatesComponent.tsx @@ -5,6 +5,80 @@ import { Utilities } from "@src/utilities/utilities"; import { AvailableUpdate } from "@types"; import ReactTooltip from "react-tooltip"; +export const AvailableUpdateRow = ({ + update, + index, + showReleaseNotes, + children, + upgradeService, +}: { + update: AvailableUpdate; + index: number; + showReleaseNotes: (releaseNotes: string) => void; + children: React.ReactNode; + upgradeService?: { + versionLabel?: string; + isLoading?: boolean; + error?: string; + } | null; +}) => { + return ( +
+
+
+
+

+ {update.versionLabel} +

+ {update.isRequired && ( + + {" "} + Required{" "} + + )} +
+ {update.upstreamReleasedAt && ( +

+ {" "} + Released{" "} + + {Utilities.dateFormat( + update.upstreamReleasedAt, + "MM/DD/YY @ hh:mm a z" + )} + +

+ )} +
+
+ {update?.releaseNotes && ( + <> + showReleaseNotes(update?.releaseNotes)} + data-tip="View release notes" + className="u-marginRight--5 clickable" + /> + + + )} + {children} +
+
+ {upgradeService?.error && + upgradeService?.versionLabel === update.versionLabel && ( +
+ + {upgradeService.error} + error + +
+ )} +
+ ); +}; + const AvailableUpdatesComponent = ({ updates, showReleaseNotes, @@ -71,78 +145,33 @@ const AvailableUpdatesComponent = ({ upgradeService?.versionLabel === update.versionLabel && upgradeService.isLoading; return ( -
-
-
-
-

- {update.versionLabel} -

- {update.isRequired && ( - - {" "} - Required{" "} - - )} -
- {update.upstreamReleasedAt && ( -

- {" "} - Released{" "} - - {Utilities.dateFormat( - update.upstreamReleasedAt, - "MM/DD/YY @ hh:mm a z" - )} - -

- )} -
-
- {update?.releaseNotes && ( - <> - showReleaseNotes(update?.releaseNotes)} - data-tip="View release notes" - className="u-marginRight--5 clickable" - /> - - - )} - - -
-
- {upgradeService?.error && - upgradeService?.versionLabel === update.versionLabel && ( -
- - {upgradeService.error} - -
- )} -
+ {isCurrentVersionLoading ? "Preparing..." : "Deploy"} + + + + + ); })}
diff --git a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx index a25042d39e..be93b6dce8 100644 --- a/web/src/features/Dashboard/components/AvailableUpdateCard.tsx +++ b/web/src/features/Dashboard/components/AvailableUpdateCard.tsx @@ -1,30 +1,19 @@ import { useNavigate } from "react-router-dom"; -import ReactTooltip from "react-tooltip"; -import Icon from "@components/Icon"; -import { Utilities } from "@src/utilities/utilities"; import { AvailableUpdate } from "@types"; +import { AvailableUpdateRow } from "@components/apps/AvailableUpdatesComponent"; const AvailableUpdateCard = ({ updates, showReleaseNotes, - upgradeService, appSlug, }: { updates: AvailableUpdate[]; showReleaseNotes: (releaseNotes: string) => void; - upgradeService: { - versionLabel?: string; - isLoading?: boolean; - error?: string; - } | null; appSlug: string; }) => { const navigate = useNavigate(); const update = updates[0]; - const isCurrentVersionLoading = - upgradeService?.versionLabel === update.versionLabel && - upgradeService.isLoading; return (
@@ -38,74 +27,25 @@ const AvailableUpdateCard = ({

-
-
-
-
-

- {update.versionLabel} -

- {update.isRequired && ( - - {" "} - Required{" "} - - )} -
- {update.upstreamReleasedAt && ( -

- {" "} - Released{" "} - - {Utilities.dateFormat( - update.upstreamReleasedAt, - "MM/DD/YY @ hh:mm a z" - )} - -

- )} -
-
- {update?.releaseNotes && ( - <> - showReleaseNotes(update?.releaseNotes)} - data-tip="View release notes" - className="u-marginRight--5 clickable" - /> - - - )} - - - - -
-
- {upgradeService?.error && - upgradeService?.versionLabel === update.versionLabel && ( -
- - {upgradeService.error} - -
- )} -
+ + +
); diff --git a/web/src/features/Dashboard/components/DashboardVersionCard.tsx b/web/src/features/Dashboard/components/DashboardVersionCard.tsx index 822a4bcfcf..7f8bc99dad 100644 --- a/web/src/features/Dashboard/components/DashboardVersionCard.tsx +++ b/web/src/features/Dashboard/components/DashboardVersionCard.tsx @@ -114,11 +114,6 @@ type State = { versionToDeploy: Version | null; viewLogsErrMsg: string; yamlErrorDetails: string[]; - upgradeService: { - versionLabel?: string; - isLoading?: boolean; - error?: string; - } | null; }; const DashboardVersionCard = (props: Props) => { @@ -167,7 +162,6 @@ const DashboardVersionCard = (props: Props) => { versionToDeploy: null, viewLogsErrMsg: "", yamlErrorDetails: [], - upgradeService: {}, } ); const navigate = useNavigate(); @@ -1595,7 +1589,6 @@ const DashboardVersionCard = (props: Props) => { )}