diff --git a/src/components/widgets/afc/AfcCardUnitLaneBody.vue b/src/components/widgets/afc/AfcCardUnitLaneBody.vue index 80626eabfd..9ae9deb754 100644 --- a/src/components/widgets/afc/AfcCardUnitLaneBody.vue +++ b/src/components/widgets/afc/AfcCardUnitLaneBody.vue @@ -21,9 +21,26 @@ - #{{ spoolId }} | {{ spoolVendor }} + ID #{{ spoolId }}
- {{ spoolFilamentName }} + {{ spoolFilamentName }} + +
- {{ spoolMaterial }} + {{ spoolMaterial || '--' }} - {{ spoolRemainingWeightOutput }} + +
- - {{ spoolFilamentName }} - + {{ spoolFilamentName }} + {{ spoolFilamentName }}
@@ -147,39 +173,51 @@ export default class AfcCardUnitLaneBody extends Mixins(StateMixin, AfcMixin) { return this.lane?.color || '#000000' } - get spoolRemainingWeight (): number { - if (this.afcExistsSpoolman && this.spool?.remaining_weight != null) { - return Math.round(this.spool.remaining_weight) - } - return Math.round(this.lane?.weight ?? 0) + get spoolRemainingWeight (): number | undefined { + return this.spool?.remaining_weight ?? this.lane?.weight } - get spoolRemainingWeightOutput (): string { - return `${this.spoolRemainingWeight} g` - } - - get spoolFullWeight (): number { - return this.spool?.initial_weight ?? 1000 + get spoolFullWeight (): number | undefined { + return this.spool?.initial_weight ?? this.lane?.initial_weight } get spoolPercent (): number { + if (this.spoolRemainingWeight == null || this.spoolFullWeight == null) return 100 if (this.spoolFullWeight === 0) return 100 return Math.round((this.spoolRemainingWeight / this.spoolFullWeight) * 100) } get spoolMaterial (): string { - return this.lane?.material || '--' + return this.spool?.filament?.material ?? this.lane?.material ?? '' } - get spoolVendor (): string { - return this.spool?.filament?.vendor?.name ?? this.$t('app.afc.Unknown').toString() + get spoolFilamentVendor (): string | undefined { + return this.spool?.filament?.vendor?.name } - get spoolFilamentName (): string { - return this.afcExistsSpoolman - ? this.spool?.filament?.name ?? this.$t('app.afc.Unknown').toString() - : '' + get spoolFilamentName (): string | undefined { + return this.spool?.filament?.name || + this.lane?.filament_name || + undefined + } + + get spoolUrl (): string | undefined { + const base: string | undefined = this.$typedGetters['spoolman/getSpoolmanUrl'] + if (!base || !this.spoolId) return undefined + return `${base.replace(/\/$/, '')}/spool/show/${this.spoolId}` + } + + get spoolExtruderTemp (): number | undefined { + return this.spool?.filament?.settings_extruder_temp + } + + get spoolBedTemp (): number | undefined { + return this.spool?.filament?.settings_bed_temp + } + + get spoolUsedWeight (): number | undefined { + return this.spool?.used_weight } get tdPresent (): boolean { @@ -246,4 +284,14 @@ export default class AfcCardUnitLaneBody extends Mixins(StateMixin, AfcMixin) { .position-relative { position: relative !important; } + +.filament-link { + color: inherit !important; + cursor: pointer; +} + +.filament-link:hover, +.filament-link:focus { + text-decoration: underline !important; +} diff --git a/src/locales/en.yaml b/src/locales/en.yaml index a11cdd2c06..3cdbc14bc8 100644 --- a/src/locales/en.yaml +++ b/src/locales/en.yaml @@ -86,9 +86,10 @@ app: ShowTd1Color: "Show TD-1 Color" Unloading: "Unloading" UnloadLane: "Unload Lane" - Unknown: "Unknown" Weight: "Weight" + WeightRemaining: "{weight} g remaining" WeightSubtitle: "The weight of the filament in grams (without spool)." + WeightUsed: "{weight} g used" bedmesh: label: active: active diff --git a/src/typings/klipper.d.ts b/src/typings/klipper.d.ts index 0a22a085eb..872279e69c 100644 --- a/src/typings/klipper.d.ts +++ b/src/typings/klipper.d.ts @@ -815,9 +815,11 @@ declare namespace Klipper { density?: number; diameter?: number; empty_spool_weight?: number; + initial_weight?: number; spool_id: number | null; color: string | null; weight: number; + filament_name?: string; extruder_temp: number | null; runout_lane: string | null; filament_status: 'In Tool' | 'Ready' | 'Prep' | 'Not Ready';