diff --git a/src/store/modules/HardwareStatus/SensorsStore.js b/src/store/modules/HardwareStatus/SensorsStore.js index 287796d9f3..50678cdf83 100644 --- a/src/store/modules/HardwareStatus/SensorsStore.js +++ b/src/store/modules/HardwareStatus/SensorsStore.js @@ -15,25 +15,22 @@ const SensorsStore = { }, }, actions: { - async getAllSensors({ dispatch }) { - const collection = await dispatch('getChassisCollection'); - if (!collection) return; - const promises = collection.reduce((acc, id) => { - acc.push(dispatch('getSensors', id)); - acc.push(dispatch('getThermalSensors', id)); - acc.push(dispatch('getPowerSensors', id)); - return acc; - }, []); - return await api.all(promises); - }, async getChassisCollection() { return await api - .get('/redfish/v1/Chassis') + .get('/redfish/v1/') + .then((response) => api.get(response.data.Chassis['@odata.id'])) .then(({ data: { Members } }) => Members.map((member) => member['@odata.id']) ) .catch((error) => console.log(error)); }, + async getAllSensors({ dispatch }) { + const collection = await dispatch('getChassisCollection'); + if (!collection) return; + return await api + .all(collection.map((chassis) => dispatch('getSensors', chassis))) + .catch((error) => console.log(error)); + }, async getSensors({ commit }, id) { const sensors = await api .get(`${id}/Sensors`) diff --git a/src/views/HardwareStatus/Sensors/Sensors.vue b/src/views/HardwareStatus/Sensors/Sensors.vue index 15cecfff6c..dfbc7493f4 100644 --- a/src/views/HardwareStatus/Sensors/Sensors.vue +++ b/src/views/HardwareStatus/Sensors/Sensors.vue @@ -47,7 +47,10 @@ show-empty :no-border-collapse="true" :items="filteredSensors" + :busy="isBusy" :fields="fields" + :per-page="perPage" + :current-page="currentPage" :sort-desc="true" :sort-compare="sortCompare" :filter="searchFilter" @@ -96,6 +99,32 @@ + + + + + + + + + + + @@ -107,7 +136,11 @@ import TableFilter from '@/components/Global/TableFilter'; import TableToolbar from '@/components/Global/TableToolbar'; import TableToolbarExport from '@/components/Global/TableToolbarExport'; import TableCellCount from '@/components/Global/TableCellCount'; - +import BVPaginationMixin, { + currentPage, + perPage, + itemsPerPageOptions, +} from '@/components/Mixins/BVPaginationMixin'; import BVTableSelectableMixin, { selectedRows, tableHeaderCheckboxModel, @@ -120,7 +153,6 @@ import TableSortMixin from '@/components/Mixins/TableSortMixin'; import SearchFilterMixin, { searchFilter, } from '@/components/Mixins/SearchFilterMixin'; - export default { name: 'Sensors', components: { @@ -133,6 +165,7 @@ export default { TableToolbarExport, }, mixins: [ + BVPaginationMixin, TableFilterMixin, BVTableSelectableMixin, LoadingBarMixin, @@ -173,7 +206,6 @@ export default { formatter: this.dataFormatter, label: this.$t('pageSensors.table.lowerWarning'), }, - { key: 'currentValue', formatter: this.dataFormatter, @@ -198,6 +230,10 @@ export default { }, ], activeFilters: [], + currentPage: currentPage, + itemsPerPageOptions: itemsPerPageOptions, + isBusy: false, + perPage: perPage, searchFilter: searchFilter, searchTotalFilteredRows: 0, selectedRows: selectedRows, @@ -222,9 +258,16 @@ export default { this.startLoader(); this.$store .dispatch('sensors/getAllSensors') - .finally(() => this.endLoader()); + .then(this.toggleBusy()) + .finally(() => { + this.endLoader(); + this.toggleBusy(); + }); }, methods: { + toggleBusy() { + this.isBusy = !this.isBusy; + }, sortCompare(a, b, key) { if (key === 'status') { return this.sortStatus(a, b, key);