Skip to content

Commit

Permalink
Already show a disabled delete button if nothing is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Dec 10, 2024
1 parent bb68ddd commit 7ebcdfb
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions panel/src/components/Sections/ModelsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -148,6 +141,7 @@ export default {
buttons.push({
icon: "checklist",
click: this.onSelectToggle,
title: this.$t("select"),
responsive: true
});
}
Expand Down

0 comments on commit 7ebcdfb

Please sign in to comment.