From c659485ee433271ed8bdac37b5e42b32afcf0feb Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Fri, 13 Nov 2015 16:35:29 -0500 Subject: [PATCH] NIFI-655: - Ensuring the logout link is rendered when appropriate. --- .../src/main/webapp/js/nf/nf-common.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js index a2ff680729..53128b9c4b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js @@ -64,9 +64,10 @@ $(document).ready(function () { // initialize the tooltips $('img.setting-icon').qtip(nf.Common.config.tooltipConfig); - // shows the logout link in the message-pane when appropriate - if (nf.Storage.getItem('jwt')) { + // shows the logout link in the message-pane when appropriate and schedule token refresh + if (nf.Storage.getItem('jwt') !== null) { $('#user-logout-container').show(); + nf.Common.scheduleTokenRefresh(); } // handle logout @@ -74,11 +75,6 @@ $(document).ready(function () { nf.Storage.removeItem('jwt'); window.location = '/nifi/login'; }); - - // schedule token refresh when a token is present - if (nf.Storage.getItem('jwt') !== null) { - nf.Common.scheduleTokenRefresh(); - } }); // Define a common utility class used across the entire application. @@ -412,6 +408,13 @@ nf.Common = (function () { if ($('#splash').is(':visible')) { nf.Canvas.hideSplash(); } + + // update the log out link accordingly + if (nf.Storage.getItem('jwt') === null) { + $('#user-logout-container').hide(); + } else { + $('#user-logout-container').show(); + } // hide the context menu nf.ContextMenu.hide();