diff options
author | Nikhil Ashoka <a.nikhil@ibm.com> | 2022-01-27 16:40:31 +0300 |
---|---|---|
committer | Dixsie Wolmers <dixsiew@gmail.com> | 2022-02-04 17:20:44 +0300 |
commit | aee27141f4c002306e9a4bf44dc4f9618a5fae62 (patch) | |
tree | 7e1b6e1549a128d789ad0c24423ec013da1a7e4e /src/store | |
parent | 18cde3ce0c1b2f99e94f5cef66661adcb22ba8f7 (diff) | |
download | webui-vue-aee27141f4c002306e9a4bf44dc4f9618a5fae62.tar.xz |
Security Panel add additional features
Added RTAD under Network interfaces
Added VirtualTPM under Network services
Removed the sub-headings in Policies page
Signed-off-by: Nikhil Ashoka <a.nikhil@ibm.com>
Change-Id: I6290362cecdfe7f8cd7bfde20fcaca88b6bc2c09
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/SecurityAndAccess/PoliciesStore.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/store/modules/SecurityAndAccess/PoliciesStore.js b/src/store/modules/SecurityAndAccess/PoliciesStore.js index 1e195527..64bd3369 100644 --- a/src/store/modules/SecurityAndAccess/PoliciesStore.js +++ b/src/store/modules/SecurityAndAccess/PoliciesStore.js @@ -6,16 +6,22 @@ const PoliciesStore = { state: { sshProtocolEnabled: false, ipmiProtocolEnabled: false, + rtadEnabled: 'Disabled', + vtpmEnabled: 'Disabled', }, getters: { sshProtocolEnabled: (state) => state.sshProtocolEnabled, ipmiProtocolEnabled: (state) => state.ipmiProtocolEnabled, + rtadEnabled: (state) => state.rtadEnabled, + vtpmEnabled: (state) => state.vtpmEnabled, }, mutations: { setSshProtocolEnabled: (state, sshProtocolEnabled) => (state.sshProtocolEnabled = sshProtocolEnabled), setIpmiProtocolEnabled: (state, ipmiProtocolEnabled) => (state.ipmiProtocolEnabled = ipmiProtocolEnabled), + setRtadEnabled: (state, rtadEnabled) => (state.rtadEnabled = rtadEnabled), + setVtpmEnabled: (state, vtpmEnabled) => (state.vtpmEnabled = vtpmEnabled), }, actions: { async getNetworkProtocolStatus({ commit }) { @@ -29,6 +35,15 @@ const PoliciesStore = { }) .catch((error) => console.log(error)); }, + async getBiosStatus({ commit }) { + return await api + .get('/redfish/v1/Systems/system/Bios') + .then((response) => { + commit('setRtadEnabled', response.data.Attributes.pvm_rtad); + commit('setVtpmEnabled', response.data.Attributes.pvm_vtpm); + }) + .catch((error) => console.log(error)); + }, async saveIpmiProtocolState({ commit }, protocolEnabled) { commit('setIpmiProtocolEnabled', protocolEnabled); const ipmi = { @@ -81,6 +96,54 @@ const PoliciesStore = { } }); }, + async saveRtadState({ commit }, updatedRtad) { + commit('setRtadEnabled', updatedRtad); + return await api + .patch('/redfish/v1/Systems/system/Bios/Settings', { + Attributes: { + pvm_rtad: updatedRtad, + }, + }) + .then(() => { + if (updatedRtad === 'Enabled') { + return i18n.t('pagePolicies.toast.successRtadEnabled'); + } else { + return i18n.t('pagePolicies.toast.successRtadDisabled'); + } + }) + .catch((error) => { + console.log(error); + if (updatedRtad === 'Enabled') { + throw new Error(i18n.t('pagePolicies.toast.errorRtadEnabled')); + } else { + throw new Error(i18n.t('pagePolicies.toast.errorRtadDisabled')); + } + }); + }, + async saveVtpmState({ commit }, updatedVtpm) { + commit('setVtpmEnabled', updatedVtpm); + return await api + .patch('/redfish/v1/Systems/system/Bios/Settings', { + Attributes: { + pvm_vtpm: updatedVtpm, + }, + }) + .then(() => { + if (updatedVtpm === 'Enabled') { + return i18n.t('pagePolicies.toast.successVtpmEnabled'); + } else { + return i18n.t('pagePolicies.toast.successVtpmDisabled'); + } + }) + .catch((error) => { + console.log(error); + if (updatedVtpm === 'Enabled') { + throw new Error(i18n.t('pagePolicies.toast.errorVtpmEnabled')); + } else { + throw new Error(i18n.t('pagePolicies.toast.errorVtpmDisabled')); + } + }); + }, }, }; |