Skip to content

Commit d649a9c

Browse files
authored
Use progress bar for file uploads (#2148)
## Description <img width="3840" height="2160" alt="image" src="https://github.com/user-attachments/assets/c0289923-a6c8-48b9-84c1-ce92c7acbc9d" /> <img width="3840" height="2160" alt="image" src="https://github.com/user-attachments/assets/3b58c7d0-e12e-45d6-b328-c3061949349a" /> 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
1 parent 695742b commit d649a9c

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

photon-client/src/components/app/photon-error-snackbar.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,15 @@ import { useStateStore } from "@/stores/StateStore";
1313
<p style="padding: 0; margin: 0; text-align: center">
1414
{{ useStateStore().snackbarData.message }}
1515
</p>
16+
<v-progress-linear
17+
v-if="useStateStore().snackbarData.progressBar != -1"
18+
v-model="useStateStore().snackbarData.progressBar"
19+
height="15"
20+
:color="useStateStore().snackbarData.progressBarColor"
21+
>
22+
<template #default="{ value }">
23+
<strong> {{ Math.ceil(value) }}% </strong>
24+
</template>
25+
</v-progress-linear>
1626
</v-snackbar>
1727
</template>

photon-client/src/components/settings/DeviceControlCard.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ const handleOfflineUpdate = () => {
4040
const uploadPercentage = (progress || 0) * 100.0;
4141
if (uploadPercentage < 99.5) {
4242
useStateStore().showSnackbarMessage({
43-
message: "New Software Upload in Process, " + uploadPercentage.toFixed(2) + "% complete",
43+
message: "New Software Upload in Progress",
4444
color: "secondary",
45-
timeout: -1
45+
timeout: -1,
46+
progressBar: uploadPercentage,
47+
progressBarColor: "primary"
4648
});
4749
} else {
4850
useStateStore().showSnackbarMessage({

photon-client/src/components/settings/ObjectDetectionCard.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ const handleBulkImport = () => {
144144
const uploadPercentage = (progress || 0) * 100.0;
145145
if (uploadPercentage < 99.5) {
146146
useStateStore().showSnackbarMessage({
147-
message: "Object Detection Models Upload in Process, " + uploadPercentage.toFixed(2) + "% complete",
147+
message: "Object Detection Models Upload in Progress",
148148
color: "secondary",
149-
timeout: -1
149+
timeout: -1,
150+
progressBar: uploadPercentage,
151+
progressBarColor: "primary"
150152
});
151153
} else {
152154
useStateStore().showSnackbarMessage({

photon-client/src/stores/StateStore.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ interface StateStore {
3939

4040
snackbarData: {
4141
show: boolean;
42+
progressBar: number;
43+
progressBarColor: string;
4244
message: string;
4345
color: string;
4446
timeout: number;
@@ -86,6 +88,8 @@ export const useStateStore = defineStore("state", {
8688

8789
snackbarData: {
8890
show: false,
91+
progressBar: -1,
92+
progressBarColor: "info",
8993
message: "No Message",
9094
color: "info",
9195
timeout: 2000
@@ -158,11 +162,19 @@ export const useStateStore = defineStore("state", {
158162
updateDiscoveredCameras(data: VsmState) {
159163
this.vsmState = data;
160164
},
161-
showSnackbarMessage(data: { message: string; color: string; timeout?: number }) {
165+
showSnackbarMessage(data: {
166+
message: string;
167+
color: string;
168+
timeout?: number;
169+
progressBar?: number;
170+
progressBarColor?: string;
171+
}) {
162172
this.snackbarData = {
163173
show: true,
174+
progressBar: data.progressBar || -1,
164175
message: data.message,
165176
color: data.color,
177+
progressBarColor: data.progressBarColor || "",
166178
timeout: data.timeout || 2000
167179
};
168180
}

0 commit comments

Comments
 (0)