From 7ebcdfba716e848902bb4a1c05373b3a5e649df3 Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Sat, 7 Dec 2024 16:23:55 +0100 Subject: [PATCH] Already show a disabled delete button if nothing is selected --- .../src/components/Sections/ModelsSection.vue | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/panel/src/components/Sections/ModelsSection.vue b/panel/src/components/Sections/ModelsSection.vue index bb9cdce137..11bb72fcd4 100644 --- a/panel/src/components/Sections/ModelsSection.vue +++ b/panel/src/components/Sections/ModelsSection.vue @@ -96,34 +96,27 @@ export default { let buttons = []; if (this.isSelecting) { - if (this.selected.length === 0) { - buttons.push({ - disabled: true, - text: `${this.selected.length} items selected`, - theme: "none" - }); - } else { - buttons.push({ - icon: "trash", - text: this.$t("delete") + ` (${this.selected.length})`, - theme: "negative", - click: () => { - this.$panel.dialog.open({ - component: "k-remove-dialog", - props: { - text: `Do you really want to delete ${this.selected.length} items at once? This action cannot be undone.` - }, - on: { - submit: () => { - this.$panel.dialog.close(); - this.deleteSelected(); - } + buttons.push({ + disabled: this.selected.length === 0, + icon: "trash", + text: this.$t("delete") + ` (${this.selected.length})`, + theme: "negative", + click: () => { + this.$panel.dialog.open({ + component: "k-remove-dialog", + props: { + text: `Do you really want to delete ${this.selected.length} items at once? This action cannot be undone.` + }, + on: { + submit: () => { + this.$panel.dialog.close(); + this.deleteSelected(); } - }); - }, - responsive: true - }); - } + } + }); + }, + responsive: true + }); buttons.push({ icon: "cancel", @@ -148,6 +141,7 @@ export default { buttons.push({ icon: "checklist", click: this.onSelectToggle, + title: this.$t("select"), responsive: true }); }