Closed KVM new window after WEBUI logged out
Description:
When KVM is opened in new window, after WEB UI is logged out,
opened KVM window is not getting closed. It remains opened and
accessible.
Root Cause:
There is not handle to close the KVM new window after the WEB UI
logged out.
Fix:
Added the KVM window opened information in store, and checked that
information to close the window.
Tested:
Step 1: Login to WEB UI
Step 2: Navigate to Operations -> KVM
Step 3: Open KVM in new window
Step 4: Click Logout in WEB UI
Result:
After successful log out, KVM new window is closed as expected.
Change-Id: Iab8e54d3088a08fb0ae9b581b2647fc0ab5460bd
Signed-off-by: Kirankumar Ballapalli <kirankumarb@ami.com>
diff --git a/src/store/modules/Authentication/AuthenticanStore.js b/src/store/modules/Authentication/AuthenticanStore.js
index 07d5ee8..88fb54b 100644
--- a/src/store/modules/Authentication/AuthenticanStore.js
+++ b/src/store/modules/Authentication/AuthenticanStore.js
@@ -5,11 +5,13 @@
const AuthenticationStore = {
namespaced: true,
state: {
+ consoleWindow: null,
authError: false,
xsrfCookie: Cookies.get('XSRF-TOKEN'),
isAuthenticatedCookie: Cookies.get('IsAuthenticated'),
},
getters: {
+ consoleWindow: (state) => state.consoleWindow,
authError: (state) => state.authError,
isLoggedIn: (state) => {
return (
@@ -33,6 +35,7 @@
state.xsrfCookie = undefined;
state.isAuthenticatedCookie = undefined;
},
+ setConsoleWindow: (state, window) => (state.consoleWindow = window),
},
actions: {
login({ commit }, { username, password }) {
@@ -48,7 +51,10 @@
logout({ commit }) {
api
.post('/logout', { data: [] })
- .then(() => commit('logout'))
+ .then(() => {
+ commit('setConsoleWindow', false);
+ commit('logout');
+ })
.then(() => router.go('/login'))
.catch((error) => console.log(error));
},