From 12de20da86f0b6b6ff41230ed9f95c92b2e1028c Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Wed, 17 Dec 2014 10:46:54 -0500 Subject: [PATCH] NIFI-180: - Obtaining the grid instance correctly. --- .../webapp/js/nf/cluster/nf-cluster-table.js | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js index c82caa0087..addd4be3f1 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js @@ -398,7 +398,7 @@ nf.ClusterTable = (function () { * @argument {string} row The row */ promptForConnect: function (row) { - var grid = $('#cluster-table'); + var grid = $('#cluster-table').data('gridInstance'); if (nf.Common.isDefinedAndNotNull(grid)) { var data = grid.getData(); var node = data.getItem(row); @@ -421,7 +421,7 @@ nf.ClusterTable = (function () { * @argument {string} row The row */ promptForDisconnect: function (row) { - var grid = $('#cluster-table'); + var grid = $('#cluster-table').data('gridInstance'); if (nf.Common.isDefinedAndNotNull(grid)) { var data = grid.getData(); var node = data.getItem(row); @@ -443,7 +443,7 @@ nf.ClusterTable = (function () { * @argument {string} row The row */ makePrimary: function (row) { - var grid = $('#cluster-table'); + var grid = $('#cluster-table').data('gridInstance'); if (nf.Common.isDefinedAndNotNull(grid)) { var data = grid.getData(); var item = data.getItem(row); @@ -458,16 +458,13 @@ nf.ClusterTable = (function () { }).done(function (response) { var node = response.node; - var clusterGrid = $('#cluster-table').data('gridInstance'); - var clusterData = clusterGrid.getData(); - // start the update - clusterData.beginUpdate(); - clusterData.updateItem(node.nodeId, node); + data.beginUpdate(); + data.updateItem(node.nodeId, node); // need to find the previous primary node // get the property grid data - var clusterItems = clusterData.getItems(); + var clusterItems = data.getItems(); $.each(clusterItems, function (i, otherNode) { // attempt to identify the previous primary node if (node.nodeId !== otherNode.nodeId && otherNode.primary === true) { @@ -476,7 +473,7 @@ nf.ClusterTable = (function () { otherNode.status = 'CONNECTED'; // set the new node state - clusterData.updateItem(otherNode.nodeId, otherNode); + data.updateItem(otherNode.nodeId, otherNode); // no need to continue processing return false; @@ -484,7 +481,7 @@ nf.ClusterTable = (function () { }); // end the update - clusterData.endUpdate(); + data.endUpdate(); }).fail(nf.Common.handleAjaxError); } }, @@ -495,7 +492,7 @@ nf.ClusterTable = (function () { * @argument {string} row The row */ promptForRemoval: function (row) { - var grid = $('#cluster-table'); + var grid = $('#cluster-table').data('gridInstance'); if (nf.Common.isDefinedAndNotNull(grid)) { var data = grid.getData(); var node = data.getItem(row); @@ -559,7 +556,7 @@ nf.ClusterTable = (function () { * @argument {string} row The row */ showNodeDetails: function (row) { - var grid = $('#cluster-table'); + var grid = $('#cluster-table').data('gridInstance'); if (nf.Common.isDefinedAndNotNull(grid)) { var data = grid.getData(); var item = data.getItem(row);