From 21165242c69523c9ab68f042ca01fa0b252f6c85 Mon Sep 17 00:00:00 2001 From: sbgap Date: Fri, 26 Apr 2024 14:31:51 +0200 Subject: [PATCH 1/4] feat: add bulk note to alerts --- src/App.vue | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/App.vue b/src/App.vue index 3c71823a..a665a5ed 100644 --- a/src/App.vue +++ b/src/App.vue @@ -350,6 +350,29 @@ {{ $t('Delete') }} + + + + + note_add + + + {{ $t('AddNote') }} + this.$store.dispatch('alerts/addNote', [a.id, this.noteText]))).then(() => { + this.clearSelected() + this.$store.dispatch('alerts/getAlerts') + this.toogleNote() + }) : this.toggleNote() + }, bulkDeleteAlert() { confirm(i18n.t('ConfirmDelete')) && Promise.all(this.selected.map(a => this.$store.dispatch('alerts/deleteAlert', a.id, false))).then(() => { From 11e8845102c21e6be672409b5f241c2437c50074 Mon Sep 17 00:00:00 2001 From: sbgap Date: Fri, 26 Apr 2024 14:37:28 +0200 Subject: [PATCH 2/4] fix: remove notes from alerta history view --- src/components/HistoryList.vue | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/components/HistoryList.vue b/src/components/HistoryList.vue index eab92ae1..64b77f3b 100644 --- a/src/components/HistoryList.vue +++ b/src/components/HistoryList.vue @@ -154,11 +154,6 @@ - - {{ lastNote(props.item) }} - @@ -201,7 +196,8 @@ export default { 'receiveTime', 'duration', 'lastReceiveId', - 'lastReceiveTime' + 'lastReceiveTime', + 'note' ], allowedHeaders: [ 'attributes', @@ -243,7 +239,6 @@ export default { timeout: { text: i18n.t('Timeout'), value: 'timeout', sortable: false }, timeoutLeft: { text: i18n.t('TimeoutLeft'), value: 'timeoutLeft', sortable: false }, customer: { text: i18n.t('Customer'), value: 'customer', sortable: false }, - note: { text: i18n.t('LastNote'), value: 'note', sortable: false } }, details: false, timer: null @@ -319,10 +314,6 @@ export default { let expireTime = moment(lastModified).add(item.timeout, 'seconds') return expireTime.isAfter() ? expireTime.diff(moment(), 'seconds') : moment.duration() }, - lastNote(item) { - const note = item.history.filter(h => h.type == 'note' || h.type == 'dismiss').pop() - return note && note.type == 'note' ? note.text : '' - }, valueWidth() { return this.$store.getters.getPreference('valueWidth') }, From 9afcaca83bc9e0622ab537dff37d1d02176e4d8c Mon Sep 17 00:00:00 2001 From: sbgap Date: Mon, 29 Apr 2024 08:54:23 +0200 Subject: [PATCH 3/4] fix: add text rules for add buld note --- src/App.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index a665a5ed..82e82c5c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -356,7 +356,7 @@ :counter="maxNoteLength" :maxlength="maxNoteLength" :minlength="minNoteLength" - :rules="textRules" + :rules="noteRules" :label="$t('AddNote')" required /> @@ -536,7 +536,7 @@ export default { Snackbar }, props: [], - data: () => ({ + data: vm => ({ hasFocus: false, menu: false, message: false, @@ -545,6 +545,12 @@ export default { drawer: false, noteText: '', showNote: false, + maxNoteLength: 200, + minNoteLength: 0, + noteRules: [ + v => !!v || i18n.t('TextIsRequired'), + v => (v && v.length <= vm.maxNoteLength) || `${i18n.t('TextMustBeLessThan')} ${vm.maxNoteLength} ${i18n.t('characters')}` + ], navbar: { signin: { icon: 'account_circle', text: i18n.t('SignIn'), path: '/login' } }, @@ -884,7 +890,7 @@ export default { Promise.all(this.selected.map(a => this.$store.dispatch('alerts/addNote', [a.id, this.noteText]))).then(() => { this.clearSelected() this.$store.dispatch('alerts/getAlerts') - this.toogleNote() + this.toggleNote() }) : this.toggleNote() }, bulkDeleteAlert() { From 3ac8beb6da75ed911e1ff3f7d8182abd34483a7a Mon Sep 17 00:00:00 2001 From: sbgap Date: Mon, 29 Apr 2024 10:52:20 +0200 Subject: [PATCH 4/4] feat: add buld delete of notes in alerta view --- src/App.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/App.vue b/src/App.vue index 82e82c5c..957e329d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -350,6 +350,7 @@ {{ $t('Delete') }} + {{ $t('AddNote') }} + + + + + cancel_presentation + + + {{ $t('DeleteNote') }} + {const note = a.history.filter(h => h.type == 'note').pop();this.$store.dispatch('alerts/deleteNote', [a.id, note.id])})).then(() => { + this.clearSelected() + this.$store.dispatch('alerts/getAlerts') + }) + }, bulkDeleteAlert() { confirm(i18n.t('ConfirmDelete')) && Promise.all(this.selected.map(a => this.$store.dispatch('alerts/deleteAlert', a.id, false))).then(() => {