From a353fb29970582e8d998085e9a7f06077eb459ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 16 Dec 2023 18:17:28 +0100 Subject: [PATCH 01/19] feat: Add job queue entry position change feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/store/server/jobQueue/actions.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/store/server/jobQueue/actions.ts b/src/store/server/jobQueue/actions.ts index 705eb09c8..2c2009662 100644 --- a/src/store/server/jobQueue/actions.ts +++ b/src/store/server/jobQueue/actions.ts @@ -53,6 +53,34 @@ export const actions: ActionTree = { }) }, + changePosition({ getters }, payload: { job_id: string; positionIndex: number }) { + const filenames: string[] = [] + const jobs = getters['getJobs'] as ServerJobQueueStateJob[]; + + const jobToMoveIndex = jobs.findIndex((job: ServerJobQueueStateJob) => job.job_id === payload.job_id) + + if (jobToMoveIndex === -1) { + return + } + + const jobToMove = jobs[jobToMoveIndex] + + jobs.splice(jobToMoveIndex, 1) + jobs.splice(payload.positionIndex, 0, jobToMove) + + jobs.forEach((job: ServerJobQueueStateJob) => { + const count = (job.combinedIds?.length ?? 0) + 1 + for (let i = 0; i < count; i++) { + filenames.push(job.filename) + } + }) + + Vue.$socket.emit('server.job_queue.post_job', { + filenames, + reset: true, + }) + }, + deleteFromQueue(_, job_ids: string[]) { Vue.$socket.emit('server.job_queue.delete_job', { job_ids }) }, From 5c9e2f3b152f323c4de3df47e6f6564ce70c6e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 16 Dec 2023 18:20:04 +0100 Subject: [PATCH 02/19] feat: Add ability to move queue item to the queue top MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/components/panels/Status/JobqueueEntry.vue | 14 +++++++++++++- src/locales/en.json | 1 + src/locales/pl.json | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/panels/Status/JobqueueEntry.vue b/src/components/panels/Status/JobqueueEntry.vue index 6a1a6ea72..d347677e8 100644 --- a/src/components/panels/Status/JobqueueEntry.vue +++ b/src/components/panels/Status/JobqueueEntry.vue @@ -57,6 +57,10 @@ {{ mdiCounter }} {{ $t('JobQueue.ChangeCount') }} + + {{ mdiFormatVerticalAlignTop }} + {{ $t('JobQueue.MoveToJobQueueTop') }} + {{ mdiPlaylistRemove }} {{ $t('JobQueue.RemoveFromQueue') }} @@ -118,7 +122,7 @@ import Component from 'vue-class-component' import { Mixins, Prop } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types' -import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove } from '@mdi/js' +import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove, mdiFormatVerticalAlignTop } from '@mdi/js' import NumberInput from '@/components/inputs/NumberInput.vue' import { defaultBigThumbnailBackground } from '@/store/variables' @Component({ @@ -132,6 +136,7 @@ export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) { mdiFile = mdiFile mdiPlay = mdiPlay mdiPlaylistRemove = mdiPlaylistRemove + mdiFormatVerticalAlignTop = mdiFormatVerticalAlignTop @Prop({ type: Object, required: true }) declare item: ServerJobQueueStateJob @Prop({ type: Number, required: true }) declare contentTdWidth: number @@ -259,6 +264,13 @@ export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) { this.$store.dispatch('server/jobQueue/deleteFromQueue', ids) } + moveToJobQueueTop(item: ServerJobQueueStateJob) { + this.$store.dispatch('server/jobQueue/changePosition', { + job_id: item.job_id, + positionIndex: 0, + }) + } + openChangeCountDialog(item: ServerJobQueueStateJob) { this.dialogChangeCount.show = true this.dialogChangeCount.count = (item.combinedIds?.length ?? 0) + 1 diff --git a/src/locales/en.json b/src/locales/en.json index 643ccf94a..b3fd6eca1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -392,6 +392,7 @@ "JobQueue": { "AllJobs": "All Jobs", "Cancel": "Cancel", + "MoveToJobQueueTop": "Move to Queue's top", "ChangeCount": "Change count", "Count": "Count", "Empty": "Empty", diff --git a/src/locales/pl.json b/src/locales/pl.json index da91fd503..0a2f46d6a 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -390,6 +390,7 @@ "JobQueue": { "AllJobs": "Wszystkie wydruki", "Cancel": "Anuluj", + "MoveToJobQueueTop": "Przenieś na początek kolejki", "ChangeCount": "Zmień ilość", "Count": "Ilość", "Empty": "Puste", From 041946c49650b0b28f45da2e53589d309818e156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 16 Dec 2023 18:35:26 +0100 Subject: [PATCH 03/19] feat: Allow to move queue item up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/components/panels/JobqueuePanel.vue | 4 ++-- src/components/panels/Status/Jobqueue.vue | 1 + .../panels/Status/JobqueueEntry.vue | 23 +++++++++++++------ src/locales/en.json | 1 + src/locales/pl.json | 1 + 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/panels/JobqueuePanel.vue b/src/components/panels/JobqueuePanel.vue index b7391e121..8e33b7447 100644 --- a/src/components/panels/JobqueuePanel.vue +++ b/src/components/panels/JobqueuePanel.vue @@ -51,8 +51,8 @@
{{ $t('JobQueue.Empty') }}
- diff --git a/src/components/panels/Status/JobqueueEntry.vue b/src/components/panels/Status/JobqueueEntry.vue index d347677e8..39faaa625 100644 --- a/src/components/panels/Status/JobqueueEntry.vue +++ b/src/components/panels/Status/JobqueueEntry.vue @@ -1,8 +1,8 @@ - diff --git a/src/components/panels/Status/JobqueueEntry.vue b/src/components/panels/Status/JobqueueEntry.vue index cdeef656a..d1fe55099 100644 --- a/src/components/panels/Status/JobqueueEntry.vue +++ b/src/components/panels/Status/JobqueueEntry.vue @@ -65,6 +65,10 @@ {{ mdiArrowUpThin }} {{ $t('JobQueue.MoveQueueItemUp') }}
+ + {{ mdiArrowDownThin }} + {{ $t('JobQueue.MoveQueueItemDown') }} + {{ mdiPlaylistRemove }} {{ $t('JobQueue.RemoveFromQueue') }} @@ -126,7 +130,7 @@ import Component from 'vue-class-component' import { Mixins, Prop } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types' -import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove, mdiFormatVerticalAlignTop, mdiArrowUpThin } from '@mdi/js' +import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove, mdiFormatVerticalAlignTop, mdiArrowUpThin, mdiArrowDownThin } from '@mdi/js' import NumberInput from '@/components/inputs/NumberInput.vue' import { defaultBigThumbnailBackground } from '@/store/variables' @Component({ @@ -142,11 +146,13 @@ export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) { mdiPlaylistRemove = mdiPlaylistRemove mdiFormatVerticalAlignTop = mdiFormatVerticalAlignTop mdiArrowUpThin = mdiArrowUpThin + mdiArrowDownThin = mdiArrowDownThin @Prop({ type: Object, required: true }) declare item: ServerJobQueueStateJob @Prop({ type: Number, required: true }) declare itemQueueIndex: number @Prop({ type: Number, required: true }) declare contentTdWidth: number @Prop({ type: Boolean, default: false }) declare isFirst: boolean + @Prop({ type: Boolean, default: false }) declare isLast: boolean @Prop({ type: Boolean, default: false }) declare showPrintButtonForFirst: boolean private contextMenu: { shown: boolean diff --git a/src/locales/en.json b/src/locales/en.json index b1be9e95b..fe0de0047 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -394,6 +394,7 @@ "Cancel": "Cancel", "MoveToJobQueueTop": "Move to Queue's top", "MoveQueueItemUp" :"Move up", + "MoveQueueItemDown" :"Move down", "ChangeCount": "Change count", "Count": "Count", "Empty": "Empty", diff --git a/src/locales/pl.json b/src/locales/pl.json index ab6c7fafa..3f91a0cfb 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -392,6 +392,7 @@ "Cancel": "Anuluj", "MoveToJobQueueTop": "Przenieś na początek kolejki", "MoveQueueItemUp": "Przenieś wyżej", + "MoveQueueItemDown": "Przenieś niżej", "ChangeCount": "Zmień ilość", "Count": "Ilość", "Empty": "Puste", From 9f15847e4ee20a49ffa57909d5e87b9bb1313bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 16 Dec 2023 18:58:04 +0100 Subject: [PATCH 06/19] feat: Add ability to move queue item to the queue bottom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/components/panels/Status/JobqueueEntry.vue | 7 ++++++- src/locales/en.json | 1 + src/locales/pl.json | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/panels/Status/JobqueueEntry.vue b/src/components/panels/Status/JobqueueEntry.vue index d1fe55099..5f9dcfe18 100644 --- a/src/components/panels/Status/JobqueueEntry.vue +++ b/src/components/panels/Status/JobqueueEntry.vue @@ -69,6 +69,10 @@ {{ mdiArrowDownThin }} {{ $t('JobQueue.MoveQueueItemDown') }} + + {{ mdiFormatVerticalAlignBottom }} + {{ $t('JobQueue.MoveToJobQueueBottom') }} + {{ mdiPlaylistRemove }} {{ $t('JobQueue.RemoveFromQueue') }} @@ -130,7 +134,7 @@ import Component from 'vue-class-component' import { Mixins, Prop } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types' -import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove, mdiFormatVerticalAlignTop, mdiArrowUpThin, mdiArrowDownThin } from '@mdi/js' +import { mdiChevronDown, mdiChevronUp, mdiCloseThick, mdiCounter, mdiFile, mdiPlay, mdiPlaylistRemove, mdiFormatVerticalAlignTop, mdiFormatVerticalAlignBottom, mdiArrowUpThin, mdiArrowDownThin } from '@mdi/js' import NumberInput from '@/components/inputs/NumberInput.vue' import { defaultBigThumbnailBackground } from '@/store/variables' @Component({ @@ -145,6 +149,7 @@ export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) { mdiPlay = mdiPlay mdiPlaylistRemove = mdiPlaylistRemove mdiFormatVerticalAlignTop = mdiFormatVerticalAlignTop + mdiFormatVerticalAlignBottom = mdiFormatVerticalAlignBottom mdiArrowUpThin = mdiArrowUpThin mdiArrowDownThin = mdiArrowDownThin diff --git a/src/locales/en.json b/src/locales/en.json index fe0de0047..7f821eddb 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -393,6 +393,7 @@ "AllJobs": "All Jobs", "Cancel": "Cancel", "MoveToJobQueueTop": "Move to Queue's top", + "MoveToJobQueueBottom": "Move to Queue's bottom", "MoveQueueItemUp" :"Move up", "MoveQueueItemDown" :"Move down", "ChangeCount": "Change count", diff --git a/src/locales/pl.json b/src/locales/pl.json index 3f91a0cfb..5feb5732c 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -391,6 +391,7 @@ "AllJobs": "Wszystkie wydruki", "Cancel": "Anuluj", "MoveToJobQueueTop": "Przenieś na początek kolejki", + "MoveToJobQueueBottom": "Przenieś na koniec kolejki", "MoveQueueItemUp": "Przenieś wyżej", "MoveQueueItemDown": "Przenieś niżej", "ChangeCount": "Zmień ilość", From 3ba546cbacc213eb99c148344d41d1058119700d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 16 Dec 2023 19:00:23 +0100 Subject: [PATCH 07/19] feat: Change the nomenclature of queue's start & end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/components/panels/Status/JobqueueEntry.vue | 4 ++-- src/locales/en.json | 4 ++-- src/locales/pl.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/panels/Status/JobqueueEntry.vue b/src/components/panels/Status/JobqueueEntry.vue index 5f9dcfe18..68705b31b 100644 --- a/src/components/panels/Status/JobqueueEntry.vue +++ b/src/components/panels/Status/JobqueueEntry.vue @@ -59,7 +59,7 @@ {{ mdiFormatVerticalAlignTop }} - {{ $t('JobQueue.MoveToJobQueueTop') }} + {{ $t('JobQueue.MoveToJobQueueStart') }} {{ mdiArrowUpThin }} @@ -71,7 +71,7 @@ {{ mdiFormatVerticalAlignBottom }} - {{ $t('JobQueue.MoveToJobQueueBottom') }} + {{ $t('JobQueue.MoveToJobQueueEnd') }} {{ mdiPlaylistRemove }} diff --git a/src/locales/en.json b/src/locales/en.json index 7f821eddb..eaedde55e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -392,8 +392,8 @@ "JobQueue": { "AllJobs": "All Jobs", "Cancel": "Cancel", - "MoveToJobQueueTop": "Move to Queue's top", - "MoveToJobQueueBottom": "Move to Queue's bottom", + "MoveToJobQueueStart": "Move to Queue's start", + "MoveToJobQueueEnd": "Move to Queue's end", "MoveQueueItemUp" :"Move up", "MoveQueueItemDown" :"Move down", "ChangeCount": "Change count", diff --git a/src/locales/pl.json b/src/locales/pl.json index 5feb5732c..99e90fb43 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -390,8 +390,8 @@ "JobQueue": { "AllJobs": "Wszystkie wydruki", "Cancel": "Anuluj", - "MoveToJobQueueTop": "Przenieś na początek kolejki", - "MoveToJobQueueBottom": "Przenieś na koniec kolejki", + "MoveToJobQueueStart": "Przenieś na początek kolejki", + "MoveToJobQueueEnd": "Przenieś na koniec kolejki", "MoveQueueItemUp": "Przenieś wyżej", "MoveQueueItemDown": "Przenieś niżej", "ChangeCount": "Zmień ilość", From 4ace2342196506fb979c429eb18b3bcd4ad30d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 16 Dec 2023 19:20:16 +0100 Subject: [PATCH 08/19] feat: Do not display duplicated re-arrangement features (second & next to last items) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/components/panels/JobqueuePanel.vue | 2 +- src/components/panels/Status/Jobqueue.vue | 3 +- .../panels/Status/JobqueueEntry.vue | 29 ++++++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/components/panels/JobqueuePanel.vue b/src/components/panels/JobqueuePanel.vue index 23f16ae79..546cbad18 100644 --- a/src/components/panels/JobqueuePanel.vue +++ b/src/components/panels/JobqueuePanel.vue @@ -52,7 +52,7 @@ diff --git a/src/components/panels/Status/Jobqueue.vue b/src/components/panels/Status/Jobqueue.vue index a5ba83067..c6ebe7612 100644 --- a/src/components/panels/Status/Jobqueue.vue +++ b/src/components/panels/Status/Jobqueue.vue @@ -15,8 +15,7 @@ :key="item.job_id" :item="item" :item-queue-index="index" - :is-first="index === 0" - :is-last="index === (jobsTable.length + jobsRest.length) - 1" + :queue-length="jobsTable.length + jobsRest.length" :show-print-button-for-first="true" :content-td-width="contentTdWidth" /> diff --git a/src/components/panels/Status/JobqueueEntry.vue b/src/components/panels/Status/JobqueueEntry.vue index 68705b31b..695ba5339 100644 --- a/src/components/panels/Status/JobqueueEntry.vue +++ b/src/components/panels/Status/JobqueueEntry.vue @@ -40,7 +40,7 @@ -