|
21 | 21 | </span> |
22 | 22 | </template> |
23 | 23 | <span> |
24 | | - #{{ spoolId }} | {{ spoolVendor }} |
| 24 | + <strong>ID #{{ spoolId }}</strong> |
25 | 25 | <br> |
26 | | - {{ spoolFilamentName }} |
| 26 | + <template v-if="spoolFilamentVendor">{{ spoolFilamentVendor }} — </template>{{ spoolFilamentName }} |
| 27 | + <template v-if="spoolMaterial"> |
| 28 | + <br> |
| 29 | + {{ spoolMaterial }} |
| 30 | + <template v-if="spoolExtruderTemp"> |
| 31 | + | {{ spoolExtruderTemp }}°C |
| 32 | + </template> |
| 33 | + <template v-if="spoolBedTemp"> |
| 34 | + | {{ spoolBedTemp }}°C |
| 35 | + </template> |
| 36 | + </template> |
| 37 | + <template v-if="spoolRemainingWeight != null"> |
| 38 | + <br> |
| 39 | + {{ Math.round(spoolRemainingWeight) }} g remaining |
| 40 | + <template v-if="spoolUsedWeight"> |
| 41 | + ({{ Math.round(spoolUsedWeight) }} g used) |
| 42 | + </template> |
| 43 | + </template> |
27 | 44 | </span> |
28 | 45 | </v-tooltip> |
29 | 46 | <afc-unit-lane-filament-dialog |
|
56 | 73 | {{ spoolMaterial }} |
57 | 74 | </span> |
58 | 75 | <span class="text--disabled"> |
59 | | - {{ spoolRemainingWeightOutput }} |
| 76 | + <template v-if="spoolRemainingWeight != null">{{ Math.round(spoolRemainingWeight) }} g</template> |
| 77 | + <template v-else>--</template> |
60 | 78 | </span> |
61 | 79 | <v-tooltip |
62 | 80 | v-if="tdPresent" |
|
84 | 102 | > |
85 | 103 | <v-col class="px-6 pt-1"> |
86 | 104 | <div class="position-relative pb-4"> |
87 | | - <span class="position-absolute text-truncate text-truncate-element text-center"> |
88 | | - {{ spoolFilamentName }} |
89 | | - </span> |
| 105 | + <a |
| 106 | + v-if="spoolUrl" |
| 107 | + :href="spoolUrl" |
| 108 | + target="_blank" |
| 109 | + class="position-absolute text-truncate text-truncate-element text-center text-decoration-none filament-link" |
| 110 | + >{{ spoolFilamentName }}</a> |
| 111 | + <span |
| 112 | + v-else |
| 113 | + class="position-absolute text-truncate text-truncate-element text-center" |
| 114 | + >{{ spoolFilamentName }}</span> |
90 | 115 | </div> |
91 | 116 | </v-col> |
92 | 117 | </v-row> |
@@ -147,39 +172,51 @@ export default class AfcCardUnitLaneBody extends Mixins(StateMixin, AfcMixin) { |
147 | 172 | return this.lane?.color || '#000000' |
148 | 173 | } |
149 | 174 |
|
150 | | - get spoolRemainingWeight (): number { |
151 | | - if (this.afcExistsSpoolman && this.spool?.remaining_weight != null) { |
152 | | - return Math.round(this.spool.remaining_weight) |
153 | | - } |
154 | | - return Math.round(this.lane?.weight ?? 0) |
155 | | - } |
156 | | -
|
157 | | - get spoolRemainingWeightOutput (): string { |
158 | | - return `${this.spoolRemainingWeight} g` |
| 175 | + get spoolRemainingWeight (): number | undefined { |
| 176 | + return this.spool?.remaining_weight ?? this.lane?.weight |
159 | 177 | } |
160 | 178 |
|
161 | | - get spoolFullWeight (): number { |
162 | | - return this.spool?.initial_weight ?? 1000 |
| 179 | + get spoolFullWeight (): number | null { |
| 180 | + return this.spool?.initial_weight ?? this.lane?.initial_weight ?? null |
163 | 181 | } |
164 | 182 |
|
165 | 183 | get spoolPercent (): number { |
| 184 | + if (this.spoolRemainingWeight == null || this.spoolFullWeight == null) return 100 |
166 | 185 | if (this.spoolFullWeight === 0) return 100 |
167 | 186 |
|
168 | 187 | return Math.round((this.spoolRemainingWeight / this.spoolFullWeight) * 100) |
169 | 188 | } |
170 | 189 |
|
171 | 190 | get spoolMaterial (): string { |
172 | | - return this.lane?.material || '--' |
| 191 | + return this.spool?.filament?.material ?? this.lane?.material ?? '' |
| 192 | + } |
| 193 | +
|
| 194 | + get spoolFilamentVendor (): string | undefined { |
| 195 | + return this.spool?.filament?.vendor?.name |
| 196 | + } |
| 197 | +
|
| 198 | + get spoolFilamentName (): string | undefined { |
| 199 | + return this.spool?.filament?.name || |
| 200 | + this.lane?.filament_name || |
| 201 | + undefined |
| 202 | + } |
| 203 | +
|
| 204 | + get spoolUrl (): string | undefined { |
| 205 | + const base: string | undefined = this.$typedGetters['spoolman/getSpoolmanUrl'] |
| 206 | + if (!base || !this.spoolId) return undefined |
| 207 | + return `${base.replace(/\/$/, '')}/spool/show/${this.spoolId}` |
173 | 208 | } |
174 | 209 |
|
175 | | - get spoolVendor (): string { |
176 | | - return this.spool?.filament?.vendor?.name ?? this.$t('app.afc.Unknown').toString() |
| 210 | + get spoolExtruderTemp (): number | undefined { |
| 211 | + return this.spool?.filament?.settings_extruder_temp |
177 | 212 | } |
178 | 213 |
|
179 | | - get spoolFilamentName (): string { |
180 | | - return this.afcExistsSpoolman |
181 | | - ? this.spool?.filament?.name ?? this.$t('app.afc.Unknown').toString() |
182 | | - : '' |
| 214 | + get spoolBedTemp (): number | undefined { |
| 215 | + return this.spool?.filament?.settings_bed_temp |
| 216 | + } |
| 217 | +
|
| 218 | + get spoolUsedWeight (): number | undefined { |
| 219 | + return this.spool?.used_weight |
183 | 220 | } |
184 | 221 |
|
185 | 222 | get tdPresent (): boolean { |
@@ -246,4 +283,8 @@ export default class AfcCardUnitLaneBody extends Mixins(StateMixin, AfcMixin) { |
246 | 283 | .position-relative { |
247 | 284 | position: relative !important; |
248 | 285 | } |
| 286 | +
|
| 287 | +.filament-link { |
| 288 | + color: inherit !important; |
| 289 | +} |
249 | 290 | </style> |
0 commit comments