diff options
author | Dixsie Wolmers <dixsie@ibm.com> | 2021-05-03 02:20:27 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2021-06-09 15:04:53 +0300 |
commit | 27d68affdeaba25f011aef52ccbe56506e63d92c (patch) | |
tree | 66ed00b677c37df41bf484110c0fb1182b116d4c /src/views | |
parent | dca9b0a5baddfec7ea0ea5e4bdb63c2dd0be27b2 (diff) | |
download | webui-vue-27d68affdeaba25f011aef52ccbe56506e63d92c.tar.xz |
Add event log resolve and unresolve log functionality
Displays resolved or unresolved status, adds ability to filter
by resolved or unresolved, and adds ability to resolve or
unresolve one or more logs.
Move event type table field to expanded row.
Signed-off-by: Dixsie Wolmers <dixsie@ibm.com>
Change-Id: Ie5761753a7660a714f98c238d8d89aa018719dcf
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/Health/EventLogs/EventLogs.vue | 85 | ||||
-rw-r--r-- | src/views/Health/Sensors/Sensors.vue | 2 |
2 files changed, 79 insertions, 8 deletions
diff --git a/src/views/Health/EventLogs/EventLogs.vue b/src/views/Health/EventLogs/EventLogs.vue index 69545a57..64e2adb9 100644 --- a/src/views/Health/EventLogs/EventLogs.vue +++ b/src/views/Health/EventLogs/EventLogs.vue @@ -34,7 +34,13 @@ @clear-selected="clearSelectedRows($refs.table)" @batch-action="onBatchAction" > - <template #export> + <template #toolbar-buttons> + <b-button variant="primary" @click="resolveLogs"> + {{ $t('pageEventLogs.resolve') }} + </b-button> + <b-button variant="primary" @click="unresolveLogs"> + {{ $t('pageEventLogs.unresolve') }} + </b-button> <table-toolbar-export :data="batchExportData" :file-name="exportFileNameByDate()" @@ -107,6 +113,11 @@ <dt>{{ $t('pageEventLogs.table.name') }}:</dt> <dd>{{ tableFormatter(item.name) }}</dd> </dl> + <dl> + <!-- Type --> + <dt>{{ $t('pageEventLogs.table.type') }}:</dt> + <dd>{{ tableFormatter(item.type) }}</dd> + </dl> </b-col> <b-col sm="6" xl="4"> <dl> @@ -128,13 +139,30 @@ <status-icon v-if="value" :status="statusIcon(value)" /> {{ value }} </template> - <!-- Date column --> <template #cell(date)="{ value }"> <p class="mb-0">{{ value | formatDate }}</p> <p class="mb-0">{{ value | formatTime }}</p> </template> + <!-- Status column --> + <template #cell(status)="row"> + <b-form-checkbox + v-model="row.item.status" + name="switch" + switch + @change="changelogStatus(row.item)" + > + <span v-if="row.item.status"> + {{ $t('pageEventLogs.resolved') }} + </span> + <span v-else> {{ $t('pageEventLogs.unresolved') }} </span> + </b-form-checkbox> + </template> + <template #cell(filterByStatus)="{ value }"> + {{ value }} + </template> + <!-- Actions column --> <template #cell(actions)="row"> <table-row-action @@ -280,18 +308,19 @@ export default { tdClass: 'text-nowrap', }, { - key: 'type', - label: this.$t('pageEventLogs.table.type'), - sortable: true, - }, - { key: 'date', label: this.$t('pageEventLogs.table.date'), sortable: true, + tdClass: 'text-nowrap', }, { key: 'description', label: this.$t('pageEventLogs.table.description'), + tdClass: 'text-break', + }, + { + key: 'status', + label: this.$t('pageEventLogs.table.status'), }, { key: 'actions', @@ -306,6 +335,11 @@ export default { label: this.$t('pageEventLogs.table.severity'), values: ['OK', 'Warning', 'Critical'], }, + { + key: 'filterByStatus', + label: this.$t('pageEventLogs.table.status'), + values: ['Resolved', 'Unresolved'], + }, ], expandRowLabel, activeFilters: [], @@ -374,6 +408,17 @@ export default { .finally(() => this.endLoader()); }, methods: { + changelogStatus(row) { + this.$store + .dispatch('eventLog/updateEventLogStatus', { + uri: row.uri, + status: row.status, + }) + .then((success) => { + this.successToast(success); + }) + .catch(({ message }) => this.errorToast(message)); + }, deleteLogs(uris) { this.$store .dispatch('eventLog/deleteEventLogs', uris) @@ -459,6 +504,32 @@ export default { date.toString().split(':').join('-').split(' ')[4]; return this.$t('pageEventLogs.exportFilePrefix') + date; }, + resolveLogs() { + this.$store + .dispatch('eventLog/resolveEventLogs', this.selectedRows) + .then((messages) => { + messages.forEach(({ type, message }) => { + if (type === 'success') { + this.successToast(message); + } else if (type === 'error') { + this.errorToast(message); + } + }); + }); + }, + unresolveLogs() { + this.$store + .dispatch('eventLog/unresolveEventLogs', this.selectedRows) + .then((messages) => { + messages.forEach(({ type, message }) => { + if (type === 'success') { + this.successToast(message); + } else if (type === 'error') { + this.errorToast(message); + } + }); + }); + }, }, }; </script> diff --git a/src/views/Health/Sensors/Sensors.vue b/src/views/Health/Sensors/Sensors.vue index 8bc4e22e..c69532a6 100644 --- a/src/views/Health/Sensors/Sensors.vue +++ b/src/views/Health/Sensors/Sensors.vue @@ -27,7 +27,7 @@ :selected-items-count="selectedRows.length" @clear-selected="clearSelectedRows($refs.table)" > - <template #export> + <template #toolbar-buttons> <table-toolbar-export :data="selectedRows" :file-name="exportFileNameByDate()" |