From: Wen Wang <wenwang(a)linux.vnet.ibm.com>
1) This patch fix the error that kimchi cannot log out from "Host" page
and log in again to "Host".
2) Fix the bug that UI popup error when loging out from kimchi.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
src/kimchi/root.py | 2 +-
ui/js/src/kimchi.main.js | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/root.py b/src/kimchi/root.py
index 96f551d..6f191eb 100644
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@ -108,7 +108,7 @@ class Root(Resource):
if page.endswith('.html'):
context = template.render('tabs/' + page, data)
cherrypy.response.cookie[
- "lastPage"] = "/#tabs/" +
page.rstrip(".html")
+ "lastPage"] = "/#tabs/" + page[:-5]
cherrypy.response.cookie['lastPage']['path'] = '/'
return context
raise cherrypy.HTTPError(404)
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 21ffca7..a3305e9 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -39,6 +39,7 @@ kimchi.setupPeers = function(){
};
kimchi.main = function() {
+ kimchi.isLoggingOut = false;
kimchi.popable();
var genTabs = function(tabs) {
@@ -253,6 +254,7 @@ kimchi.main = function() {
// Perform logging out via Ajax request.
$('#btn-logout').on('click', function() {
kimchi.logout(function() {
+ kimchi.isLoggingOut = true;
document.location.href = "login.html";
}, function(err) {
kimchi.message.error(err.responseJSON.reason);
@@ -281,7 +283,7 @@ kimchi.main = function() {
document.location.href= isSessionTimeout ?
'login.html?error=sessionTimeout' : 'login.html';
return;
}
- else if((jqXHR['status'] == 0) &&
("error"==jqXHR.statusText)) {
+ else if((jqXHR['status'] == 0) &&
("error"==jqXHR.statusText) && !kimchi.isLoggingOut) {
kimchi.message.error(i18n['KCHAPI6007E'].replace("%1",
jqXHR.state()));
}
if(ajaxSettings['originalError']) {
--
1.7.1