You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2016/07/13 13:22:26 UTC
nifi git commit: NIFI-2232: - Dynamically updating the global menu
according to the current users permissions.
Repository: nifi
Updated Branches:
refs/heads/master 9e2f52c8b -> 8ab9fca7f
NIFI-2232:
- Dynamically updating the global menu according to the current users permissions.
This closes #635.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/8ab9fca7
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/8ab9fca7
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/8ab9fca7
Branch: refs/heads/master
Commit: 8ab9fca7f859001d6a2ec261bc2ae3fb0dc4b4b8
Parents: 9e2f52c
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Jul 12 20:26:27 2016 -0400
Committer: Mark Payne <ma...@hotmail.com>
Committed: Wed Jul 13 09:21:55 2016 -0400
----------------------------------------------------------------------
.../src/main/webapp/js/nf/canvas/nf-canvas.js | 39 +++++++++++++-------
1 file changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/8ab9fca7/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
index d5bc4ce..6f46eef 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
@@ -147,7 +147,7 @@ nf.Canvas = (function () {
};
/**
- * Register the pooler.
+ * Register the poller.
*
* @argument {int} autoRefreshInterval The auto refresh interval
*/
@@ -665,12 +665,26 @@ nf.Canvas = (function () {
// update the birdseye
nf.Birdseye.refresh();
-
- // inform Angular app values have changed
- nf.ng.Bridge.digest();
}).fail(nf.Common.handleAjaxError);
};
+ /**
+ * Loads the current user and updates the current user locally.
+ *
+ * @returns xhr
+ */
+ var loadCurrentUser = function () {
+ // get the current user
+ return $.ajax({
+ type: 'GET',
+ url: config.urls.currentUser,
+ dataType: 'json'
+ }).done(function (currentUser) {
+ // set the current user
+ nf.Common.setCurrentUser(currentUser);
+ });
+ };
+
return {
CANVAS_OFFSET: 0,
@@ -706,7 +720,12 @@ nf.Canvas = (function () {
// get the process group to refresh everything
var processGroupXhr = reloadProcessGroup(nf.Canvas.getGroupId(), options);
var statusXhr = nf.ng.Bridge.injector.get('flowStatusCtrl').reloadFlowStatus();
- $.when(processGroupXhr, statusXhr).done(function (processGroupResult) {
+ var currentUserXhr = loadCurrentUser();
+ $.when(processGroupXhr, statusXhr, currentUserXhr).done(function (processGroupResult) {
+ // inform Angular app values have changed
+ nf.ng.Bridge.digest();
+
+ // resolve the deferred
deferred.resolve(processGroupResult);
}).fail(function () {
deferred.reject();
@@ -742,15 +761,7 @@ nf.Canvas = (function () {
// load the current user
var userXhr = $.Deferred(function (deferred) {
ticketExchange.always(function () {
- // get the current user
- $.ajax({
- type: 'GET',
- url: config.urls.currentUser,
- dataType: 'json'
- }).done(function (currentUser) {
- // at this point the user may be themselves or anonymous
- nf.Common.setCurrentUser(currentUser)
-
+ loadCurrentUser().done(function (currentUser) {
// if the user is logged, we want to determine if they were logged in using a certificate
if (currentUser.anonymous === false) {
// render the users name