Skip to content

Commit f11a190

Browse files
Nikhil-Ashokasivaprabug
authored andcommitted
Added toast notification for identify LEDs
- Added success toast notification messages for identify LEDs present at Inventory and LEDs page and Overview. - Import of Toast was not present in Overview's Inventory card and DIMM slot table, fixed it. Signed-off-by: Nikhil Ashoka <[email protected]> Change-Id: If9ad84e66f6f15616cb8af51b1e84d8d06b1afd0
1 parent 0736813 commit f11a190

15 files changed

+104
-36
lines changed

src/locales/en-US.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,9 @@
452452
},
453453
"toast": {
454454
"errorDisableIdentifyLed": "Error disabling Identify LED.",
455-
"errorEnableIdentifyLed": "Error enabling Identify LED."
455+
"errorEnableIdentifyLed": "Error enabling Identify LED.",
456+
"successDisableIdentifyLed": "Successfully disabled Identify LED.",
457+
"successEnableIdentifyLed": "Successfully enabled Identify LED."
456458
}
457459
},
458460
"pageKeyClear": {

src/store/modules/HardwareStatus/AssemblyStore.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,28 @@ const AssemblyStore = {
5454
],
5555
};
5656

57-
return await api.patch(uri, updatedIdentifyLedValue).catch((error) => {
58-
dispatch('getAssemblyInfo');
59-
console.log('error', error);
60-
if (led.identifyLed) {
61-
throw new Error(i18n.t('pageInventory.toast.errorEnableIdentifyLed'));
62-
} else {
63-
throw new Error(
64-
i18n.t('pageInventory.toast.errorDisableIdentifyLed'),
65-
);
66-
}
67-
});
57+
return await api
58+
.patch(uri, updatedIdentifyLedValue)
59+
.then(() => {
60+
if (led.identifyLed) {
61+
return i18n.t('pageInventory.toast.successEnableIdentifyLed');
62+
} else {
63+
return i18n.t('pageInventory.toast.successDisableIdentifyLed');
64+
}
65+
})
66+
.catch((error) => {
67+
dispatch('getAssemblyInfo');
68+
console.log('error', error);
69+
if (led.identifyLed) {
70+
throw new Error(
71+
i18n.t('pageInventory.toast.errorEnableIdentifyLed'),
72+
);
73+
} else {
74+
throw new Error(
75+
i18n.t('pageInventory.toast.errorDisableIdentifyLed'),
76+
);
77+
}
78+
});
6879
},
6980
},
7081
};

src/store/modules/HardwareStatus/BmcStore.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ const BmcStore = {
5858
};
5959
return await api
6060
.patch(uri, updatedIdentifyLedValue)
61-
.then(() => dispatch('getBmcInfo'))
61+
.then(() => {
62+
dispatch('getBmcInfo');
63+
if (led.identifyLed) {
64+
return i18n.t('pageInventory.toast.successEnableIdentifyLed');
65+
} else {
66+
return i18n.t('pageInventory.toast.successDisableIdentifyLed');
67+
}
68+
})
6269
.catch((error) => {
6370
dispatch('getBmcInfo');
6471
console.log('error', error);

src/store/modules/HardwareStatus/ChassisStore.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ const ChassisStore = {
7272
};
7373
return await api
7474
.patch(uri, updatedIdentifyLedValue)
75-
.then(() => dispatch('getChassisInfo'))
75+
.then(() => {
76+
dispatch('getChassisInfo');
77+
if (led.identifyLed) {
78+
return i18n.t('pageInventory.toast.successEnableIdentifyLed');
79+
} else {
80+
return i18n.t('pageInventory.toast.successDisableIdentifyLed');
81+
}
82+
})
7683
.catch((error) => {
7784
dispatch('getChassisInfo');
7885
console.log('error', error);

src/store/modules/HardwareStatus/MemoryStore.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,28 @@ const MemoryStore = {
7373
const updatedIdentifyLedValue = {
7474
LocationIndicatorActive: led.identifyLed,
7575
};
76-
return await api.patch(uri, updatedIdentifyLedValue).catch((error) => {
77-
dispatch('getDimms');
78-
console.log('error', error);
79-
if (led.identifyLed) {
80-
throw new Error(i18n.t('pageInventory.toast.errorEnableIdentifyLed'));
81-
} else {
82-
throw new Error(
83-
i18n.t('pageInventory.toast.errorDisableIdentifyLed'),
84-
);
85-
}
86-
});
76+
return await api
77+
.patch(uri, updatedIdentifyLedValue)
78+
.then(() => {
79+
if (led.identifyLed) {
80+
return i18n.t('pageInventory.toast.successEnableIdentifyLed');
81+
} else {
82+
return i18n.t('pageInventory.toast.successDisableIdentifyLed');
83+
}
84+
})
85+
.catch((error) => {
86+
dispatch('getDimms');
87+
console.log('error', error);
88+
if (led.identifyLed) {
89+
throw new Error(
90+
i18n.t('pageInventory.toast.errorEnableIdentifyLed'),
91+
);
92+
} else {
93+
throw new Error(
94+
i18n.t('pageInventory.toast.errorDisableIdentifyLed'),
95+
);
96+
}
97+
});
8798
},
8899
},
89100
};

src/store/modules/HardwareStatus/ProcessorStore.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,28 @@ const ProcessorStore = {
8181
const updatedIdentifyLedValue = {
8282
LocationIndicatorActive: led.identifyLed,
8383
};
84-
return await api.patch(uri, updatedIdentifyLedValue).catch((error) => {
85-
dispatch('getProcessorsInfo');
86-
console.log('error', error);
87-
if (led.identifyLed) {
88-
throw new Error(i18n.t('pageInventory.toast.errorEnableIdentifyLed'));
89-
} else {
90-
throw new Error(
91-
i18n.t('pageInventory.toast.errorDisableIdentifyLed'),
92-
);
93-
}
94-
});
84+
return await api
85+
.patch(uri, updatedIdentifyLedValue)
86+
.then(() => {
87+
if (led.identifyLed) {
88+
return i18n.t('pageInventory.toast.successEnableIdentifyLed');
89+
} else {
90+
return i18n.t('pageInventory.toast.successDisableIdentifyLed');
91+
}
92+
})
93+
.catch((error) => {
94+
dispatch('getProcessorsInfo');
95+
console.log('error', error);
96+
if (led.identifyLed) {
97+
throw new Error(
98+
i18n.t('pageInventory.toast.errorEnableIdentifyLed'),
99+
);
100+
} else {
101+
throw new Error(
102+
i18n.t('pageInventory.toast.errorDisableIdentifyLed'),
103+
);
104+
}
105+
});
95106
},
96107
},
97108
};

src/store/modules/HardwareStatus/SystemStore.js

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ const SystemStore = {
4949
.patch('/redfish/v1/Systems/system', {
5050
LocationIndicatorActive: ledState,
5151
})
52+
.then(() => {
53+
if (ledState) {
54+
return i18n.t('pageInventory.toast.successEnableIdentifyLed');
55+
} else {
56+
return i18n.t('pageInventory.toast.successDisableIdentifyLed');
57+
}
58+
})
5259
.catch((error) => {
5360
commit('setSystemInfo', this.state.system.systems[0]);
5461
console.log('error', error);

src/views/HardwareStatus/Inventory/InventoryServiceIndicator.vue

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export default {
6969
toggleIdentifyLedSwitch(state) {
7070
this.$store
7171
.dispatch('system/changeIdentifyLedState', state)
72+
.then((message) => this.successToast(message))
7273
.catch(({ message }) => this.errorToast(message));
7374
},
7475
},

src/views/HardwareStatus/Inventory/InventoryTableAssembly.vue

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export default {
143143
memberId: row.id,
144144
identifyLed: row.identifyLed,
145145
})
146+
.then((message) => this.successToast(message))
146147
.catch(({ message }) => this.errorToast(message));
147148
},
148149
hasIdentifyLed(identifyLed) {

src/views/HardwareStatus/Inventory/InventoryTableBmcManager.vue

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ export default {
233233
uri: row.uri,
234234
identifyLed: row.identifyLed,
235235
})
236+
.then((message) => this.successToast(message))
236237
.catch(({ message }) => this.errorToast(message));
237238
},
238239
// TO DO: remove hasIdentifyLed method once the following story is merged:

src/views/HardwareStatus/Inventory/InventoryTableChassis.vue

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export default {
186186
uri: row.uri,
187187
identifyLed: row.identifyLed,
188188
})
189+
.then((message) => this.successToast(message))
189190
.catch(({ message }) => this.errorToast(message));
190191
},
191192
// TO DO: Remove this method when the LocationIndicatorActive is added from backend.

src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue

+3
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
193193
import StatusIcon from '@/components/Global/StatusIcon';
194194
import TableCellCount from '@/components/Global/TableCellCount';
195195
196+
import BVToastMixin from '@/components/Mixins/BVToastMixin';
196197
import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
197198
import TableSortMixin from '@/components/Mixins/TableSortMixin';
198199
import Search from '@/components/Global/Search';
@@ -206,6 +207,7 @@ import TableRowExpandMixin, {
206207
export default {
207208
components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount },
208209
mixins: [
210+
BVToastMixin,
209211
TableRowExpandMixin,
210212
DataFormatterMixin,
211213
TableSortMixin,
@@ -287,6 +289,7 @@ export default {
287289
uri: row.uri,
288290
identifyLed: row.identifyLed,
289291
})
292+
.then((message) => this.successToast(message))
290293
.catch(({ message }) => this.errorToast(message));
291294
},
292295
hasIdentifyLed(identifyLed) {

src/views/HardwareStatus/Inventory/InventoryTableProcessors.vue

+1
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export default {
257257
uri: row.uri,
258258
identifyLed: row.identifyLed,
259259
})
260+
.then((message) => this.successToast(message))
260261
.catch(({ message }) => this.errorToast(message));
261262
},
262263
// TO DO: remove hasIdentifyLed when the following is merged:

src/views/HardwareStatus/Inventory/InventoryTableSystem.vue

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export default {
202202
toggleIdentifyLedSwitch(state) {
203203
this.$store
204204
.dispatch('system/changeIdentifyLedState', state)
205+
.then((message) => this.successToast(message))
205206
.catch(({ message }) => this.errorToast(message));
206207
},
207208
},

src/views/Overview/OverviewInventory.vue

+3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929

3030
<script>
3131
import OverviewCard from './OverviewCard';
32+
import BVToastMixin from '@/components/Mixins/BVToastMixin';
3233
3334
export default {
3435
name: 'Inventory',
3536
components: {
3637
OverviewCard,
3738
},
39+
mixins: [BVToastMixin],
3840
computed: {
3941
systems() {
4042
let systemData = this.$store.getters['system/systems'][0];
@@ -50,6 +52,7 @@ export default {
5052
toggleIdentifyLedSwitch(state) {
5153
this.$store
5254
.dispatch('system/changeIdentifyLedState', state)
55+
.then((message) => this.successToast(message))
5356
.catch(({ message }) => this.errorToast(message));
5457
},
5558
},

0 commit comments

Comments
 (0)