diff --git a/src/pages/EditMaintenance.vue b/src/pages/EditMaintenance.vue index 9bd5a57d2..c8d15dba6 100644 --- a/src/pages/EditMaintenance.vue +++ b/src/pages/EditMaintenance.vue @@ -32,16 +32,12 @@
{{ $t("affectedMonitorsDescription") }}
-
+ @select="onMonitorSelect" + @remove="onMonitorRemove" + > + +
@@ -360,8 +365,19 @@ export default { }); }, + affectedMonitorsOptionsWithSelectAll() { + return [ + { + id: "select-all", + pathName: this.affectedMonitorsAllSelected ? this.$t("Deselect All") : this.$t("Select All") + }, + ...this.affectedMonitorsOptions + ]; + }, + affectedMonitorsAllSelected() { - return this.affectedMonitors.length > 0 && this.affectedMonitors.length === this.affectedMonitorsOptions.length; + return this.affectedMonitors.length > 0 && + this.affectedMonitors.length === this.affectedMonitorsOptions.length; }, pageName() { @@ -505,11 +521,21 @@ export default { } }, - toggleSelectAllAffectedMonitors() { - if (this.affectedMonitorsAllSelected) { - this.affectedMonitors = []; - } else { - this.affectedMonitors = this.affectedMonitorsOptions.slice(); + onMonitorSelect(selectedOption) { + if (selectedOption.id === "select-all") { + this.affectedMonitors = this.affectedMonitors.filter(m => m.id !== "select-all"); + + if (this.affectedMonitorsAllSelected) { + this.affectedMonitors = []; + } else { + this.affectedMonitors = this.affectedMonitorsOptions.slice(); + } + } + }, + + onMonitorRemove(removedOption) { + if (removedOption.id === "select-all") { + this.affectedMonitors = this.affectedMonitors.filter(m => m.id !== "select-all"); } },