Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/lime-plugin-firmware/src/upgradeAvailable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const UpgradeAvailableBanner = () => {
// @ts-ignore
<Match>
{({ path }) =>
!["firmware", "releaseInfo", "meshwide/upgrade"].includes(
!["firmware", "releaseInfo", "meshwideupgrade"].includes(
path.replace("/", "")
) && (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const NextStepFooter = () => {
default:
step = {
status: "warning",
children: <Trans>Try last step again</Trans>,
children: <Trans>Abort current upgrade process</Trans>,
};
}
if (isShowAbortButtonState(stepperState)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<Trans>
Expand All @@ -26,6 +28,12 @@ export const ConfirmationPending = () => {
If not confirmed, the upgrade will be rolled back after a
while
</Trans>
<br />
{thisNode.confirm_remaining > 0 && (
<Trans>
{thisNode.confirm_remaining} seconds remaining
</Trans>
)}
{errors?.length > 0 && <ParallelErrors errors={errors} />}
</>
</StepState>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Trans } from "@lingui/macro";
import { useEffect } from "preact/hooks";

import {
MeshUpgradeErrorIcon,
Expand All @@ -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 = <div className="text-9xl text-primary-light">✓</div>;
let icon = <MeshUpgradeSuccessIcon />;
let title = <Trans>Confirmed!</Trans>;
let desc = <Trans>Mesh upgrade confirmed successfully</Trans>;

// Invalidate confirmation banner queries to avoid showing the banner again
useEffect(() => {
queryCache.invalidateQueries(["lime-utils", "get_upgrade_info"]);
}, []);

if (errors?.length > 0) {
icon = <MeshUpgradeErrorIcon />;
title = <Trans>Confirmed with some errors</Trans>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <Trans>Upgrade will start soon</Trans>;
if (thisNode.safeupgrade_start_remaining > 0) {
remainingMessage = (
<Trans>
{thisNode.safeupgrade_start_remaining} seconds remaining
</Trans>
);
}

return (
<StepState title={<Trans>Upgrade is scheduled!</Trans>}>
<>
<Trans>
{nodesToBeUpgraded} of {totalNodes} will be upgraded
</Trans>
<br />
{remainingMessage}
<br />
{errors?.length > 0 && <ParallelErrors errors={errors} />}
</>
</StepState>
Expand Down
20 changes: 3 additions & 17 deletions plugins/lime-plugin-mesh-wide-upgrade/src/hooks/useStepper.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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";
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading