Skip to content

Commit 240c056

Browse files
Sandeepa Singhderick-montague
Sandeepa Singh
authored andcommitted
Add chassis table missing properties
- Added the following properties: Name, Location number, Identify led, Manufacturer, Chassis type, Asset tag, Max power watts, Min power watts - Design has been updated for chassis table Signed-off-by: Sandeepa Singh <[email protected]> Change-Id: Id2ef82573a4d17059dc9f4929155aa05cabef2aa
1 parent 78b6b53 commit 240c056

File tree

3 files changed

+122
-23
lines changed

3 files changed

+122
-23
lines changed

src/locales/en-US.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@
397397
"maxConcurrentSessions": "Max concurrent sessions",
398398
"maxSpeedMHz": "Max speed MHz",
399399
"minSpeedMHz": "Min speed MHz",
400+
"maxPowerWatts": "Max power watts",
401+
"minPowerWatts": "Min power watts",
400402
"model": "Model",
401403
"name": "Name",
402404
"partNumber": "Part number",

src/store/modules/Health/ChassisStore.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import api from '@/store/api';
2+
import i18n from '@/i18n';
23

34
const ChassisStore = {
45
namespaced: true,
@@ -19,6 +20,11 @@ const ChassisStore = {
1920
ChassisType,
2021
Manufacturer,
2122
PowerState,
23+
LocationIndicatorActive,
24+
AssetTag,
25+
MaxPowerWatts,
26+
MinPowerWatts,
27+
Name,
2228
} = chassis;
2329

2430
return {
@@ -31,6 +37,12 @@ const ChassisStore = {
3137
powerState: PowerState,
3238
statusState: Status.State,
3339
healthRollup: Status.HealthRollup,
40+
assetTag: AssetTag,
41+
maxPowerWatts: MaxPowerWatts,
42+
minPowerWatts: MinPowerWatts,
43+
name: Name,
44+
identifyLed: LocationIndicatorActive,
45+
uri: chassis['@odata.id'],
3446
};
3547
});
3648
},
@@ -49,6 +61,28 @@ const ChassisStore = {
4961
})
5062
.catch((error) => console.log(error));
5163
},
64+
async updateIdentifyLedValue({ dispatch }, led) {
65+
const uri = led.uri;
66+
const updatedIdentifyLedValue = {
67+
LocationIndicatorActive: led.identifyLed,
68+
};
69+
return await api
70+
.patch(uri, updatedIdentifyLedValue)
71+
.then(() => dispatch('getChassisInfo'))
72+
.catch((error) => {
73+
dispatch('getChassisInfo');
74+
console.log('error', error);
75+
if (led.identifyLed) {
76+
throw new Error(
77+
i18n.t('pageHardwareStatus.toast.errorEnableIdentifyLed')
78+
);
79+
} else {
80+
throw new Error(
81+
i18n.t('pageHardwareStatus.toast.errorDisableIdentifyLed')
82+
);
83+
}
84+
});
85+
},
5286
},
5387
};
5488

src/views/Health/HardwareStatus/HardwareStatusTableChassis.vue

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,82 @@
2727
<status-icon :status="statusIcon(value)" />
2828
{{ value }}
2929
</template>
30-
30+
<!-- Toggle identify LED -->
31+
<template #cell(identifyLed)="row">
32+
<b-form-checkbox
33+
v-if="hasIdentifyLed(row.item.identifyLed)"
34+
v-model="row.item.identifyLed"
35+
name="switch"
36+
switch
37+
@change="toggleIdentifyLedValue(row.item)"
38+
>
39+
<span v-if="row.item.identifyLed">
40+
{{ $t('global.status.on') }}
41+
</span>
42+
<span v-else> {{ $t('global.status.off') }} </span>
43+
</b-form-checkbox>
44+
<div v-else>--</div>
45+
</template>
3146
<template #row-details="{ item }">
3247
<b-container fluid>
3348
<b-row>
34-
<b-col sm="6" xl="4">
49+
<b-col class="mt-2" sm="6" xl="6">
3550
<dl>
36-
<!-- Chassis type -->
37-
<dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
38-
<dd>{{ tableFormatter(item.chassisType) }}</dd>
39-
<!-- Manufacturer -->
40-
<dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
41-
<dd>{{ tableFormatter(item.manufacturer) }}</dd>
42-
<!-- Power state -->
43-
<dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
44-
<dd>{{ tableFormatter(item.powerState) }}</dd>
51+
<!-- Name -->
52+
<dt>{{ $t('pageHardwareStatus.table.name') }}:</dt>
53+
<dd>{{ tableFormatter(item.name) }}</dd>
54+
<!-- Part number -->
55+
<dt>{{ $t('pageHardwareStatus.table.partNumber') }}:</dt>
56+
<dd>{{ tableFormatter(item.partNumber) }}</dd>
57+
<!-- Serial Number -->
58+
<dt>{{ $t('pageHardwareStatus.table.serialNumber') }}:</dt>
59+
<dd>{{ tableFormatter(item.serialNumber) }}</dd>
60+
<!-- Model -->
61+
<dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
62+
<dd class="mb-2">
63+
{{ tableFormatter(item.model) }}
64+
</dd>
65+
<!-- Asset tag -->
66+
<dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt>
67+
<dd class="mb-2">
68+
{{ tableFormatter(item.assetTag) }}
69+
</dd>
4570
</dl>
4671
</b-col>
47-
<b-col sm="6" xl="4">
72+
<b-col class="mt-2" sm="6" xl="6">
4873
<dl>
49-
<!-- Health rollup -->
50-
<dt>
51-
{{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
52-
</dt>
53-
<dd>{{ tableFormatter(item.healthRollup) }}</dd>
5474
<!-- Status state -->
5575
<dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
5676
<dd>{{ tableFormatter(item.statusState) }}</dd>
77+
<!-- Power state -->
78+
<dt>{{ $t('pageHardwareStatus.table.power') }}:</dt>
79+
<dd>{{ tableFormatter(item.power) }}</dd>
80+
<!-- Health rollup -->
81+
<dt>{{ $t('pageHardwareStatus.table.healthRollup') }}:</dt>
82+
<dd>{{ tableFormatter(item.healthRollup) }}</dd>
83+
</dl>
84+
</b-col>
85+
</b-row>
86+
<div class="section-divider mb-3 mt-3"></div>
87+
<b-row>
88+
<b-col class="mt-2" sm="6" xl="6">
89+
<dl>
90+
<!-- Manufacturer -->
91+
<dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
92+
<dd>{{ tableFormatter(item.manufacturer) }}</dd>
93+
<!-- Chassis Type -->
94+
<dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
95+
<dd>{{ tableFormatter(item.chassisType) }}</dd>
96+
</dl>
97+
</b-col>
98+
<b-col class="mt-2" sm="6" xl="6">
99+
<dl>
100+
<!-- Min power -->
101+
<dt>{{ $t('pageHardwareStatus.table.minPowerWatts') }}:</dt>
102+
<dd>{{ tableFormatter(item.minPowerWatts) }}</dd>
103+
<!-- Max power -->
104+
<dt>{{ $t('pageHardwareStatus.table.maxPowerWatts') }}:</dt>
105+
<dd>{{ tableFormatter(item.maxPowerWatts) }}</dd>
57106
</dl>
58107
</b-col>
59108
</b-row>
@@ -66,7 +115,7 @@
66115
<script>
67116
import PageSection from '@/components/Global/PageSection';
68117
import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
69-
118+
import BVToastMixin from '@/components/Mixins/BVToastMixin';
70119
import StatusIcon from '@/components/Global/StatusIcon';
71120
72121
import TableRowExpandMixin, {
@@ -76,7 +125,7 @@ import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin
76125
77126
export default {
78127
components: { IconChevron, PageSection, StatusIcon },
79-
mixins: [TableRowExpandMixin, TableDataFormatterMixin],
128+
mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin],
80129
data() {
81130
return {
82131
fields: [
@@ -97,13 +146,13 @@ export default {
97146
tdClass: 'text-nowrap',
98147
},
99148
{
100-
key: 'partNumber',
101-
label: this.$t('pageHardwareStatus.table.partNumber'),
149+
key: 'locationNumber',
150+
label: this.$t('pageHardwareStatus.table.locationNumber'),
102151
formatter: this.tableFormatter,
103152
},
104153
{
105-
key: 'serialNumber',
106-
label: this.$t('pageHardwareStatus.table.serialNumber'),
154+
key: 'identifyLed',
155+
label: this.$t('pageHardwareStatus.table.identifyLed'),
107156
formatter: this.tableFormatter,
108157
},
109158
],
@@ -121,5 +170,19 @@ export default {
121170
this.$root.$emit('hardware-status-chassis-complete');
122171
});
123172
},
173+
methods: {
174+
toggleIdentifyLedValue(row) {
175+
this.$store
176+
.dispatch('chassis/updateIdentifyLedValue', {
177+
uri: row.uri,
178+
identifyLed: row.identifyLed,
179+
})
180+
.catch(({ message }) => this.errorToast(message));
181+
},
182+
// TO DO: Remove this method when the LocationIndicatorActive is added from backend.
183+
hasIdentifyLed(identifyLed) {
184+
return typeof identifyLed === 'boolean';
185+
},
186+
},
124187
};
125188
</script>

0 commit comments

Comments
 (0)