diff options
Diffstat (limited to 'src/views/Health')
-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()" |