summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/views/HardwareStatus/Inventory/InventoryTableFans.vue41
-rw-r--r--src/views/HardwareStatus/Inventory/InventoryTablePowerSupplies.vue39
2 files changed, 80 insertions, 0 deletions
diff --git a/src/views/HardwareStatus/Inventory/InventoryTableFans.vue b/src/views/HardwareStatus/Inventory/InventoryTableFans.vue
index f8db745e..4a540e04 100644
--- a/src/views/HardwareStatus/Inventory/InventoryTableFans.vue
+++ b/src/views/HardwareStatus/Inventory/InventoryTableFans.vue
@@ -51,6 +51,12 @@
{{ value }}
</template>
+ <!-- StatusState -->
+ <template #cell(statusState)="{ value }">
+ <status-icon :status="statusStateIcon(value)" />
+ {{ value }}
+ </template>
+
<template #row-details="{ item }">
<b-container fluid>
<b-row>
@@ -149,6 +155,12 @@ export default {
tdClass: 'text-nowrap',
},
{
+ key: 'statusState',
+ label: i18n.global.t('pageInventory.table.state'),
+ formatter: this.dataFormatter,
+ tdClass: 'text-nowrap',
+ },
+ {
key: 'partNumber',
label: i18n.global.t('pageInventory.table.partNumber'),
formatter: this.dataFormatter,
@@ -186,11 +198,40 @@ export default {
sortCompare(a, b, key) {
if (key === 'health') {
return this.sortStatus(a, b, key);
+ } else if (key === 'statusState') {
+ return this.sortStatusState(a, b, key);
}
},
onFiltered(filteredItems) {
this.searchTotalFilteredRows = filteredItems.length;
},
+ /**
+ * Returns the appropriate icon based on the given status.
+ *
+ * @param {string} status - The status to determine the icon for.
+ * @return {string} The icon corresponding to the given status.
+ */
+ statusStateIcon(status) {
+ switch (status) {
+ case 'Enabled':
+ return 'success';
+ case 'Absent':
+ return 'warning';
+ default:
+ return '';
+ }
+ },
+ /**
+ * Sorts the status state of two objects based on the provided key.
+ *
+ * @param {Object} a - The first object to compare.
+ * @param {Object} b - The second object to compare.
+ * @param {string} key - The key to use for comparison.
+ */
+ sortStatusState(a, b, key) {
+ const statusState = ['Enabled', 'Absent'];
+ return statusState.indexOf(a[key]) - statusState.indexOf(b[key]);
+ },
},
};
</script>
diff --git a/src/views/HardwareStatus/Inventory/InventoryTablePowerSupplies.vue b/src/views/HardwareStatus/Inventory/InventoryTablePowerSupplies.vue
index ac64673b..ddc3333c 100644
--- a/src/views/HardwareStatus/Inventory/InventoryTablePowerSupplies.vue
+++ b/src/views/HardwareStatus/Inventory/InventoryTablePowerSupplies.vue
@@ -51,6 +51,12 @@
{{ value }}
</template>
+ <!-- StatusState -->
+ <template #cell(statusState)="{ value }">
+ <status-icon :status="statusStateIcon(value)" />
+ {{ value }}
+ </template>
+
<template #row-details="{ item }">
<b-container fluid>
<b-row>
@@ -170,6 +176,12 @@ export default {
tdClass: 'text-nowrap',
},
{
+ key: 'statusState',
+ label: i18n.global.t('pageInventory.table.state'),
+ formatter: this.dataFormatter,
+ tdClass: 'text-nowrap',
+ },
+ {
key: 'locationNumber',
label: i18n.global.t('pageInventory.table.locationNumber'),
formatter: this.dataFormatter,
@@ -207,11 +219,38 @@ export default {
sortCompare(a, b, key) {
if (key === 'health') {
return this.sortStatus(a, b, key);
+ } else if (key === 'statusState') {
+ return this.sortStatusState(a, b, key);
}
},
onFiltered(filteredItems) {
this.searchTotalFilteredRows = filteredItems.length;
},
+ /**
+ * Returns the icon to use for status state based on the given status.
+ * @param {string} status The status to determine the icon for.
+ * @return {string} The icon for the given status.
+ */
+ statusStateIcon(status) {
+ switch (status) {
+ case 'Enabled':
+ return 'success';
+ case 'Absent':
+ return 'warning';
+ default:
+ return '';
+ }
+ },
+ /**
+ * Sorts the status state of two objects based on the provided key.
+ * @param {Object} a The first object to compare.
+ * @param {Object} b The second object to compare.
+ * @param {string} key The key to use for comparison.
+ */
+ sortStatusState(a, b, key) {
+ const statusState = ['Enabled', 'Absent'];
+ return statusState.indexOf(a[key]) - statusState.indexOf(b[key]);
+ },
},
};
</script>