Repository: nifi Updated Branches: refs/heads/NIFI-655 f2d82ee14 -> 1312bde49
NIFI-655: - Updating available links during login, registration, and account status review. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/1312bde4 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/1312bde4 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/1312bde4 Branch: refs/heads/NIFI-655 Commit: 1312bde498aadbafc706f4de7b955d20c6d2d036 Parents: f2d82ee Author: Matt Gilman <[email protected]> Authored: Tue Nov 24 00:37:47 2015 -0500 Committer: Matt Gilman <[email protected]> Committed: Tue Nov 24 00:37:47 2015 -0500 ---------------------------------------------------------------------- .../src/main/webapp/WEB-INF/pages/login.jsp | 12 ++++- .../WEB-INF/partials/canvas/canvas-header.jsp | 2 +- .../webapp/WEB-INF/partials/message-pane.jsp | 11 ++++- .../nifi-web-ui/src/main/webapp/css/header.css | 19 +------ .../nifi-web-ui/src/main/webapp/css/login.css | 15 ++++++ .../nifi-web-ui/src/main/webapp/css/main.css | 18 +++++-- .../src/main/webapp/js/nf/login/nf-login.js | 52 +++++++++----------- .../src/main/webapp/js/nf/nf-common.js | 15 ++++-- 8 files changed, 87 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/login.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/login.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/login.jsp index 978d019..9f876e1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/login.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/login.jsp @@ -37,8 +37,16 @@ ${nf.login.script.tags} </head> <body class="login-body"> - <div id="user-logout-container" class="hidden"> - <span id="user-logout" class="link">logout</span> + <div id="login-user-links-container"> + <ul id="login-user-links" class="links"> + <li id="user-logout-container" style="display: none;"> + <span id="user-logout" class="link">logout</span> + </li> + <li> + <span id="user-home" class="link">home</span> + </li> + </ul> + <div class="clear"></div> </div> <div id="login-contents-container"> <jsp:include page="/WEB-INF/partials/login/login-message.jsp"/> http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp index 2ea7ca6..7a1d22d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp @@ -43,7 +43,7 @@ </div> </div> <div id="header-links-container"> - <ul> + <ul class="links"> <li id="current-user-container"> <div id="anonymous-user-alert" class="hidden"></div> <div id="current-user"></div> http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/message-pane.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/message-pane.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/message-pane.jsp index db5dece..4fdc9c6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/message-pane.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/message-pane.jsp @@ -16,8 +16,15 @@ --%> <%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> <div id="message-pane" class="message-pane hidden"> - <div id="user-logout-container" class="hidden"> - <span id="user-logout" class="link">logout</span> + <div id="user-links-container"> + <ul class="links"> + <li id="user-logout-container" style="display: none;"> + <span id="user-logout" class="link">logout</span> + </li> + <li> + <span id="user-home" class="link">home</span> + </li> + </ul> </div> <div class="message-pane-message-box"> <div id="message-title" class="message-pane-title"></div> http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/header.css ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/header.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/header.css index 49dd3a0..e0f8347 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/header.css +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/header.css @@ -658,27 +658,10 @@ div.bulletin-board-hover { #header-links-container { position: absolute; - top: 1px; - right: 0px; + right: 10px; z-index: 100; } -#header-links-container li { - float: left; - display: block; - margin-right: 10px; - padding: 4px; - text-align: center; - font-size: .8em; - font-weight: normal; - text-decoration: none; -} - -#header-links-container span.header-link-over { - color: #264c58; - text-decoration: underline; -} - #has-pending-accounts { background-image: url(../images/starburst.png); width: 9px; http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/login.css ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/login.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/login.css index 68086a7..b4c8268 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/login.css +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/login.css @@ -48,6 +48,21 @@ color: #000; } +#login-user-links-container { + position: absolute; + top: 0px; + left: 0px; + padding-top: 100px; + padding-left: 100px; + font-family: Verdana, Geneva, sans-serif; + z-index: 1300; + width: 412px; +} + +#login-user-links { + float: right; +} + /* Login */ http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css index deadcd5..3a6e9d1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css @@ -77,14 +77,26 @@ div.context-menu-provenance { background-position: top left; } -#user-logout-container { +#user-links-container { position: absolute; - left: 478px; + left: 550px; top: 100px; z-index: 1300; } -#user-logout { +ul.links li { + float: left; + display: block; + margin-left: 10px; + padding: 4px; + text-align: center; + font-size: 11px; + font-weight: normal; + text-decoration: none; +} + +ul.links span.header-link-over { + color: #264c58; text-decoration: underline; } http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js index 6cefd4f..92712e6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js @@ -109,12 +109,25 @@ nf.Login = (function () { // check to see if they actually have access now $.ajax({ type: 'GET', - url: config.urls.identity, + url: config.urls.accessStatus, dataType: 'json' }).done(function (response) { - if (response.identity === 'anonymous') { - showLogoutLink(); + var accessStatus = response.accessStatus; + + // update the logout link appropriately + showLogoutLink(); + + // update according to the access status + if (accessStatus.status === 'UNKNOWN' || accessStatus.status === 'NOT_ACTIVE') { + $('#login-message-title').text('Unable to log in'); + $('#login-message').text(accessStatus.message); + // update visibility + $('#login-container').hide(); + $('#login-submission-container').hide(); + $('#login-progress-container').hide(); + $('#login-message-container').show(); + } else if (accessStatus.status === 'UNREGISTERED') { // schedule automatic token refresh nf.Common.scheduleTokenRefresh(); @@ -128,7 +141,7 @@ nf.Login = (function () { // update the form visibility $('#login-submission-container').show(); $('#login-progress-container').hide(); - } else { + } else if (accessStatus.status === 'ACTIVE') { // reload as appropriate - no need to schedule token refresh as the page is reloading if (top !== window) { parent.window.location = '/nifi'; @@ -137,31 +150,14 @@ nf.Login = (function () { } } }).fail(function (xhr, status, error) { - showLogoutLink(); - - // schedule automatic token refresh - nf.Common.scheduleTokenRefresh(); - - // show the user - $('#nifi-user-submit-justification').text(token['preferred_username']); - - if (xhr.status === 401) { - initializeNiFiRegistration(); - showNiFiRegistration(); - - // update the form visibility - $('#login-submission-container').show(); - $('#login-progress-container').hide(); - } else { - $('#login-message-title').text('Unable to log in'); - $('#login-message').text(xhr.responseText); + $('#login-message-title').text('Unable to log in'); + $('#login-message').text(xhr.responseText); - // update visibility - $('#login-container').hide(); - $('#login-submission-container').hide(); - $('#login-progress-container').hide(); - $('#login-message-container').show(); - } + // update visibility + $('#login-container').hide(); + $('#login-submission-container').hide(); + $('#login-progress-container').hide(); + $('#login-message-container').show(); }); }).fail(function (xhr, status, error) { nf.Dialog.showOkDialog({ http://git-wip-us.apache.org/repos/asf/nifi/blob/1312bde4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js ---------------------------------------------------------------------- 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 321044f..cf83e16 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 @@ -74,7 +74,7 @@ $(document).ready(function () { // shows the logout link in the message-pane when appropriate and schedule token refresh if (nf.Storage.getItem('jwt') !== null) { - $('#user-logout-container').show(); + $('#user-logout-container').css('display', 'block'); nf.Common.scheduleTokenRefresh(); } @@ -83,6 +83,15 @@ $(document).ready(function () { nf.Storage.removeItem('jwt'); window.location = '/nifi/login'; }); + + // handle home + $('#user-home').on('click', function () { + if (top !== window) { + parent.window.location = '/nifi'; + } else { + window.location = '/nifi'; + } + }); }); // Define a common utility class used across the entire application. @@ -447,9 +456,9 @@ nf.Common = (function () { */ showLogoutLink: function () { if (nf.Storage.getItem('jwt') === null) { - $('#user-logout-container').hide(); + $('#user-logout-container').css('display', 'none'); } else { - $('#user-logout-container').show(); + $('#user-logout-container').css('display', 'block'); } },
