From 3bf4fc9d36ffa40249856ae90fa8e8fdbf0762fe Mon Sep 17 00:00:00 2001 From: selankon Date: Wed, 18 Dec 2024 11:06:13 +0100 Subject: [PATCH 1/3] chore(meshupgrade): hide new version available banner On mesh upgrade page --- plugins/lime-plugin-firmware/src/upgradeAvailable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/lime-plugin-firmware/src/upgradeAvailable.js b/plugins/lime-plugin-firmware/src/upgradeAvailable.js index 82a865ba8..bc3cadfb7 100644 --- a/plugins/lime-plugin-firmware/src/upgradeAvailable.js +++ b/plugins/lime-plugin-firmware/src/upgradeAvailable.js @@ -22,7 +22,7 @@ export const UpgradeAvailableBanner = () => { // @ts-ignore {({ path }) => - !["firmware", "releaseInfo", "meshwide/upgrade"].includes( + !["firmware", "releaseInfo", "meshwideupgrade"].includes( path.replace("/", "") ) && (
Date: Wed, 18 Dec 2024 12:27:00 +0100 Subject: [PATCH 2/3] chore(meshupgrade): improve status messages --- .../src/components/nextStepFooter.tsx | 2 +- .../upgradeState/ConfirmationPending.tsx | 8 ++++++++ .../upgradeState/UpgradeScheduled.tsx | 14 ++++++++++++- .../src/hooks/useStepper.tsx | 20 +++---------------- .../src/meshUpgradeTypes.ts | 2 ++ 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/components/nextStepFooter.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/components/nextStepFooter.tsx index 11f8304b3..9515acbd1 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/components/nextStepFooter.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/components/nextStepFooter.tsx @@ -152,7 +152,7 @@ const NextStepFooter = () => { default: step = { status: "warning", - children: Try last step again, + children: Abort current upgrade process, }; } if (isShowAbortButtonState(stepperState)) { diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/ConfirmationPending.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/ConfirmationPending.tsx index d510c9cec..08cbf81c1 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/ConfirmationPending.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/ConfirmationPending.tsx @@ -5,9 +5,11 @@ import { StepState, } from "components/mesh-wide-wizard/StepState"; +import { useMeshUpgrade } from "plugins/lime-plugin-mesh-wide-upgrade/src/hooks/meshWideUpgradeProvider"; import { useParallelConfirmUpgrade } from "plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueries"; export const ConfirmationPending = () => { + const { thisNode } = useMeshUpgrade(); const { errors } = useParallelConfirmUpgrade(); const title = ( @@ -26,6 +28,12 @@ export const ConfirmationPending = () => { If not confirmed, the upgrade will be rolled back after a while +
+ {thisNode.confirm_remaining > 0 && ( + + {thisNode.confirm_remaining} seconds remaining + + )} {errors?.length > 0 && } diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/UpgradeScheduled.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/UpgradeScheduled.tsx index b76c8a622..18419a907 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/UpgradeScheduled.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/UpgradeScheduled.tsx @@ -9,16 +9,28 @@ import { useMeshUpgrade } from "plugins/lime-plugin-mesh-wide-upgrade/src/hooks/ import { useParallelScheduleUpgrade } from "plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueries"; export const UpgradeScheduled = () => { - const { totalNodes } = useMeshUpgrade(); + const { totalNodes, thisNode } = useMeshUpgrade(); const { errors, results } = useParallelScheduleUpgrade(); const nodesToBeUpgraded = results?.length; + let remainingMessage = Upgrade will start soon; + if (thisNode.safeupgrade_start_remaining > 0) { + remainingMessage = ( + + {thisNode.safeupgrade_start_remaining} seconds remaining + + ); + } + return ( Upgrade is scheduled!}> <> {nodesToBeUpgraded} of {totalNodes} will be upgraded +
+ {remainingMessage} +
{errors?.length > 0 && }
diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/hooks/useStepper.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/hooks/useStepper.tsx index 3ccb85ce0..aae905e66 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/hooks/useStepper.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/hooks/useStepper.tsx @@ -1,20 +1,6 @@ -import { Trans } from "@lingui/macro"; -import { useMemo } from "react"; - -import { useDisclosure } from "components/Modal/useDisclosure"; -import { IStatusAndButton } from "components/status/statusAndButton"; - -import { - AbortModal, - ConfirmModal, - ScheduleUpgradeModal, -} from "plugins/lime-plugin-mesh-wide-upgrade/src/components/modals"; -import { useMeshUpgrade } from "plugins/lime-plugin-mesh-wide-upgrade/src/hooks/meshWideUpgradeProvider"; import { UseConfirmUpgradeType, UseScheduleMeshSafeUpgradeType, - useParallelConfirmUpgrade, - useParallelScheduleUpgrade, } from "plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueries"; import { MeshWideUpgradeInfo, @@ -70,15 +56,15 @@ export const getStepperStatus = ( if (scheduleMeshSafeUpgradeStatus?.isLoading) { return "SENDING_START_SCHEDULE"; } - if (someNodeAreDownloading) { - return "NODES_DOWNLOADING"; - } if ( scheduleMeshSafeUpgradeStatus?.results?.length || scheduleMeshSafeUpgradeStatus?.errors?.length ) { return "UPGRADE_SCHEDULED"; } + if (someNodeAreDownloading) { + return "NODES_DOWNLOADING"; + } // Here the user can send the schedule upgrade to the nodes return "TRANSACTION_STARTED"; } diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes.ts b/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes.ts index 10fd27122..42fc6569d 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes.ts +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes.ts @@ -47,6 +47,8 @@ export interface NodeMeshUpgradeInfo { board_name: string; current_fw: string; node_ip: string; + confirm_remaining: number; + safeupgrade_start_remaining: number; } export type MeshWideNodeUpgradeInfo = { From 5541483a4e1e9aa181bab3d878532cf76c5a6c34 Mon Sep 17 00:00:00 2001 From: selankon Date: Wed, 18 Dec 2024 12:33:27 +0100 Subject: [PATCH 3/3] chore(meshupgrade): hide confirmation banner when confirmed --- .../src/components/upgradeState/Confirmed.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/Confirmed.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/Confirmed.tsx index 50a2d70f1..e4a3de32f 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/Confirmed.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/components/upgradeState/Confirmed.tsx @@ -1,4 +1,5 @@ import { Trans } from "@lingui/macro"; +import { useEffect } from "preact/hooks"; import { MeshUpgradeErrorIcon, @@ -9,12 +10,19 @@ import { import { useParallelConfirmUpgrade } from "plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueries"; +import queryCache from "utils/queryCache"; + export const Confirmed = () => { const { errors } = useParallelConfirmUpgrade(); - // let icon =
; let icon = ; let title = Confirmed!; let desc = Mesh upgrade confirmed successfully; + + // Invalidate confirmation banner queries to avoid showing the banner again + useEffect(() => { + queryCache.invalidateQueries(["lime-utils", "get_upgrade_info"]); + }, []); + if (errors?.length > 0) { icon = ; title = Confirmed with some errors;