|
1 | | -<script lang="ts"> |
2 | | - import { AlertTriangle, CheckCircle2, CircleX, DownloadCloud, RotateCcw } from '@lucide/svelte'; |
3 | | - import { page } from '$app/state'; |
4 | | - import { hubManagementV1Api } from '$lib/api'; |
5 | | - import { type OtaItem, OtaUpdateStatus } from '$lib/api/internal/v1'; |
6 | | - import Container from '$lib/components/Container.svelte'; |
7 | | - import FirmwareChannelSelector from '$lib/components/FirmwareChannelSelector.svelte'; |
8 | | - import { Badge } from '$lib/components/ui/badge'; |
9 | | - import Button from '$lib/components/ui/button/button.svelte'; |
10 | | - import * as Card from '$lib/components/ui/card'; |
11 | | - import * as Dialog from '$lib/components/ui/dialog'; |
12 | | - import { Progress } from '$lib/components/ui/progress'; |
13 | | - import * as Table from '$lib/components/ui/table'; |
14 | | - import { handleApiError } from '$lib/errorhandling/apiErrorHandling'; |
15 | | - import { getConnection } from '$lib/signalr/user.svelte'; |
| 1 | +<script lang="ts" module> |
| 2 | + import { OtaUpdateStatus } from '$lib/api/internal/v1'; |
16 | 3 | import { OtaUpdateProgressTask } from '$lib/signalr/models/OtaUpdateProgressTask'; |
17 | | - import { serializeOtaInstallMessage } from '$lib/signalr/serializers/OtaInstall'; |
18 | | - import { breadcrumbs } from '$lib/state/breadcrumbs-state.svelte'; |
19 | | - import { |
20 | | - HubOnlineState, |
21 | | - onlineHubs, |
22 | | - ownHubs, |
23 | | - refreshOwnHubs, |
24 | | - } from '$lib/state/hubs-state.svelte'; |
25 | | - import { cn } from '$lib/utils'; |
26 | | - import { NumberToHexPadded } from '$lib/utils/convert'; |
27 | | - import { onMount } from 'svelte'; |
28 | | - import type { FirmwareChannel } from '$lib/api/firmwareCDN'; |
29 | 4 |
|
30 | 5 | // Task weights for weighted total progress (7 tasks, sums to 100) |
31 | 6 | const TASK_WEIGHTS = [4, 2, 22, 2, 49, 1, 20]; |
|
76 | 51 | return 'just now'; |
77 | 52 | } |
78 | 53 |
|
| 54 | + // Simulated reboot progress (last 20%) — hub goes offline so no more events |
| 55 | + const REBOOT_DURATION_MS = 10_000; |
| 56 | + const REBOOT_INTERVAL_MS = 100; |
| 57 | +</script> |
| 58 | + |
| 59 | +<script lang="ts"> |
| 60 | + import { AlertTriangle, CheckCircle2, CircleX, DownloadCloud, RotateCcw } from '@lucide/svelte'; |
| 61 | + import { page } from '$app/state'; |
| 62 | + import { hubManagementV1Api } from '$lib/api'; |
| 63 | + import type { OtaItem } from '$lib/api/internal/v1'; |
| 64 | + import Container from '$lib/components/Container.svelte'; |
| 65 | + import FirmwareChannelSelector from '$lib/components/FirmwareChannelSelector.svelte'; |
| 66 | + import { Badge } from '$lib/components/ui/badge'; |
| 67 | + import Button from '$lib/components/ui/button/button.svelte'; |
| 68 | + import * as Card from '$lib/components/ui/card'; |
| 69 | + import * as Dialog from '$lib/components/ui/dialog'; |
| 70 | + import { Progress } from '$lib/components/ui/progress'; |
| 71 | + import * as Table from '$lib/components/ui/table'; |
| 72 | + import { handleApiError } from '$lib/errorhandling/apiErrorHandling'; |
| 73 | + import { getConnection } from '$lib/signalr/user.svelte'; |
| 74 | + import { serializeOtaInstallMessage } from '$lib/signalr/serializers/OtaInstall'; |
| 75 | + import { breadcrumbs } from '$lib/state/breadcrumbs-state.svelte'; |
| 76 | + import { |
| 77 | + HubOnlineState, |
| 78 | + onlineHubs, |
| 79 | + ownHubs, |
| 80 | + refreshOwnHubs, |
| 81 | + } from '$lib/state/hubs-state.svelte'; |
| 82 | + import { cn } from '$lib/utils'; |
| 83 | + import { NumberToHexPadded } from '$lib/utils/convert'; |
| 84 | + import { onMount } from 'svelte'; |
| 85 | + import type { FirmwareChannel } from '$lib/api/firmwareCDN'; |
| 86 | +
|
79 | 87 | let hubLoaded = $state(false); |
80 | 88 | let otaLogs = $state<OtaItem[]>([]); |
81 | 89 | let version = $state<string | null>(null); |
|
92 | 100 |
|
93 | 101 | let isUpdating = $derived(hub?.otaInstall !== null && hub?.otaInstall !== undefined); |
94 | 102 |
|
95 | | - // Simulated reboot progress (last 20%) — hub goes offline so no more events |
96 | | - const REBOOT_DURATION_MS = 10_000; |
97 | | - const REBOOT_INTERVAL_MS = 100; |
98 | 103 | let rebootProgress = $state(0); |
99 | 104 | let rebootInterval: ReturnType<typeof setInterval> | null = null; |
100 | 105 |
|
|
0 commit comments