From d649a9cb9ee5272be9ba929ec8188502f1a29893 Mon Sep 17 00:00:00 2001 From: Sam Freund Date: Sat, 1 Nov 2025 20:56:12 -0500 Subject: [PATCH] Use progress bar for file uploads (#2148) ## Description image image closes #871 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [ ] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --- .../src/components/app/photon-error-snackbar.vue | 10 ++++++++++ .../src/components/settings/DeviceControlCard.vue | 6 ++++-- .../components/settings/ObjectDetectionCard.vue | 6 ++++-- photon-client/src/stores/StateStore.ts | 14 +++++++++++++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/photon-client/src/components/app/photon-error-snackbar.vue b/photon-client/src/components/app/photon-error-snackbar.vue index d654d5343..19f2d064a 100644 --- a/photon-client/src/components/app/photon-error-snackbar.vue +++ b/photon-client/src/components/app/photon-error-snackbar.vue @@ -13,5 +13,15 @@ import { useStateStore } from "@/stores/StateStore";

{{ useStateStore().snackbarData.message }}

+ + + diff --git a/photon-client/src/components/settings/DeviceControlCard.vue b/photon-client/src/components/settings/DeviceControlCard.vue index 7df24b3b3..1bf56b364 100644 --- a/photon-client/src/components/settings/DeviceControlCard.vue +++ b/photon-client/src/components/settings/DeviceControlCard.vue @@ -40,9 +40,11 @@ const handleOfflineUpdate = () => { const uploadPercentage = (progress || 0) * 100.0; if (uploadPercentage < 99.5) { useStateStore().showSnackbarMessage({ - message: "New Software Upload in Process, " + uploadPercentage.toFixed(2) + "% complete", + message: "New Software Upload in Progress", color: "secondary", - timeout: -1 + timeout: -1, + progressBar: uploadPercentage, + progressBarColor: "primary" }); } else { useStateStore().showSnackbarMessage({ diff --git a/photon-client/src/components/settings/ObjectDetectionCard.vue b/photon-client/src/components/settings/ObjectDetectionCard.vue index fd7a3de26..acbade2b3 100644 --- a/photon-client/src/components/settings/ObjectDetectionCard.vue +++ b/photon-client/src/components/settings/ObjectDetectionCard.vue @@ -144,9 +144,11 @@ const handleBulkImport = () => { const uploadPercentage = (progress || 0) * 100.0; if (uploadPercentage < 99.5) { useStateStore().showSnackbarMessage({ - message: "Object Detection Models Upload in Process, " + uploadPercentage.toFixed(2) + "% complete", + message: "Object Detection Models Upload in Progress", color: "secondary", - timeout: -1 + timeout: -1, + progressBar: uploadPercentage, + progressBarColor: "primary" }); } else { useStateStore().showSnackbarMessage({ diff --git a/photon-client/src/stores/StateStore.ts b/photon-client/src/stores/StateStore.ts index 2c4e7edab..52bbc37a0 100644 --- a/photon-client/src/stores/StateStore.ts +++ b/photon-client/src/stores/StateStore.ts @@ -39,6 +39,8 @@ interface StateStore { snackbarData: { show: boolean; + progressBar: number; + progressBarColor: string; message: string; color: string; timeout: number; @@ -86,6 +88,8 @@ export const useStateStore = defineStore("state", { snackbarData: { show: false, + progressBar: -1, + progressBarColor: "info", message: "No Message", color: "info", timeout: 2000 @@ -158,11 +162,19 @@ export const useStateStore = defineStore("state", { updateDiscoveredCameras(data: VsmState) { this.vsmState = data; }, - showSnackbarMessage(data: { message: string; color: string; timeout?: number }) { + showSnackbarMessage(data: { + message: string; + color: string; + timeout?: number; + progressBar?: number; + progressBarColor?: string; + }) { this.snackbarData = { show: true, + progressBar: data.progressBar || -1, message: data.message, color: data.color, + progressBarColor: data.progressBarColor || "", timeout: data.timeout || 2000 }; }