Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/lib/signalr/handlers/DeviceStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export function handleSignalrDeviceStatus(array: unknown) {

OnlineHubsStore.update((state) => {
array.forEach((entry) => {
const existing = state.get(entry.device);
state.set(entry.device, {
hubId: entry.device,
isOnline: entry.online,
firmwareVersion: entry.firmwareVersion,
otaInstall: null,
otaInstall: existing?.otaInstall ?? null,
otaResult: existing?.otaResult ?? null,
});
});

Expand Down
4 changes: 3 additions & 1 deletion src/lib/signalr/handlers/OtaInstallFailed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export function handleSignalrOtaInstallFailed(
const hub = hubs.get(hubId);
if (hub && hub.otaInstall?.id === updateId) {
hub.otaInstall = null;
//hub.otaError = { fatal, message };
hub.otaResult = { success: false, message };
}
return hubs;
});

toast.error(`Hub firmware update failed: ${message}`);
}
3 changes: 3 additions & 0 deletions src/lib/signalr/handlers/OtaInstallSucceeded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export function handleSignalrOtaInstallSucceeded(hubId: unknown, updateId: unkno
const hub = hubs.get(hubId);
if (hub && hub.otaInstall?.id === updateId) {
hub.otaInstall = null;
hub.otaResult = { success: true, message: 'Update completed successfully' };
}
return hubs;
});

toast.success('Hub firmware update completed successfully!');
}
4 changes: 3 additions & 1 deletion src/lib/signalr/handlers/OtaRollback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export function handleSignalrOtaRollback(hubId: unknown, updateId: unknown): voi
const hub = hubs.get(hubId);
if (hub && hub.otaInstall?.id === updateId) {
hub.otaInstall = null;
//hub.otaError = { fatal: false, message: 'Rollback performed' };
hub.otaResult = { success: false, message: 'Device rolled back to previous version' };
}
return hubs;
});

toast.warning('Hub firmware rolled back to previous version');
}
1 change: 1 addition & 0 deletions src/lib/stores/HubsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type HubOnlineState = {
task: OtaUpdateProgressTask;
progress: number;
} | null;
otaResult: { success: boolean; message: string } | null;
};

export const OwnHubsStore = writable<Map<string, OwnHub>>(new Map());
Expand Down
Loading
Loading