[PATCH 0/3] Issue 294 The auto logout leaves action menu on page

When the user session ends, content that should no longer be visible to the unauthenticated user is left in the DOM. The issue as written notes that the guest action menu is displayed above the login window, leading to a buggy user experience. Information about the users guests, storage pools, networks, etc may also be left visible in the browser. Adam King (3): Fix formatting of the requestJSON function Issue 294 The auto logout leaves action menu on page - add classes Issue 294 The auto logout leaves action menu on page - update JS ui/js/src/kimchi.api.js | 2 +- ui/js/src/kimchi.login_window.js | 3 +++ ui/js/src/kimchi.main.js | 2 ++ ui/js/src/kimchi.network.js | 2 +- ui/js/src/kimchi.window.js | 2 +- ui/pages/kimchi-ui.html.tmpl | 2 +- ui/pages/tabs/guests.html.tmpl | 2 +- ui/pages/tabs/host.html.tmpl | 2 +- ui/pages/tabs/network.html.tmpl | 4 ++-- ui/pages/tabs/storage.html.tmpl | 2 +- ui/pages/tabs/templates.html.tmpl | 2 +- 11 files changed, 15 insertions(+), 10 deletions(-) -- 1.8.1.4

Fix formatting of the requestJSON function to match the other functions defined in kimchi.api.js. Signed-off-by: Adam King <rak@linux.vnet.ibm.com> --- ui/js/src/kimchi.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index c93426f..89e7487 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -37,7 +37,7 @@ var kimchi = { * user clicking the tab again. * Default to false. */ - requestJSON: function(settings) { + requestJSON : function(settings) { settings['originalError'] = settings['error']; settings['error'] = null; settings['kimchi'] = true; -- 1.8.1.4

Reviewed-by: Crístian Viana <vianac@linux.vnet.ibm.com> Am 10-03-2014 13:21, schrieb Adam King:
Fix formatting of the requestJSON function to match the other functions defined in kimchi.api.js.
Signed-off-by: Adam King <rak@linux.vnet.ibm.com>

When the user session ends, content that should no longer be visible to the unauthenticated user is left in the DOM. The issue as written notes that the guest action menu is displayed above the login window, leading to a buggy user experience. Information about the users guests, storage pools, networks, etc may also be left visible in the browser. This patch uses classes remove-when-logged-off and empty-when-logged-off to mark those parts of the DOM that should no longer be available to the user after the session has ended. Signed-off-by: Adam King <rak@linux.vnet.ibm.com> --- ui/js/src/kimchi.window.js | 2 +- ui/pages/kimchi-ui.html.tmpl | 2 +- ui/pages/tabs/guests.html.tmpl | 2 +- ui/pages/tabs/host.html.tmpl | 2 +- ui/pages/tabs/network.html.tmpl | 2 +- ui/pages/tabs/storage.html.tmpl | 2 +- ui/pages/tabs/templates.html.tmpl | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/js/src/kimchi.window.js b/ui/js/src/kimchi.window.js index c2af63e..29bd6e1 100644 --- a/ui/js/src/kimchi.window.js +++ b/ui/js/src/kimchi.window.js @@ -33,7 +33,7 @@ kimchi.window = (function() { _listeners[windowID] = settings['close']; var windowNode = $('<div></div>', { id: windowID, - 'class': settings['class'] ? settings['class'] + ' bgmask' : 'bgmask' + 'class': settings['class'] ? settings['class'] + ' bgmask remove-when-logged-off' : 'bgmask remove-when-logged-off' }); $(windowNode).css(settings['style'] || ''); diff --git a/ui/pages/kimchi-ui.html.tmpl b/ui/pages/kimchi-ui.html.tmpl index abc67c3..eb3cd9d 100644 --- a/ui/pages/kimchi-ui.html.tmpl +++ b/ui/pages/kimchi-ui.html.tmpl @@ -72,7 +72,7 @@ <li> <div id="user" class="popable"> <span id="user-icon"></span> - <span id="user-name"></span> + <span id="user-name" class="empty-when-logged-off"></span> <span class="arrow"></span> <div class="action-panel popover right-side"> <a id="btn-help" class="user-menu-item" href="javascript:void(0);">$_("Help")</a> diff --git a/ui/pages/tabs/guests.html.tmpl b/ui/pages/tabs/guests.html.tmpl index 8ab51b3..3aa2fdd 100644 --- a/ui/pages/tabs/guests.html.tmpl +++ b/ui/pages/tabs/guests.html.tmpl @@ -41,7 +41,7 @@ <li class="guest-tile">$_("Livetile")</li> <li class="guest-actions">$_("Actions")</li> </ul> - <ul id="guestList" class="list-vm"> + <ul id="guestList" class="list-vm empty-when-logged-off"> </ul> </div> <div id="noGuests" class="list-no-result" style="display: none;"> diff --git a/ui/pages/tabs/host.html.tmpl b/ui/pages/tabs/host.html.tmpl index 23b9853..52f849b 100644 --- a/ui/pages/tabs/host.html.tmpl +++ b/ui/pages/tabs/host.html.tmpl @@ -27,7 +27,7 @@ <div class="tools"> </div> </div> - <div id="host-content-container"></div> + <div id="host-content-container" class="empty-when-logged-off"></div> </div> <script id="host-tmpl" type="kimchi/template"> diff --git a/ui/pages/tabs/network.html.tmpl b/ui/pages/tabs/network.html.tmpl index f298516..2397fd4 100644 --- a/ui/pages/tabs/network.html.tmpl +++ b/ui/pages/tabs/network.html.tmpl @@ -40,7 +40,7 @@ --><span class="column column-space">$_("Address Space")</span><!-- --><span class="column">$_("Actions")</span> </div> - <div id="networkBody"></div> + <div id="networkBody" class="empty-when-logged-off"></div> </div> <div id="networkConfig" class="network-config"> <div class="section-container"> diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl index c20c954..c3a992e 100644 --- a/ui/pages/tabs/storage.html.tmpl +++ b/ui/pages/tabs/storage.html.tmpl @@ -39,7 +39,7 @@ <li class="title-allocate">$_("Allocated")</li> <li class="title-actions">$_("Actions")</li> </div> - <ul id="storagepoolsList" class="list-storage"></ul> + <ul id="storagepoolsList" class="list-storage empty-when-logged-off"></ul> </div> <script id="storageTmpl" type="html/text"> <li id="{name}"> diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl index 5fc3173..b6edbaf 100644 --- a/ui/pages/tabs/templates.html.tmpl +++ b/ui/pages/tabs/templates.html.tmpl @@ -34,7 +34,7 @@ $_("No templates found.") </div> - <ul id="templateList"></ul> + <ul id="templateList" class="empty-when-logged-off"></ul> <script id="templateTmpl" type="html/text"> -- 1.8.1.4

This patch updates those parts of the DOM marked with the classes remove-when-logged-off and empty-when-logged-off removing or emptying sections as noted by class. Additionally, the change reloads the browser whenever the AJAX request which caused us to detect that the session has ended is not marked for resend. This handles the case where we are in some subwindow of the UI when we detect that our session has ended, and loads the correct tab. Signed-off-by: Adam King <rak@linux.vnet.ibm.com> --- ui/js/src/kimchi.login_window.js | 3 +++ ui/js/src/kimchi.main.js | 2 ++ ui/js/src/kimchi.network.js | 2 +- ui/pages/tabs/network.html.tmpl | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/js/src/kimchi.login_window.js b/ui/js/src/kimchi.login_window.js index 22d74e0..e9af18f 100644 --- a/ui/js/src/kimchi.login_window.js +++ b/ui/js/src/kimchi.login_window.js @@ -87,6 +87,9 @@ kimchi.login_main = function() { $.ajax(pAjax); kimchi.previousAjax = null; } + else if(pAjax) { + window.location.reload(); + } kimchi.user.showUser(true); kimchi.window.close(); diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index c9d56e4..8d12525 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -156,6 +156,8 @@ kimchi.main = function() { if (jqXHR['status'] === 401) { kimchi.user.showUser(false); kimchi.previousAjax = ajaxSettings; + $(".empty-when-logged-off").empty(); + $(".remove-when-logged-off").remove(); kimchi.window.open({ url: 'login-window.html', id: 'login-window-wrapper' diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js index d68697a..a768833 100644 --- a/ui/js/src/kimchi.network.js +++ b/ui/js/src/kimchi.network.js @@ -187,7 +187,7 @@ kimchi.initNetworkDialog = function() { draggable : false, resizable : false, closeText: "X", - dialogClass : "network-ui-dialog", + dialogClass : "network-ui-dialog remove-when-logged-off", open : function(){ $(".ui-dialog-titlebar-close", $("#networkConfig").parent()).removeAttr("title"); }, diff --git a/ui/pages/tabs/network.html.tmpl b/ui/pages/tabs/network.html.tmpl index 2397fd4..bbb43e3 100644 --- a/ui/pages/tabs/network.html.tmpl +++ b/ui/pages/tabs/network.html.tmpl @@ -85,7 +85,7 @@ </div> </div> <script id="networkItem" type="text/html"> - <div id='{name}' class='item'> + <div id='{name}' class='item remove-when-logged-off'> <span class='column column-name cell' title="{name}">{name}</span><!-- --><span class='column column-state cell'><span class='network-state {state}'></span></span><!-- --><span class='column column-type cell'>{type}</span><!-- -- 1.8.1.4
participants (3)
-
Adam King
-
Aline Manera
-
Crístian Viana