[Kimchi-devel] [PATCH] Bugfix#420 UI: Pop up errors when log out at "Host" tab
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Sep 19 02:29:52 UTC 2014
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 09/17/2014 07:37 AM, Wen Wang wrote:
> From: Wen Wang <wenwang at 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 at 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']) {
More information about the Kimchi-devel
mailing list