Skip to content

Commit b727628

Browse files
committed
feat: show unknown jobs count and disable dragging
Signed-off-by: Pedro Lamas <[email protected]>
1 parent 5d15db3 commit b727628

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

src/components/ui/AppDragIcon.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
<template>
22
<div class="handle-container">
3-
<v-icon>
3+
<v-icon :disabled="disabled">
44
$drag
55
</v-icon>
6-
<div class="handle" />
6+
<div
7+
v-if="!disabled"
8+
class="handle"
9+
/>
710
</div>
811
</template>
912

1013
<script lang="ts">
11-
import { Component, Vue } from 'vue-property-decorator'
14+
import { Component, Prop, Vue } from 'vue-property-decorator'
1215
1316
@Component({})
1417
export default class AppDraggable extends Vue {
18+
@Prop({ type: Boolean })
19+
readonly disabled?: boolean
1520
}
1621
</script>
1722

src/components/widgets/job-queue/JobQueueBrowser.vue

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</template>
4646

4747
<template #[`item.handle`]>
48-
<app-drag-icon />
48+
<app-drag-icon :disabled="jobTotals.withoutFile > 0" />
4949
</template>
5050

5151
<template #[`item.data-table-icons`]>
@@ -93,10 +93,19 @@
9393
<template #footer>
9494
<div class="v-data-footer px-3 py-1">
9595
<v-chip
96+
v-if="jobTotals.withoutFile > 0"
9697
small
9798
class="ma-1"
99+
color="warning"
98100
>
99-
{{ $t('app.job_queue.label.filament') }}: {{ $filters.getReadableLengthString(jobTotals.filament_length) }} / {{ $filters.getReadableWeightString(jobTotals.filament_weight) }}
101+
{{ $t('app.job_queue.label.unknown_jobs') }}: {{ jobTotals.withoutFile }}
102+
</v-chip>
103+
104+
<v-chip
105+
small
106+
class="ma-1"
107+
>
108+
{{ $t('app.job_queue.label.filament') }}: {{ $filters.getReadableLengthString(jobTotals.filamentLength) }} / {{ $filters.getReadableWeightString(jobTotals.filamentWeight) }}
100109
</v-chip>
101110
<v-chip
102111
small
@@ -128,9 +137,10 @@ import FilesMixin from '@/mixins/files'
128137
import getFilePaths from '@/util/get-file-paths'
129138
130139
type JobTotals = {
131-
filament_length: number,
132-
filament_weight: number,
133-
time: number
140+
filamentLength: number,
141+
filamentWeight: number,
142+
time: number,
143+
withoutFile: number
134144
}
135145
136146
type QueueJobWithKey = QueuedJobWithAppFile & {
@@ -180,20 +190,22 @@ export default class JobQueueBrowser extends Mixins(StateMixin, FilesMixin) {
180190
return this.jobs.reduce<JobTotals>((totals, job) => {
181191
if (job.file) {
182192
if ('filament_total' in job.file) {
183-
totals.filament_length += job.file.filament_total ?? 0
193+
totals.filamentLength += job.file.filament_total ?? 0
184194
}
185195
186196
if ('filament_weight_total' in job.file) {
187-
totals.filament_weight += job.file.filament_weight_total ?? 0
197+
totals.filamentWeight += job.file.filament_weight_total ?? 0
188198
}
189199
190200
if ('estimated_time' in job.file) {
191201
totals.time += job.file.estimated_time ?? 0
192202
}
203+
} else {
204+
totals.withoutFile++
193205
}
194206
195207
return totals
196-
}, { filament_length: 0, filament_weight: 0, time: 0 })
208+
}, { filamentLength: 0, filamentWeight: 0, time: 0, withoutFile: 0 })
197209
}
198210
199211
getFilePaths (filename: string) {

src/locales/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ app:
521521
filament: Filament
522522
number_of_copies: Number of copies
523523
print_time: Print time
524+
unknown_jobs: Unknown jobs
524525
title:
525526
multiply_job: Multiply Job | Multiply Jobs
526527
tooltip:

0 commit comments

Comments
 (0)