Skip to content

Feature/ota page#161

Open
LucHeart wants to merge 3 commits intodevelopfrom
feature/ota-page
Open

Feature/ota page#161
LucHeart wants to merge 3 commits intodevelopfrom
feature/ota-page

Conversation

@LucHeart
Copy link
Member

@LucHeart LucHeart commented Mar 4, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 4, 2026 20:02
@changeset-bot
Copy link

changeset-bot bot commented Mar 4, 2026

⚠️ No Changeset found

Latest commit: 7985aba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the authenticated Hub OTA update experience by adding richer UI/state for firmware updates, progress tracking, and surfaced results coming back from SignalR.

Changes:

  • Revamps the hub update page UI with confirmation dialog, weighted overall progress + task progress, and an OTA update history table.
  • Introduces otaResult into HubOnlineState and updates SignalR handlers to populate it on success/failure/rollback (plus toast notifications).
  • Adjusts device status SignalR handling to preserve ongoing OTA install state/result across status updates.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/routes/(authenticated)/hubs/[hubId=guid]/update/+page.svelte New OTA update UX: confirm dialog, progress model, status/result rendering, update history table.
src/lib/stores/HubsStore.ts Adds otaResult to the online hub state type.
src/lib/signalr/handlers/OtaRollback.ts Sets otaResult for rollback and emits warning toast.
src/lib/signalr/handlers/OtaInstallSucceeded.ts Sets otaResult for success and emits success toast.
src/lib/signalr/handlers/OtaInstallFailed.ts Sets otaResult for failure and emits error toast.
src/lib/signalr/handlers/DeviceStatus.ts Preserves existing otaInstall/otaResult when processing device status updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 185 to 205
@@ -37,100 +193,209 @@
.devicesOtaGetOtaUpdateHistory(hubId)
.then((resp) => {
if (resp.data === null) {
hub = null;
hubLoaded = false;
return;
}

hub = $OnlineHubsStore.get(hubId) ?? {
hubId,
isOnline: false,
firmwareVersion: null,
otaInstall: null,
};
hubLoaded = true;
otaLogs = resp.data;
})
.catch(handleApiError)
.finally(() => (isLoading = false));
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hubLoaded is used as a gate for rendering hub details, but it’s only set to true when the OTA history request succeeds (resp.data !== null). If the request fails (network/API error), hubLoaded stays false, which causes the UI to fall through to the "Hub not found" state even though the hub may exist (and the error was already handled via handleApiError). Consider separating "hub exists" from "history loaded" (e.g., keep rendering hub info from OnlineHubsStore and add a dedicated historyLoadError/historyLoaded state for the table).

Copilot uses AI. Check for mistakes.
function fetchOtaLogs(hubId: string | undefined) {
if (hubId === undefined) {
hub = null;
hubLoaded = false;
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When fetchOtaLogs is called with hubId === undefined, it returns early without resetting isLoading. If a navigation/param change happens mid-request, this can leave the page stuck in a loading-disabled state (spinner / disabled refresh). Set isLoading = false (and likely clear otaLogs) in the early-return path as well.

Suggested change
hubLoaded = false;
hubLoaded = false;
isLoading = false;
otaLogs = [];

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7985abaf75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

stopRebootTimer();
}

return stopRebootTimer;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve reboot timer across effect re-runs

Returning stopRebootTimer as the effect cleanup causes the reboot simulation to reset on every reactive re-run, not just on unmount. Because hub is rebuilt from store updates, any OnlineHubsStore change during the reboot phase (for example DeviceStatus online/offline transitions) will clear the interval and set rebootProgress back to 0, so the displayed reboot progress can jump backward or appear stuck until another terminal OTA event arrives.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants