Skip to content

Commit e4f6c10

Browse files
authored
feat(Spoolman): spool progress indicator in card (#1661)
Signed-off-by: Pedro Lamas <[email protected]>
1 parent eaae3c0 commit e4f6c10

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

src/components/widgets/spoolman/SpoolmanCard.vue

+25-7
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
<v-progress-linear
9595
v-if="activeSpool && $vuetify.breakpoint.lgAndDown"
96-
value="100"
96+
:value="activeSpool.progress"
9797
:height="6"
9898
:color="getSpoolColor(activeSpool)"
9999
/>
@@ -160,14 +160,23 @@
160160
align-self="center"
161161
class="pa-0"
162162
>
163-
<v-icon
163+
<v-progress-circular
164164
v-if="activeSpool"
165-
:color="getSpoolColor(activeSpool)"
166-
size="110"
167-
class="spool-icon"
165+
:rotate="-90"
166+
:size="102"
167+
:width="7"
168+
:value="activeSpool.progress"
169+
color="primary"
170+
class="mr-4 flex-column"
168171
>
169-
$filament
170-
</v-icon>
172+
<v-icon
173+
:color="getSpoolColor(activeSpool)"
174+
size="100"
175+
class="spool-icon"
176+
>
177+
$filament
178+
</v-icon>
179+
</v-progress-circular>
171180
<v-icon
172181
v-else-if="isConnected"
173182
size="55"
@@ -184,6 +193,15 @@
184193
</v-col>
185194
</v-row>
186195
</v-card-text>
196+
197+
<template #collapsed-content>
198+
<v-progress-linear
199+
v-if="activeSpool"
200+
:value="activeSpool.progress"
201+
:height="6"
202+
:color="getSpoolColor(activeSpool)"
203+
/>
204+
</template>
187205
</collapsable-card>
188206
</template>
189207

src/store/spoolman/getters.ts

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ const spoolmanSpoolAsSpool = (spool: SpoolmanSpool): Spool => {
4343
initial_length: initial_weight != null
4444
? filamentWeightToLength(initial_weight, filament)
4545
: undefined,
46+
progress: !!initial_weight && spool.used_weight != null
47+
? (initial_weight - spool.used_weight) / initial_weight * 100
48+
: undefined,
4649
filament,
4750
})
4851
}

src/store/spoolman/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export interface Spool extends Omit<SpoolmanSpool, 'registered' | 'filament' | '
8383
first_used?: Date;
8484
last_used?: Date;
8585
initial_length?: number;
86+
progress?: number;
8687
}
8788

8889
export interface Filament extends Omit<SpoolmanFilament, 'registered' | 'vendor' | 'multi_color_hexes'> {

0 commit comments

Comments
 (0)