This is an automated email from the ASF dual-hosted git repository.
mcgilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new 4484565 NIFI-6253 - Fix: UI - Process Group ID display in Operate
palette can get out of sync when process groups are removed from different
sessions. NIFI-6253 - simplifying loading of a new process group, handle
failure. NIFI-6253 - Expose nfCanvas.loadProcessGroup functionality through
nfCanvasUtils.loadProcessGroup NIFI-6253 - optional groupId approach to reload
4484565 is described below
commit 4484565df19e2731810c7f2bc9d32e991e6f54e8
Author: Rob Fellows <[email protected]>
AuthorDate: Thu May 2 14:24:00 2019 -0400
NIFI-6253 - Fix: UI - Process Group ID display in Operate palette can get
out of sync when process groups are removed from different sessions.
NIFI-6253 - simplifying loading of a new process group, handle failure.
NIFI-6253 - Expose nfCanvas.loadProcessGroup functionality through
nfCanvasUtils.loadProcessGroup
NIFI-6253 - optional groupId approach to reload
This closes #3458
---
.../src/main/webapp/js/nf/canvas/nf-actions.js | 4 +-
.../main/webapp/js/nf/canvas/nf-canvas-utils.js | 20 ++++------
.../src/main/webapp/js/nf/canvas/nf-canvas.js | 46 +++++++++++++++++++---
.../main/webapp/js/nf/canvas/nf-process-group.js | 5 +--
4 files changed, 50 insertions(+), 25 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
index ed45d12..6ae84ce 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
@@ -968,9 +968,7 @@
* Reloads the status for the entire canvas (components and flow.)
*/
reload: function () {
- nfCanvasUtils.reload({
- 'transition': true
- });
+ nfCanvasUtils.reload();
},
/**
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
index b90c9b3..34ac67f 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
@@ -349,11 +349,8 @@
var refreshGraph = $.Deferred(function (deferred) {
// load a different group if necessary
if (groupId !== nfCanvas.getGroupId()) {
- // set the new group id
- nfCanvas.setGroupId(groupId);
-
- // reload
- nfCanvas.reload().done(function () {
+ // load the process group
+ nfCanvas.reload({}, groupId).done(function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nfDialog.showOkDialog({
@@ -455,11 +452,8 @@
var refreshGraph = $.Deferred(function (deferred) {
// load a different group if necessary
if (groupId !== nfCanvas.getGroupId() || forceCanvasLoad) {
- // set the new group id
- nfCanvas.setGroupId(groupId);
-
- // reload
- nfCanvas.reload().done(function () {
+ // load the process group
+ nfCanvas.reload({}, groupId).done(function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nfDialog.showOkDialog({
@@ -2110,11 +2104,13 @@
/**
* Reloads the status for the entire canvas (components and flow.)
+ *
+ * @param {string} groupId Optional, specific group id to reload
the canvas to
*/
- reload: function () {
+ reload: function (groupId) {
return nfCanvas.reload({
'transition': true
- });
+ }, groupId);
},
/**
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 d2ba07d..c06da21 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
@@ -132,11 +132,11 @@
/**
* Refreshes the graph.
*
- * @argument {string} processGroupId The process group id
* @argument {object} options Configuration options
*/
- var reloadProcessGroup = function (processGroupId, options) {
+ var reloadProcessGroup = function (options) {
var now = new Date().getTime();
+ var processGroupId = nfCanvas.getGroupId();
// load the controller
return $.ajax({
@@ -210,6 +210,30 @@
};
/**
+ * Reloads the flow from the server based on the specified group id.
+ *
+ * @param processGroupId Id of the Process Group to load
+ * @param options
+ */
+ var changeProcessGroup = function (processGroupId, options) {
+ // capture the current group id to reset to in case of failure
+ var currentProcessGroup = nfCanvas.getGroupId();
+
+ // update process group id and attempt to reload
+ nfCanvas.setGroupId(processGroupId);
+ var processGroupXhr = reloadProcessGroup(options);
+
+ // if the request fails, ensure the process group id is reset
+ processGroupXhr
+ .fail(function (xhr, status, error) {
+ nfCanvas.setGroupId(currentProcessGroup);
+ });
+
+ return processGroupXhr;
+ };
+
+
+ /**
* Loads the current user and updates the current user locally.
*
* @returns xhr
@@ -258,12 +282,20 @@
/**
* Reloads the flow from the server based on the currently specified
group id.
- * To load another group, update nfCanvas.setGroupId, clear the
canvas, and call nfCanvas.reload.
+ * To load another group, set the groupId parameter otherwise the
current group
+ * will be reloaded.
*/
- reload: function (options) {
+ reload: function (options, groupId) {
return $.Deferred(function (deferred) {
// issue the requests
- var processGroupXhr =
reloadProcessGroup(nfCanvas.getGroupId(), options);
+
+ var processGroupXhr;
+ if (nfCommon.isDefinedAndNotNull(groupId)) {
+ processGroupXhr = changeProcessGroup(groupId, options);
+ } else {
+ processGroupXhr = reloadProcessGroup(options);
+ }
+
var statusXhr =
nfNgBridge.injector.get('flowStatusCtrl').reloadFlowStatus();
var currentUserXhr = loadCurrentUser();
var controllerBulletins = $.ajax({
@@ -295,11 +327,13 @@
// wait for all requests to complete
$.when(processGroupXhr, statusXhr, currentUserXhr,
controllerBulletins, clusterSummary).done(function (processGroupResult) {
+ var processGroupResponse = processGroupResult[0];
+
// inform Angular app values have changed
nfNgBridge.digest();
// resolve the deferred
- deferred.resolve(processGroupResult);
+ deferred.resolve(processGroupResponse);
}).fail(function (xhr, status, error) {
deferred.reject(xhr, status, error);
});
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js
index 2e82430..2d1653c 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js
@@ -1649,11 +1649,8 @@
// hide the context menu
nfContextMenu.hide();
- // set the new group id
- nfCanvasUtils.setGroupId(groupId);
-
// reload the graph
- return nfCanvasUtils.reload().done(function () {
+ return nfCanvasUtils.reload(groupId).done(function () {
// attempt to restore the view
var viewRestored = nfCanvasUtils.restoreUserView();