diff options
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/SecurityAndAccess/PoliciesStore.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/store/modules/SecurityAndAccess/PoliciesStore.js b/src/store/modules/SecurityAndAccess/PoliciesStore.js index 64bd3369..e6bcfb96 100644 --- a/src/store/modules/SecurityAndAccess/PoliciesStore.js +++ b/src/store/modules/SecurityAndAccess/PoliciesStore.js @@ -8,12 +8,14 @@ const PoliciesStore = { ipmiProtocolEnabled: false, rtadEnabled: 'Disabled', vtpmEnabled: 'Disabled', + sessionTimeoutValue: null, }, getters: { sshProtocolEnabled: (state) => state.sshProtocolEnabled, ipmiProtocolEnabled: (state) => state.ipmiProtocolEnabled, rtadEnabled: (state) => state.rtadEnabled, vtpmEnabled: (state) => state.vtpmEnabled, + getSessionTimeoutValue: (state) => state.sessionTimeoutValue, }, mutations: { setSshProtocolEnabled: (state, sshProtocolEnabled) => @@ -22,6 +24,9 @@ const PoliciesStore = { (state.ipmiProtocolEnabled = ipmiProtocolEnabled), setRtadEnabled: (state, rtadEnabled) => (state.rtadEnabled = rtadEnabled), setVtpmEnabled: (state, vtpmEnabled) => (state.vtpmEnabled = vtpmEnabled), + setSessionTimeoutValue(state, sessionTimeoutValue) { + state.sessionTimeoutValue = sessionTimeoutValue; + }, }, actions: { async getNetworkProtocolStatus({ commit }) { @@ -44,6 +49,15 @@ const PoliciesStore = { }) .catch((error) => console.log(error)); }, + async getSessionTimeout({ commit }) { + return await api + .get('/redfish/v1/SessionService') + .then((response) => { + const sessionTimeoutValue = response.data.SessionTimeout; + commit('setSessionTimeoutValue', sessionTimeoutValue); + }) + .catch((error) => console.log(error)); + }, async saveIpmiProtocolState({ commit }, protocolEnabled) { commit('setIpmiProtocolEnabled', protocolEnabled); const ipmi = { @@ -144,6 +158,21 @@ const PoliciesStore = { } }); }, + async saveSessionTimeoutValue({ dispatch }, sessionTimeoutNewValue) { + const sessionValue = { + SessionTimeout: sessionTimeoutNewValue, + }; + return await api + .patch('/redfish/v1/SessionService', sessionValue) + .then(() => dispatch('getSessionTimeout')) + .then(() => { + return i18n.t('pagePolicies.toast.successSessionTimeout'); + }) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pagePolicies.toast.errorSessionTimeout')); + }); + }, }, }; |