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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 22 additions & 11 deletions
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

Lines changed: 8 additions & 1 deletion
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

Lines changed: 8 additions & 1 deletion
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

Lines changed: 22 additions & 11 deletions
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

Lines changed: 22 additions & 11 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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:

0 commit comments

Comments
 (0)