Skip to content

Commit

Permalink
Merge branch '1110' of github.com:ibm-openbmc/webui-vue into 1110
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwari-nishant committed Oct 22, 2024
2 parents b1598ce + 6fb1086 commit a51ba17
Show file tree
Hide file tree
Showing 17 changed files with 388 additions and 108 deletions.
6 changes: 6 additions & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@
"errorStartResourceDumpInvalidSelector": "Error initiating dump. Invalid resource selector.",
"errorStartResourceDumpInvalidPassword": "Error initiating dump. Invalid password.",
"errorStartSystemDump": "Error starting new System dump.",
"resourceDumpSuccess": "Resource Dump created successfully.",
"resourceDumpFailed": "Resource Dump creation failed.",
"successDeleteDump": "Successfully deleted %{count} dump. | Successfully deleted %{count} dumps.",
"successStartBmcDumpTitle": "BMC dump started",
"successStartDump": "The dump will take some time to complete.",
Expand Down Expand Up @@ -1135,6 +1137,8 @@
"logicalMemorySizeHeading": "Logical memory block size is used for partitioning. Changing the logical memory block size impacts system resource management.",
"maxNumHugePages": "Max number huge pages",
"memoryBlockSize": "Memory block size",
"predictiveDynamicMemoryDeallocationTitle": "Predictive dynamic memory deallocation",
"predictiveDynamicMemoryDeallocationDescription": "The Hypervisor dynamically removes memory pages from memory that detected predictive failures. If this option is disabled, dynamic memory deallocation will not occur for the predictive memory failures.",
"requestedHugePageMemory": "Requested huge page memory",
"slotCountForNode0": "Slot Count for Node 0",
"systemMemoryPageSetup": "Improve the application's performance by setting large virtual memory page sizes of 16GB each.",
Expand All @@ -1157,13 +1161,15 @@
},
"toast": {
"errorSavingActiveMemoryMirroringMode": "Error updating active memory mirroring mode",
"errorSavingPredictiveDynamicMemoryDeallocation": "Error updating predictive dynamic memory deallocation",
"errorSavingAdapterEnlargedCapacity": "Error updating I/O adapter enlarged capacity",
"errorSavingLogicalMemory": "Error updating logical memory block size ",
"errorSavingPageSetup": "Error updating system memory page setup",
"message": "System must be powered off to make changes",
"successSavingAdapterEnlargedCapacity": "Successfully updated I/O adapter enlarged capacity",
"successSavingLogicalMemory": "Successfully updated logical memory block size",
"successSavingActiveMemoryMirroringMode": "Successfully updated active memory mirroring mode",
"successSavingPredictiveDynamicMemoryDeallocation": "Successfully updated predictive dynamic memory deallocation",
"successSavingPageSetup": "Successfully updated system memory page setup",
"successSavingAdapterDynamicCapacity": "Successfully updated I/O adapter drawer attachment",
"errorSavingAdapterDynamicCapacity": "Error updating dynamic I/O adapter drawer attachment"
Expand Down
28 changes: 20 additions & 8 deletions src/store/modules/Logs/DumpsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const DumpsStore = {
},
},
actions: {
async getTask() {
return await api.get('/redfish/v1/TaskService/Tasks');
},
async getBmcDumpEntries() {
return api
.get('/redfish/v1/')
Expand Down Expand Up @@ -64,16 +67,25 @@ const DumpsStore = {
)
.catch((error) => {
console.log(error);
const messageId =
const errorMsg =
error.response.data.error?.['@Message.ExtendedInfo'][0].MessageId;

const message = REGEX_MAPPINGS.resourceInStandby.test(messageId)
? i18n.t('pageDumps.toast.errorStartDumpAnotherInProgress', {
dump: dumpType,
})
: i18n.t('pageDumps.toast.errorStartBmcDump');

throw new Error(message);
switch (true) {
case REGEX_MAPPINGS.resourceInUse.test(errorMsg):
throw new Error(
i18n.t('pageDumps.toast.errorStartDumpAnotherInProgress', {
dump: dumpType,
})
);
case REGEX_MAPPINGS.resourceInStandby.test(errorMsg):
throw new Error(
i18n.t('pageDumps.toast.errorStartDumpResourceInStandby', {
dump: dumpType,
})
);
default:
throw new Error(i18n.t('pageDumps.toast.errorStartSystemDump'));
}
});
},
async createResourceDump(_, { resourceSelector, resourcePassword }) {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/Logs/IBMiServiceFunctionsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const IBMiServiceFunctionsStore = {
async executeServiceFunction({ dispatch }, value) {
return await api
.post(
'/redfish/v1/Systems/system/Actions/Oem/OemComputerSystem.ExecutePanelFunction',
'/redfish/v1/Systems/system/Actions/Oem/IBM/IBMComputerSystem.ExecutePanelFunction',
{ FuncNo: value }
)
.then(() => {
Expand Down
66 changes: 40 additions & 26 deletions src/store/modules/Operations/ControlStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const ControlStore = {
isOperationInProgress: false,
lastPowerOperationTime: null,
lastBmcRebootTime: null,
displayInfoToast: false,
},
getters: {
isOperationInProgress: (state) => state.isOperationInProgress,
lastPowerOperationTime: (state) => state.lastPowerOperationTime,
lastBmcRebootTime: (state) => state.lastBmcRebootTime,
displayInfoToast: (state) => state.displayInfoToast,
},
mutations: {
setOperationInProgress: (state, inProgress) =>
Expand All @@ -47,6 +49,8 @@ const ControlStore = {
(state.lastPowerOperationTime = lastPowerOperationTime),
setLastBmcRebootTime: (state, lastBmcRebootTime) =>
(state.lastBmcRebootTime = lastBmcRebootTime),
setDisplayInfoToast: (state, displayInfoToast) =>
(state.displayInfoToast = displayInfoToast),
},
actions: {
async getLastPowerOperationTime({ commit }) {
Expand Down Expand Up @@ -82,47 +86,57 @@ const ControlStore = {
throw new Error(i18n.t('pageRebootBmc.toast.errorRebootStart'));
});
},
async serverPowerOn({ dispatch, commit }) {
const data = { ResetType: 'On' };
dispatch('serverPowerChange', data);
await checkForServerStatus.bind(this, 'on')();
async powerOps({ dispatch, commit }, { thisVal, value }) {
await checkForServerStatus.bind(thisVal, value)();
commit('setOperationInProgress', false);
dispatch('getLastPowerOperationTime');
},
async serverSoftReboot({ dispatch, commit }) {
async serverPowerOn({ dispatch }) {
const value = 'on';
const data = { ResetType: 'On' };
const displayInfo = await dispatch('serverPowerChange', data);
dispatch('powerOps', { thisVal: this, value });
return Promise.resolve(displayInfo);
},
async serverSoftReboot({ dispatch }) {
const value = 'on';
const data = { ResetType: 'GracefulRestart' };
dispatch('serverPowerChange', data);
await checkForServerStatus.bind(this, 'on')();
commit('setOperationInProgress', false);
dispatch('getLastPowerOperationTime');
const displayInfo = await dispatch('serverPowerChange', data);
dispatch('powerOps', { thisVal: this, value });
return Promise.resolve(displayInfo);
},
async serverHardReboot({ dispatch, commit }) {
async serverHardReboot({ dispatch }) {
const value = 'on';
const data = { ResetType: 'ForceRestart' };
dispatch('serverPowerChange', data);
await checkForServerStatus.bind(this, 'on')();
commit('setOperationInProgress', false);
dispatch('getLastPowerOperationTime');
const displayInfo = await dispatch('serverPowerChange', data);
dispatch('powerOps', { thisVal: this, value });
return Promise.resolve(displayInfo);
},
async serverSoftPowerOff({ dispatch, commit }) {
async serverSoftPowerOff({ dispatch }) {
const value = 'off';
const data = { ResetType: 'GracefulShutdown' };
dispatch('serverPowerChange', data);
await checkForServerStatus.bind(this, 'off')();
commit('setOperationInProgress', false);
dispatch('getLastPowerOperationTime');
const displayInfo = await dispatch('serverPowerChange', data);
dispatch('powerOps', { thisVal: this, value });
return Promise.resolve(displayInfo);
},
async serverHardPowerOff({ dispatch, commit }) {
async serverHardPowerOff({ dispatch }) {
const value = 'off';
const data = { ResetType: 'ForceOff' };
dispatch('serverPowerChange', data);
await checkForServerStatus.bind(this, 'off')();
commit('setOperationInProgress', false);
dispatch('getLastPowerOperationTime');
const displayInfo = await dispatch('serverPowerChange', data);
dispatch('powerOps', { thisVal: this, value });
return Promise.resolve(displayInfo);
},
serverPowerChange({ commit }, data) {
serverPowerChange({ commit, state }, data) {
commit('setOperationInProgress', true);
api
return api
.post('/redfish/v1/Systems/system/Actions/ComputerSystem.Reset', data)
.then(() => {
state.displayInfoToast = true;
return state.displayInfoToast;
})
.catch((error) => {
console.log(error);
state.displayInfoToast = false;
commit('setOperationInProgress', false);
});
},
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/Operations/FirmwareStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const FirmwareStore = {
await dispatch('setApplyTimeImmediate');
}
return await api
.post('/redfish/v1/UpdateService', image, {
.post('/redfish/v1/UpdateService/update', image, {
headers: { 'Content-Type': 'application/octet-stream' },
})
.catch((error) => {
Expand Down
69 changes: 69 additions & 0 deletions src/store/modules/ResourceManagement/ResourceMemoryStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ResourceMemoryStore = {
numHugePages: null,
hmcManaged: null,
memoryMirroringMode: null,
predictiveDynamicMemoryDeallocation: null,
},
getters: {
logicalMemorySizeOptions: (state) => state.logicalMemorySizeOptions,
Expand All @@ -25,6 +26,8 @@ const ResourceMemoryStore = {
numHugePages: (state) => state.numHugePages,
hmcManaged: (state) => state.hmcManaged,
memoryMirroringMode: (state) => state.memoryMirroringMode,
predictiveDynamicMemoryDeallocation: (state) =>
state.predictiveDynamicMemoryDeallocation,
},
mutations: {
setLogicalMemorySizeOptions: (state, logicalMemorySizeOptions) =>
Expand All @@ -47,6 +50,11 @@ const ResourceMemoryStore = {
setHmcManaged: (state, hmcManaged) => (state.hmcManaged = hmcManaged),
setMemoryMirroringMode: (state, memoryMirroringMode) =>
(state.memoryMirroringMode = memoryMirroringMode),
setPredictiveDynamicMemoryDeallocation: (
state,
predictiveDynamicMemoryDeallocation
) =>
(state.predictiveDynamicMemoryDeallocation = predictiveDynamicMemoryDeallocation),
},
actions: {
async getMemorySizeOptions({ commit }) {
Expand Down Expand Up @@ -204,6 +212,67 @@ const ResourceMemoryStore = {
);
});
},
async getPredictiveDynamicMemoryDeallocation({ commit }) {
return await api
.get(
'/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry'
)
.then(({ data: { RegistryEntries } }) => {
const predictiveDynamicMemoryDeallocation = RegistryEntries.Attributes.filter(
(Attribute) => Attribute.AttributeName == 'hb_predictive_mem_guard'
);
if (predictiveDynamicMemoryDeallocation.length > 0) {
let predictiveDynamicMemoryDeallocationValue =
predictiveDynamicMemoryDeallocation[0].CurrentValue;
let predictiveMemValue =
predictiveDynamicMemoryDeallocationValue == 'Enabled'
? true
: false;
commit(
'setPredictiveDynamicMemoryDeallocation',
predictiveMemValue
);
}
})
.catch((error) => console.log(error));
},
async savePredictiveDynamicMemoryDeallocation(
{ commit },
activePredictiveDynamicMemoryDeallocationValue
) {
let updatedMirroringModeValue = activePredictiveDynamicMemoryDeallocationValue
? 'Enabled'
: 'Disabled';
commit(
'setPredictiveDynamicMemoryDeallocation',
activePredictiveDynamicMemoryDeallocationValue
);
const updatedPredictiveDynamicMemoryDeallocation = {
Attributes: { hb_predictive_mem_guard: updatedMirroringModeValue },
};
return api
.patch(
'/redfish/v1/Systems/system/Bios/Settings',
updatedPredictiveDynamicMemoryDeallocation
)
.then(() => {
return i18n.t(
'pageMemory.toast.successSavingPredictiveDynamicMemoryDeallocation'
);
})
.catch((error) => {
console.log(error);
commit(
'setPredictiveDynamicMemoryDeallocation',
!activePredictiveDynamicMemoryDeallocationValue
);
throw new Error(
i18n.t(
'pageMemory.toast.errorSavingPredictiveDynamicMemoryDeallocation'
)
);
});
},
async savePageSetup({ commit }) {
const updatedNumHugePages = {
Attributes: {
Expand Down
45 changes: 27 additions & 18 deletions src/store/modules/Settings/PowerPolicyStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,36 @@ const PowerPolicyStore = {
actions: {
async getPowerRestorePolicies({ commit }) {
return await api
.get('/redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.json')
.then(
({
data: {
definitions: { PowerRestorePolicyTypes = {} },
},
}) => {
let powerPoliciesData = PowerRestorePolicyTypes.enum.map(
(powerState) => {
let desc = `${i18n.t(
`pagePowerRestorePolicy.policies.${powerState}`
)} - ${PowerRestorePolicyTypes.enumDescriptions[powerState]}`;
return {
state: powerState,
desc,
};
.get('/redfish/v1/JsonSchemas/ComputerSystem')
.then(async (response) => {
if (
response.data?.Location.length > 0 &&
response.data?.Location[0].Uri
) {
return await api.get(response.data?.Location[0].Uri).then(
({
data: {
definitions: { PowerRestorePolicyTypes = {} },
},
}) => {
let powerPoliciesData = PowerRestorePolicyTypes.enum.map(
(powerState) => {
let desc = `${i18n.t(
`pagePowerRestorePolicy.policies.${powerState}`
)} - ${
PowerRestorePolicyTypes.enumDescriptions[powerState]
}`;
return {
state: powerState,
desc,
};
}
);
commit('setPowerRestorePolicies', powerPoliciesData);
}
);
commit('setPowerRestorePolicies', powerPoliciesData);
}
);
});
},
async getPowerRestoreCurrentPolicy({ commit }) {
return await api
Expand Down
Loading

0 comments on commit a51ba17

Please sign in to comment.