NIFI-655:

- Showing a logging in notification during the log in process.
This commit is contained in:
Matt Gilman 2015-11-18 18:23:59 -05:00
parent 3da198135e
commit 242949ee98
7 changed files with 71 additions and 21 deletions

View File

@ -45,6 +45,7 @@
<jsp:include page="/WEB-INF/partials/login/login-form.jsp"/> <jsp:include page="/WEB-INF/partials/login/login-form.jsp"/>
<jsp:include page="/WEB-INF/partials/login/nifi-registration-form.jsp"/> <jsp:include page="/WEB-INF/partials/login/nifi-registration-form.jsp"/>
<jsp:include page="/WEB-INF/partials/login/login-submission.jsp"/> <jsp:include page="/WEB-INF/partials/login/login-submission.jsp"/>
<jsp:include page="/WEB-INF/partials/login/login-progress.jsp"/>
</div> </div>
<jsp:include page="/WEB-INF/partials/ok-dialog.jsp"/> <jsp:include page="/WEB-INF/partials/ok-dialog.jsp"/>
<div id="faded-background"></div> <div id="faded-background"></div>

View File

@ -0,0 +1,22 @@
<%--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<div id="login-progress-container" class="login-container hidden">
<div id="login-progress-spinner" class="loading-container ajax-loading"></div>
<div id="login-progress-label">Logging in...</div>
<div class="clear"></div>
</div>

View File

@ -15,6 +15,6 @@
limitations under the License. limitations under the License.
--%> --%>
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> <%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<div id="login-submission-container" class="hidden"> <div id="login-submission-container" class="login-container hidden">
<div id="login-submission-button" class="button">Log in</div> <div id="login-submission-button" class="button">Log in</div>
</div> </div>

View File

@ -15,7 +15,7 @@
limitations under the License. limitations under the License.
--%> --%>
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> <%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<div id="nifi-registration-container" class="hidden"> <div id="nifi-registration-container" class="login-container hidden">
<div id="nifi-registration-title" class="login-title nifi-submit-justification">Submit Justification</div> <div id="nifi-registration-title" class="login-title nifi-submit-justification">Submit Justification</div>
<div id="nifi-user-submit-justification-container" class="nifi-submit-justification"> <div id="nifi-user-submit-justification-container" class="nifi-submit-justification">
<div class="setting"> <div class="setting">

View File

@ -56,14 +56,14 @@ body.login-body input, body.login-body textarea {
width: 400px; width: 400px;
} }
div.login-container {
width: 412px;
}
/* /*
NiFi Registration NiFi Registration
*/ */
#nifi-registration-container {
width: 412px;
}
#nifi-user-submit-justification-container { #nifi-user-submit-justification-container {
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -77,13 +77,19 @@ body.login-body input, body.login-body textarea {
} }
/* /*
Submission Login Progress
*/ */
#login-submission-container { #login-progress-label {
width: 412px; float: right;
font-weight: bold;
line-height: 16px;
} }
#login-submission-button { #login-progress-spinner {
float: right;
width: 16px;
height: 16px;
background-color: transparent;
margin-left: 3px;
} }

View File

@ -87,6 +87,10 @@ nf.Login = (function () {
}; };
var login = function () { var login = function () {
// show the logging message...
$('#login-progress-container').show();
$('#login-submission-container').hide();
// login submit // login submit
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
@ -119,6 +123,10 @@ nf.Login = (function () {
// show the registration form // show the registration form
initializeNiFiRegistration(); initializeNiFiRegistration();
showNiFiRegistration(); showNiFiRegistration();
// update the form visibility
$('#login-submission-container').show();
$('#login-progress-container').hide();
} else { } else {
// reload as appropriate - no need to schedule token refresh as the page is reloading // reload as appropriate - no need to schedule token refresh as the page is reloading
if (top !== window) { if (top !== window) {
@ -139,6 +147,10 @@ nf.Login = (function () {
if (xhr.status === 401) { if (xhr.status === 401) {
initializeNiFiRegistration(); initializeNiFiRegistration();
showNiFiRegistration(); showNiFiRegistration();
// update the form visibility
$('#login-submission-container').show();
$('#login-progress-container').hide();
} else { } else {
$('#login-message-title').text('Unable to log in'); $('#login-message-title').text('Unable to log in');
$('#login-message').text(xhr.responseText); $('#login-message').text(xhr.responseText);
@ -146,6 +158,7 @@ nf.Login = (function () {
// update visibility // update visibility
$('#login-container').hide(); $('#login-container').hide();
$('#login-submission-container').hide(); $('#login-submission-container').hide();
$('#login-progress-container').hide();
$('#login-message-container').show(); $('#login-message-container').show();
} }
}); });
@ -155,6 +168,10 @@ nf.Login = (function () {
dialogContent: nf.Common.escapeHtml(xhr.responseText), dialogContent: nf.Common.escapeHtml(xhr.responseText),
overlayBackground: false overlayBackground: false
}); });
// update the form visibility
$('#login-submission-container').show();
$('#login-progress-container').hide();
} else { } else {
$('#login-message-title').text('Unable to log in'); $('#login-message-title').text('Unable to log in');
$('#login-message').text(xhr.responseText); $('#login-message').text(xhr.responseText);
@ -162,6 +179,7 @@ nf.Login = (function () {
// update visibility // update visibility
$('#login-container').hide(); $('#login-container').hide();
$('#login-submission-container').hide(); $('#login-submission-container').hide();
$('#login-progress-container').hide();
$('#login-message-container').show(); $('#login-message-container').show();
} }
}); });
@ -194,12 +212,8 @@ nf.Login = (function () {
}); });
}; };
var logout = function () {
nf.Storage.removeItem('jwt');
};
var showLogoutLink = function () { var showLogoutLink = function () {
$('#user-logout-container').show(); nf.Common.showLogoutLink();
}; };
return { return {

View File

@ -424,11 +424,7 @@ nf.Common = (function () {
* Closes the canvas by removing the splash screen and stats poller. * Closes the canvas by removing the splash screen and stats poller.
*/ */
closeCanvas: function () { closeCanvas: function () {
if (nf.Storage.getItem('jwt') === null) { nf.Common.showLogoutLink();
$('#user-logout-container').hide();
} else {
$('#user-logout-container').show();
}
// ensure this javascript has been loaded in the nf canvas page // ensure this javascript has been loaded in the nf canvas page
if (nf.Common.isDefinedAndNotNull(nf.Canvas)) { if (nf.Common.isDefinedAndNotNull(nf.Canvas)) {
@ -446,6 +442,17 @@ nf.Common = (function () {
} }
}, },
/**
* Shows the logout link if appropriate.
*/
showLogoutLink: function () {
if (nf.Storage.getItem('jwt') === null) {
$('#user-logout-container').hide();
} else {
$('#user-logout-container').show();
}
},
/** /**
* Populates the specified field with the specified value. If the value is * Populates the specified field with the specified value. If the value is
* undefined, the field will read 'No value set.' If the value is an empty * undefined, the field will read 'No value set.' If the value is an empty