| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <b-container fluid="xl"> |
| 3 | <page-title /> |
| SurenNeware | 787635a | 2020-11-24 22:42:42 +0530 | [diff] [blame] | 4 | <b-row class="align-items-start"> |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 5 | <b-col sm="8" xl="6" class="d-sm-flex align-items-end mb-4"> |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 6 | <search |
| 7 | :placeholder="$t('pageEventLogs.table.searchLogs')" |
| Sandeepa Singh | 99e20d8 | 2021-02-09 17:37:59 +0530 | [diff] [blame] | 8 | data-test-id="eventLogs-input-searchLogs" |
| Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 9 | @change-search="onChangeSearchInput" |
| 10 | @clear-search="onClearSearchInput" |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 11 | /> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 12 | <div class="ms-sm-4"> |
| SurenNeware | 787635a | 2020-11-24 22:42:42 +0530 | [diff] [blame] | 13 | <table-cell-count |
| 14 | :filtered-items-count="filteredRows" |
| 15 | :total-number-of-cells="allLogs.length" |
| 16 | ></table-cell-count> |
| 17 | </div> |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 18 | </b-col> |
| SurenNeware | 787635a | 2020-11-24 22:42:42 +0530 | [diff] [blame] | 19 | <b-col sm="8" md="7" xl="6"> |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 20 | <table-date-filter @change="onChangeDateTimeFilter" /> |
| 21 | </b-col> |
| 22 | </b-row> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 23 | <b-row> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 24 | <b-col class="text-end"> |
| Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 25 | <table-filter :filters="tableFilters" @filter-change="onFilterChange" /> |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 26 | <b-button |
| 27 | variant="link" |
| 28 | :disabled="allLogs.length === 0" |
| 29 | @click="deleteAllLogs" |
| 30 | > |
| 31 | <icon-delete /> {{ $t('global.action.deleteAll') }} |
| 32 | </b-button> |
| 33 | <b-button |
| 34 | variant="primary" |
| 35 | :class="{ disabled: allLogs.length === 0 }" |
| 36 | :download="exportFileNameByDate()" |
| 37 | :href="href" |
| 38 | > |
| 39 | <icon-export /> {{ $t('global.action.exportAll') }} |
| 40 | </b-button> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 41 | </b-col> |
| 42 | </b-row> |
| 43 | <b-row> |
| 44 | <b-col> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 45 | <table-toolbar |
| 46 | ref="toolbar" |
| 47 | :selected-items-count="selectedRows.length" |
| 48 | :actions="batchActions" |
| Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 49 | @clear-selected="clearSelectedRows($refs.table)" |
| 50 | @batch-action="onBatchAction" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 51 | > |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 52 | <template #toolbar-buttons> |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 53 | <b-button v-if="!hideToggle" variant="primary" @click="resolveLogs"> |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 54 | {{ $t('pageEventLogs.resolve') }} |
| 55 | </b-button> |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 56 | <b-button |
| 57 | v-if="!hideToggle" |
| 58 | variant="primary" |
| 59 | @click="unresolveLogs" |
| 60 | > |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 61 | {{ $t('pageEventLogs.unresolve') }} |
| 62 | </b-button> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 63 | <table-toolbar-export |
| 64 | :data="batchExportData" |
| SurenNeware | 96ebb0d | 2020-09-08 17:42:39 +0530 | [diff] [blame] | 65 | :file-name="exportFileNameByDate()" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 66 | /> |
| 67 | </template> |
| 68 | </table-toolbar> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 69 | <b-table |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 70 | id="table-event-logs" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 71 | ref="table" |
| SurenNeware | 5e25e28 | 2020-07-08 15:57:23 +0530 | [diff] [blame] | 72 | responsive="md" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 73 | selectable |
| 74 | no-select-on-click |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 75 | sort-icon-left |
| Sukanya Pandey | fde429e | 2020-09-14 20:48:39 +0530 | [diff] [blame] | 76 | hover |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 77 | must-sort |
| 78 | thead-class="table-light" |
| 79 | :sort-desc="[true]" |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 80 | show-empty |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 81 | :sort-by="['id']" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 82 | :fields="fields" |
| 83 | :items="filteredLogs" |
| SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 84 | :empty-text="$t('global.table.emptyMessage')" |
| SurenNeware | 156a0e6 | 2020-08-28 19:20:03 +0530 | [diff] [blame] | 85 | :empty-filtered-text="$t('global.table.emptySearchMessage')" |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 86 | :per-page="perPage" |
| 87 | :current-page="currentPage" |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 88 | :filter="searchFilter" |
| Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 89 | :busy="isBusy" |
| Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 90 | @filtered="onFiltered" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 91 | @row-selected="onRowSelected($event, filteredLogs.length)" |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 92 | > |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 93 | <!-- Checkbox column --> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 94 | <template #head(checkbox)> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 95 | <b-form-checkbox |
| 96 | v-model="tableHeaderCheckboxModel" |
| Yoshie Muranaka | ed06dc1 | 2020-06-16 12:12:27 -0700 | [diff] [blame] | 97 | data-test-id="eventLogs-checkbox-selectAll" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 98 | :indeterminate="tableHeaderCheckboxIndeterminate" |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 99 | @change="onChangeHeaderCheckbox($refs.table, $event)" |
| Dixsie Wolmers | c42ad71 | 2020-11-19 17:29:24 -0600 | [diff] [blame] | 100 | > |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 101 | <span class="visually-hidden-focusable"> |
| 102 | {{ $t('global.table.selectAll') }} |
| 103 | </span> |
| Dixsie Wolmers | c42ad71 | 2020-11-19 17:29:24 -0600 | [diff] [blame] | 104 | </b-form-checkbox> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 105 | </template> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 106 | <template #cell(checkbox)="row"> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 107 | <b-form-checkbox |
| 108 | v-model="row.rowSelected" |
| Yoshie Muranaka | ed06dc1 | 2020-06-16 12:12:27 -0700 | [diff] [blame] | 109 | :data-test-id="`eventLogs-checkbox-selectRow-${row.index}`" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 110 | @change="toggleSelectRow($refs.table, row.index)" |
| Dixsie Wolmers | c42ad71 | 2020-11-19 17:29:24 -0600 | [diff] [blame] | 111 | > |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 112 | <span class="visually-hidden-focusable"> |
| 113 | {{ $t('global.table.selectItem') }} |
| 114 | </span> |
| Dixsie Wolmers | c42ad71 | 2020-11-19 17:29:24 -0600 | [diff] [blame] | 115 | </b-form-checkbox> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 116 | </template> |
| 117 | |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 118 | <!-- Expand chevron icon --> |
| 119 | <template #cell(expandRow)="row"> |
| 120 | <b-button |
| 121 | variant="link" |
| 122 | :aria-label="expandRowLabel" |
| 123 | :title="expandRowLabel" |
| 124 | class="btn-icon-only" |
| 125 | @click="toggleRowDetails(row)" |
| 126 | > |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 127 | <icon-chevron v-if="!row.detailsShowing" /> |
| 128 | <icon-chevron-up v-else /> |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 129 | </b-button> |
| 130 | </template> |
| 131 | |
| 132 | <template #row-details="{ item }"> |
| 133 | <b-container fluid> |
| 134 | <b-row> |
| Dixsie Wolmers | 8b1beff | 2021-06-14 11:29:44 -0500 | [diff] [blame] | 135 | <b-col> |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 136 | <dl> |
| 137 | <!-- Name --> |
| 138 | <dt>{{ $t('pageEventLogs.table.name') }}:</dt> |
| Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 139 | <dd>{{ dataFormatter(item.name) }}</dd> |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 140 | </dl> |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 141 | <dl> |
| 142 | <!-- Type --> |
| 143 | <dt>{{ $t('pageEventLogs.table.type') }}:</dt> |
| Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 144 | <dd>{{ dataFormatter(item.type) }}</dd> |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 145 | </dl> |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 146 | </b-col> |
| Dixsie Wolmers | 8b1beff | 2021-06-14 11:29:44 -0500 | [diff] [blame] | 147 | <b-col> |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 148 | <dl> |
| 149 | <!-- Modified date --> |
| 150 | <dt>{{ $t('pageEventLogs.table.modifiedDate') }}:</dt> |
| 151 | <dd v-if="item.modifiedDate"> |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 152 | {{ $filters.formatDate(item.modifiedDate) }} |
| 153 | {{ $filters.formatTime(item.modifiedDate) }} |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 154 | </dd> |
| 155 | <dd v-else>--</dd> |
| 156 | </dl> |
| 157 | </b-col> |
| Dixsie Wolmers | 8b1beff | 2021-06-14 11:29:44 -0500 | [diff] [blame] | 158 | <b-col class="text-nowrap"> |
| Sean Zhang | 582e954 | 2024-07-05 12:48:45 +0300 | [diff] [blame] | 159 | <b-button @click="downloadEntry(item.additionalDataUri)"> |
| Dixsie Wolmers | 8b1beff | 2021-06-14 11:29:44 -0500 | [diff] [blame] | 160 | <icon-download />{{ $t('pageEventLogs.additionalDataUri') }} |
| 161 | </b-button> |
| 162 | </b-col> |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 163 | </b-row> |
| 164 | </b-container> |
| 165 | </template> |
| 166 | |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 167 | <!-- Severity column --> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 168 | <template #cell(severity)="{ value }"> |
| Mateusz Gapski | b1f1253 | 2020-07-24 08:15:23 +0200 | [diff] [blame] | 169 | <status-icon v-if="value" :status="statusIcon(value)" /> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 170 | {{ value }} |
| 171 | </template> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 172 | <!-- Date column --> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 173 | <template #cell(date)="{ value }"> |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 174 | <p class="mb-0">{{ $filters.formatDate(value) }}</p> |
| 175 | <p class="mb-0">{{ $filters.formatTime(value) }}</p> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 176 | </template> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 177 | |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 178 | <!-- Status column --> |
| 179 | <template #cell(status)="row"> |
| 180 | <b-form-checkbox |
| 181 | v-model="row.item.status" |
| 182 | name="switch" |
| 183 | switch |
| 184 | @change="changelogStatus(row.item)" |
| 185 | > |
| 186 | <span v-if="row.item.status"> |
| 187 | {{ $t('pageEventLogs.resolved') }} |
| 188 | </span> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 189 | <span v-else> |
| 190 | {{ $t('pageEventLogs.unresolved') }} |
| 191 | </span> |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 192 | </b-form-checkbox> |
| 193 | </template> |
| 194 | <template #cell(filterByStatus)="{ value }"> |
| 195 | {{ value }} |
| 196 | </template> |
| 197 | |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 198 | <!-- Actions column --> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 199 | <template #cell(actions)="row"> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 200 | <table-row-action |
| Yoshie Muranaka | ed06dc1 | 2020-06-16 12:12:27 -0700 | [diff] [blame] | 201 | v-for="(action, index) in row.item.actions" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 202 | :key="index" |
| 203 | :value="action.value" |
| 204 | :title="action.title" |
| Yoshie Muranaka | ed06dc1 | 2020-06-16 12:12:27 -0700 | [diff] [blame] | 205 | :row-data="row.item" |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 206 | :export-name="exportFileNameByDate('export')" |
| Yoshie Muranaka | ed06dc1 | 2020-06-16 12:12:27 -0700 | [diff] [blame] | 207 | :data-test-id="`eventLogs-button-deleteRow-${row.index}`" |
| Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 208 | @click-table-action="onTableRowAction($event, row.item)" |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 209 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 210 | <template #icon> |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 211 | <icon-export v-if="action.value === 'export'" /> |
| 212 | <icon-trashcan v-if="action.value === 'delete'" /> |
| 213 | </template> |
| 214 | </table-row-action> |
| 215 | </template> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 216 | </b-table> |
| 217 | </b-col> |
| 218 | </b-row> |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 219 | |
| 220 | <!-- Table pagination --> |
| 221 | <b-row> |
| SurenNeware | a35b5a1 | 2020-10-13 17:08:20 +0530 | [diff] [blame] | 222 | <b-col sm="6"> |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 223 | <b-form-group |
| 224 | class="table-pagination-select" |
| 225 | :label="$t('global.table.itemsPerPage')" |
| 226 | label-for="pagination-items-per-page" |
| 227 | > |
| 228 | <b-form-select |
| 229 | id="pagination-items-per-page" |
| 230 | v-model="perPage" |
| 231 | :options="itemsPerPageOptions" |
| 232 | /> |
| 233 | </b-form-group> |
| SurenNeware | a35b5a1 | 2020-10-13 17:08:20 +0530 | [diff] [blame] | 234 | </b-col> |
| 235 | <b-col sm="6"> |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 236 | <b-pagination |
| 237 | v-model="currentPage" |
| 238 | first-number |
| 239 | last-number |
| 240 | :per-page="perPage" |
| Sukanya Pandey | f7000cd | 2021-08-26 18:34:49 +0530 | [diff] [blame] | 241 | :total-rows="getTotalRowCount(filteredRows)" |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 242 | aria-controls="table-event-logs" |
| 243 | /> |
| 244 | </b-col> |
| 245 | </b-row> |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 246 | </b-container> |
| 247 | </template> |
| 248 | |
| 249 | <script> |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 250 | import IconDelete from '@carbon/icons-vue/es/trash-can/20'; |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 251 | import IconTrashcan from '@carbon/icons-vue/es/trash-can/20'; |
| Sukanya Pandey | b2ca0c0 | 2020-07-20 23:23:29 +0530 | [diff] [blame] | 252 | import IconExport from '@carbon/icons-vue/es/document--export/20'; |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 253 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 254 | import IconChevronUp from '@carbon/icons-vue/es/chevron--up/20'; |
| Dixsie Wolmers | 8b1beff | 2021-06-14 11:29:44 -0500 | [diff] [blame] | 255 | import IconDownload from '@carbon/icons-vue/es/download/20'; |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 256 | import { omit } from 'lodash'; |
| 257 | |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 258 | import PageTitle from '@/components/Global/PageTitle'; |
| 259 | import StatusIcon from '@/components/Global/StatusIcon'; |
| Derick Montague | d853fba | 2020-07-16 11:24:10 -0500 | [diff] [blame] | 260 | import Search from '@/components/Global/Search'; |
| Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 261 | import TableCellCount from '@/components/Global/TableCellCount'; |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 262 | import TableDateFilter from '@/components/Global/TableDateFilter'; |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 263 | import TableFilter from '@/components/Global/TableFilter'; |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 264 | import TableRowAction from '@/components/Global/TableRowAction'; |
| 265 | import TableToolbar from '@/components/Global/TableToolbar'; |
| 266 | import TableToolbarExport from '@/components/Global/TableToolbarExport'; |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 267 | |
| 268 | import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; |
| 269 | import TableFilterMixin from '@/components/Mixins/TableFilterMixin'; |
| SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 270 | import BVPaginationMixin, { |
| 271 | currentPage, |
| 272 | perPage, |
| 273 | itemsPerPageOptions, |
| 274 | } from '@/components/Mixins/BVPaginationMixin'; |
| 275 | import BVTableSelectableMixin, { |
| 276 | selectedRows, |
| 277 | tableHeaderCheckboxModel, |
| 278 | tableHeaderCheckboxIndeterminate, |
| 279 | } from '@/components/Mixins/BVTableSelectableMixin'; |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 280 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
| Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 281 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
| Yoshie Muranaka | 73e419a | 2020-06-18 13:08:19 -0700 | [diff] [blame] | 282 | import TableSortMixin from '@/components/Mixins/TableSortMixin'; |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 283 | import TableRowExpandMixin, { |
| 284 | expandRowLabel, |
| 285 | } from '@/components/Mixins/TableRowExpandMixin'; |
| SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 286 | import SearchFilterMixin, { |
| 287 | searchFilter, |
| 288 | } from '@/components/Mixins/SearchFilterMixin'; |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 289 | import { useI18n } from 'vue-i18n'; |
| 290 | import i18n from '@/i18n'; |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 291 | import { useModal } from 'bootstrap-vue-next'; |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 292 | |
| 293 | export default { |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 294 | components: { |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 295 | IconDelete, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 296 | IconExport, |
| 297 | IconTrashcan, |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 298 | IconChevron, |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 299 | IconChevronUp, |
| Dixsie Wolmers | 8b1beff | 2021-06-14 11:29:44 -0500 | [diff] [blame] | 300 | IconDownload, |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 301 | PageTitle, |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 302 | Search, |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 303 | StatusIcon, |
| Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 304 | TableCellCount, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 305 | TableFilter, |
| 306 | TableRowAction, |
| 307 | TableToolbar, |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 308 | TableToolbarExport, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 309 | TableDateFilter, |
| Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 310 | }, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 311 | mixins: [ |
| 312 | BVPaginationMixin, |
| 313 | BVTableSelectableMixin, |
| 314 | BVToastMixin, |
| 315 | LoadingBarMixin, |
| Yoshie Muranaka | 73e419a | 2020-06-18 13:08:19 -0700 | [diff] [blame] | 316 | TableFilterMixin, |
| Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 317 | DataFormatterMixin, |
| Dixsie Wolmers | 9b22b49 | 2020-09-07 21:26:06 -0500 | [diff] [blame] | 318 | TableSortMixin, |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 319 | TableRowExpandMixin, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 320 | SearchFilterMixin, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 321 | ], |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 322 | beforeRouteLeave(to, from, next) { |
| 323 | // Hide loader if the user navigates to another page |
| 324 | // before request is fulfilled. |
| 325 | this.hideLoader(); |
| 326 | next(); |
| 327 | }, |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 328 | setup() { |
| 329 | const bvModal = useModal(); |
| 330 | return { bvModal }; |
| 331 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 332 | data() { |
| 333 | return { |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 334 | $t: useI18n().t, |
| Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 335 | isBusy: true, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 336 | fields: [ |
| 337 | { |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 338 | key: 'expandRow', |
| 339 | label: '', |
| 340 | tdClass: 'table-row-expand', |
| 341 | }, |
| 342 | { |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 343 | key: 'checkbox', |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 344 | sortable: false, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 345 | }, |
| 346 | { |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 347 | key: 'id', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 348 | label: i18n.global.t('pageEventLogs.table.id'), |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 349 | sortable: true, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 350 | }, |
| 351 | { |
| 352 | key: 'severity', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 353 | label: i18n.global.t('pageEventLogs.table.severity'), |
| Dixsie Wolmers | a04d46f | 2020-10-22 06:34:56 -0500 | [diff] [blame] | 354 | sortable: true, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 355 | tdClass: 'text-nowrap', |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 356 | }, |
| 357 | { |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 358 | key: 'date', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 359 | label: i18n.global.t('pageEventLogs.table.date'), |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 360 | sortable: true, |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 361 | tdClass: 'text-nowrap', |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 362 | }, |
| 363 | { |
| 364 | key: 'description', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 365 | label: i18n.global.t('pageEventLogs.table.description'), |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 366 | tdClass: 'text-break', |
| 367 | }, |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 368 | process.env.VUE_APP_EVENT_LOGS_TOGGLE_BUTTON_DISABLED === 'true' |
| 369 | ? {} |
| 370 | : { |
| 371 | key: 'status', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 372 | label: i18n.global.t('pageEventLogs.table.status'), |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 373 | }, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 374 | { |
| 375 | key: 'actions', |
| 376 | sortable: false, |
| 377 | label: '', |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 378 | tdClass: 'text-end text-nowrap', |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 379 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 380 | ], |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 381 | tableFilters: |
| 382 | process.env.VUE_APP_EVENT_LOGS_TOGGLE_BUTTON_DISABLED === 'true' |
| 383 | ? [ |
| 384 | { |
| 385 | key: 'severity', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 386 | label: i18n.global.t('pageEventLogs.table.severity'), |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 387 | values: ['OK', 'Warning', 'Critical'], |
| 388 | }, |
| 389 | ] |
| 390 | : [ |
| 391 | { |
| 392 | key: 'severity', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 393 | label: i18n.global.t('pageEventLogs.table.severity'), |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 394 | values: ['OK', 'Warning', 'Critical'], |
| 395 | }, |
| 396 | { |
| 397 | key: 'filterByStatus', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 398 | label: i18n.global.t('pageEventLogs.table.status'), |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 399 | values: ['Resolved', 'Unresolved'], |
| 400 | }, |
| 401 | ], |
| Sukanya Pandey | 47b047c | 2020-12-23 13:18:55 +0530 | [diff] [blame] | 402 | expandRowLabel, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 403 | activeFilters: [], |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 404 | batchActions: |
| 405 | process.env.VUE_APP_EVENT_LOGS_DELETE_BUTTON_DISABLED === 'true' |
| 406 | ? [] |
| 407 | : [ |
| 408 | { |
| 409 | value: 'delete', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 410 | label: i18n.global.t('global.action.delete'), |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 411 | }, |
| 412 | ], |
| SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 413 | currentPage: currentPage, |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 414 | filterStartDate: null, |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 415 | filterEndDate: null, |
| SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 416 | itemsPerPageOptions: itemsPerPageOptions, |
| 417 | perPage: perPage, |
| 418 | searchFilter: searchFilter, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 419 | searchTotalFilteredRows: 0, |
| SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 420 | selectedRows: selectedRows, |
| 421 | tableHeaderCheckboxModel: tableHeaderCheckboxModel, |
| 422 | tableHeaderCheckboxIndeterminate: tableHeaderCheckboxIndeterminate, |
| Sivaprabu Ganesan | 0f6147c | 2023-04-12 19:08:20 +0530 | [diff] [blame] | 423 | hideToggle: |
| 424 | process.env.VUE_APP_EVENT_LOGS_TOGGLE_BUTTON_DISABLED === 'true', |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 425 | hideDelete: |
| 426 | process.env.VUE_APP_EVENT_LOGS_DELETE_BUTTON_DISABLED === 'true', |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 427 | }; |
| 428 | }, |
| 429 | computed: { |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 430 | href() { |
| 431 | return `data:text/json;charset=utf-8,${this.exportAllLogs()}`; |
| 432 | }, |
| Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 433 | filteredRows() { |
| 434 | return this.searchFilter |
| 435 | ? this.searchTotalFilteredRows |
| 436 | : this.filteredLogs.length; |
| 437 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 438 | allLogs() { |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 439 | return this.$store.getters['eventLog/allEvents'].map((event) => { |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 440 | return { |
| 441 | ...event, |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 442 | actions: this.hideDelete |
| 443 | ? [ |
| 444 | { |
| 445 | value: 'export', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 446 | title: i18n.global.t('global.action.export'), |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 447 | }, |
| 448 | ] |
| 449 | : [ |
| 450 | { |
| 451 | value: 'export', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 452 | title: i18n.global.t('global.action.export'), |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 453 | }, |
| 454 | { |
| 455 | value: 'delete', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 456 | title: i18n.global.t('global.action.delete'), |
| Damian Celico | ef96c6d | 2022-03-01 12:47:52 +0100 | [diff] [blame] | 457 | }, |
| 458 | ], |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 459 | }; |
| 460 | }); |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 461 | }, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 462 | batchExportData() { |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 463 | return this.selectedRows.map((row) => omit(row, 'actions')); |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 464 | }, |
| 465 | filteredLogsByDate() { |
| 466 | return this.getFilteredTableDataByDate( |
| 467 | this.allLogs, |
| 468 | this.filterStartDate, |
| Ed Tanous | 8132399 | 2024-02-27 11:26:24 -0800 | [diff] [blame] | 469 | this.filterEndDate, |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 470 | ); |
| 471 | }, |
| 472 | filteredLogs() { |
| 473 | return this.getFilteredTableData( |
| 474 | this.filteredLogsByDate, |
| Ed Tanous | 8132399 | 2024-02-27 11:26:24 -0800 | [diff] [blame] | 475 | this.activeFilters, |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 476 | ); |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 477 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 478 | }, |
| 479 | created() { |
| 480 | this.startLoader(); |
| Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 481 | this.$store.dispatch('eventLog/getEventLogData').finally(() => { |
| 482 | this.endLoader(); |
| 483 | this.isBusy = false; |
| 484 | }); |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 485 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 486 | methods: { |
| Sean Zhang | 582e954 | 2024-07-05 12:48:45 +0300 | [diff] [blame] | 487 | downloadEntry(uri) { |
| 488 | let filename = uri?.split('LogServices/')?.[1]; |
| 489 | filename.replace(RegExp('/', 'g'), '_'); |
| 490 | this.$store |
| 491 | .dispatch('eventLog/downloadEntry', uri) |
| 492 | .then((blob) => { |
| 493 | const link = document.createElement('a'); |
| 494 | link.href = URL.createObjectURL(blob); |
| 495 | link.download = filename; |
| 496 | link.click(); |
| 497 | URL.revokeObjectURL(link.href); |
| 498 | }) |
| 499 | .catch(({ message }) => this.errorToast(message)); |
| 500 | }, |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 501 | changelogStatus(row) { |
| 502 | this.$store |
| 503 | .dispatch('eventLog/updateEventLogStatus', { |
| 504 | uri: row.uri, |
| 505 | status: row.status, |
| 506 | }) |
| 507 | .then((success) => { |
| 508 | this.successToast(success); |
| 509 | }) |
| 510 | .catch(({ message }) => this.errorToast(message)); |
| 511 | }, |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 512 | async deleteAllLogs() { |
| 513 | const ok = await this.confirmDialog( |
| 514 | i18n.global.t('pageEventLogs.modal.deleteAllMessage'), |
| 515 | { |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 516 | title: i18n.global.t('pageEventLogs.modal.deleteAllTitle'), |
| 517 | okTitle: i18n.global.t('global.action.delete'), |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 518 | okVariant: 'danger', |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 519 | cancelTitle: i18n.global.t('global.action.cancel'), |
| Paul Fertser | d1ef18e | 2024-04-06 08:04:14 +0000 | [diff] [blame] | 520 | autoFocusButton: 'cancel', |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 521 | }, |
| 522 | ); |
| 523 | if (ok) { |
| 524 | this.$store |
| 525 | .dispatch('eventLog/deleteAllEventLogs', this.allLogs) |
| 526 | .then((message) => this.successToast(message)) |
| 527 | .catch(({ message }) => this.errorToast(message)); |
| 528 | } |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 529 | }, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 530 | deleteLogs(uris) { |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 531 | this.$store |
| 532 | .dispatch('eventLog/deleteEventLogs', uris) |
| 533 | .then((messages) => { |
| 534 | messages.forEach(({ type, message }) => { |
| 535 | if (type === 'success') { |
| 536 | this.successToast(message); |
| 537 | } else if (type === 'error') { |
| 538 | this.errorToast(message); |
| 539 | } |
| 540 | }); |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 541 | }); |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 542 | }, |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 543 | exportAllLogs() { |
| 544 | { |
| 545 | return this.$store.getters['eventLog/allEvents'].map((eventLogs) => { |
| 546 | const allEventLogsString = JSON.stringify(eventLogs); |
| 547 | return allEventLogsString; |
| 548 | }); |
| 549 | } |
| 550 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 551 | onFilterChange({ activeFilters }) { |
| 552 | this.activeFilters = activeFilters; |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 553 | }, |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 554 | onTableRowAction(action, { uri }) { |
| 555 | if (action === 'delete') { |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 556 | this.confirmDialog(i18n.global.t('pageEventLogs.modal.deleteMessage'), { |
| 557 | title: i18n.global.t('pageEventLogs.modal.deleteTitle'), |
| 558 | okTitle: i18n.global.t('global.action.delete'), |
| 559 | cancelTitle: i18n.global.t('global.action.cancel'), |
| 560 | autoFocusButton: 'ok', |
| 561 | }).then((deleteConfirmed) => { |
| 562 | if (deleteConfirmed) this.deleteLogs([uri]); |
| 563 | }); |
| 564 | } |
| 565 | }, |
| 566 | async onBatchAction(action) { |
| 567 | if (action === 'delete') { |
| 568 | const uris = this.selectedRows.map((row) => row.uri); |
| 569 | const count = this.selectedRows.length; |
| 570 | const ok = await this.confirmDialog( |
| 571 | i18n.global.t('pageEventLogs.modal.deleteMessage', count), |
| 572 | { |
| 573 | title: i18n.global.t('pageEventLogs.modal.deleteTitle', count), |
| Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 574 | okTitle: i18n.global.t('global.action.delete'), |
| 575 | cancelTitle: i18n.global.t('global.action.cancel'), |
| Paul Fertser | d1ef18e | 2024-04-06 08:04:14 +0000 | [diff] [blame] | 576 | autoFocusButton: 'ok', |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 577 | }, |
| 578 | ); |
| 579 | if (ok) { |
| 580 | if (this.selectedRows.length === this.allLogs.length) { |
| 581 | this.$store |
| 582 | .dispatch('eventLog/deleteAllEventLogs', this.selectedRows.length) |
| 583 | .then(() => { |
| 584 | this.successToast( |
| 585 | i18n.global.t( |
| 586 | 'pageEventLogs.toast.successDelete', |
| 587 | uris.length, |
| 588 | ), |
| 589 | ); |
| 590 | }) |
| 591 | .catch(({ message }) => this.errorToast(message)); |
| 592 | } else { |
| 593 | this.deleteLogs(uris); |
| 594 | } |
| 595 | } |
| Yoshie Muranaka | be3af33 | 2020-05-11 08:23:04 -0700 | [diff] [blame] | 596 | } |
| Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 597 | }, |
| 598 | onChangeDateTimeFilter({ fromDate, toDate }) { |
| 599 | this.filterStartDate = fromDate; |
| 600 | this.filterEndDate = toDate; |
| Yoshie Muranaka | 193c22a | 2020-06-30 20:54:10 -0700 | [diff] [blame] | 601 | }, |
| Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 602 | onFiltered(filteredItems) { |
| 603 | this.searchTotalFilteredRows = filteredItems.length; |
| 604 | }, |
| SurenNeware | 96ebb0d | 2020-09-08 17:42:39 +0530 | [diff] [blame] | 605 | // Create export file name based on date |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 606 | exportFileNameByDate(value) { |
| SurenNeware | 96ebb0d | 2020-09-08 17:42:39 +0530 | [diff] [blame] | 607 | let date = new Date(); |
| 608 | date = |
| 609 | date.toISOString().slice(0, 10) + |
| 610 | '_' + |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 611 | date.toString().split(':').join('-').split(' ')[4]; |
| Dixsie Wolmers | 7e2ba54 | 2021-06-03 07:38:12 -0500 | [diff] [blame] | 612 | let fileName; |
| 613 | if (value === 'export') { |
| 614 | fileName = 'event_log_'; |
| 615 | } else { |
| 616 | fileName = 'all_event_logs_'; |
| 617 | } |
| 618 | return fileName + date; |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 619 | }, |
| Dixsie Wolmers | 27d68af | 2021-05-02 18:20:27 -0500 | [diff] [blame] | 620 | resolveLogs() { |
| 621 | this.$store |
| 622 | .dispatch('eventLog/resolveEventLogs', this.selectedRows) |
| 623 | .then((messages) => { |
| 624 | messages.forEach(({ type, message }) => { |
| 625 | if (type === 'success') { |
| 626 | this.successToast(message); |
| 627 | } else if (type === 'error') { |
| 628 | this.errorToast(message); |
| 629 | } |
| 630 | }); |
| 631 | }); |
| 632 | }, |
| 633 | unresolveLogs() { |
| 634 | this.$store |
| 635 | .dispatch('eventLog/unresolveEventLogs', this.selectedRows) |
| 636 | .then((messages) => { |
| 637 | messages.forEach(({ type, message }) => { |
| 638 | if (type === 'success') { |
| 639 | this.successToast(message); |
| 640 | } else if (type === 'error') { |
| 641 | this.errorToast(message); |
| 642 | } |
| 643 | }); |
| 644 | }); |
| 645 | }, |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 646 | confirmDialog(message, options = {}) { |
| 647 | return this.$confirm({ message, ...options }); |
| 648 | }, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 649 | }, |
| Yoshie Muranaka | 6f10234 | 2020-05-05 09:45:39 -0700 | [diff] [blame] | 650 | }; |
| 651 | </script> |