NIFI-180:

- Obtaining the grid instance correctly.
This commit is contained in:
Matt Gilman 2014-12-17 10:46:54 -05:00
parent 045afa5b2e
commit 12de20da86
1 changed files with 10 additions and 13 deletions

View File

@ -398,7 +398,7 @@ nf.ClusterTable = (function () {
* @argument {string} row The row * @argument {string} row The row
*/ */
promptForConnect: function (row) { promptForConnect: function (row) {
var grid = $('#cluster-table'); var grid = $('#cluster-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(grid)) { if (nf.Common.isDefinedAndNotNull(grid)) {
var data = grid.getData(); var data = grid.getData();
var node = data.getItem(row); var node = data.getItem(row);
@ -421,7 +421,7 @@ nf.ClusterTable = (function () {
* @argument {string} row The row * @argument {string} row The row
*/ */
promptForDisconnect: function (row) { promptForDisconnect: function (row) {
var grid = $('#cluster-table'); var grid = $('#cluster-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(grid)) { if (nf.Common.isDefinedAndNotNull(grid)) {
var data = grid.getData(); var data = grid.getData();
var node = data.getItem(row); var node = data.getItem(row);
@ -443,7 +443,7 @@ nf.ClusterTable = (function () {
* @argument {string} row The row * @argument {string} row The row
*/ */
makePrimary: function (row) { makePrimary: function (row) {
var grid = $('#cluster-table'); var grid = $('#cluster-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(grid)) { if (nf.Common.isDefinedAndNotNull(grid)) {
var data = grid.getData(); var data = grid.getData();
var item = data.getItem(row); var item = data.getItem(row);
@ -458,16 +458,13 @@ nf.ClusterTable = (function () {
}).done(function (response) { }).done(function (response) {
var node = response.node; var node = response.node;
var clusterGrid = $('#cluster-table').data('gridInstance');
var clusterData = clusterGrid.getData();
// start the update // start the update
clusterData.beginUpdate(); data.beginUpdate();
clusterData.updateItem(node.nodeId, node); data.updateItem(node.nodeId, node);
// need to find the previous primary node // need to find the previous primary node
// get the property grid data // get the property grid data
var clusterItems = clusterData.getItems(); var clusterItems = data.getItems();
$.each(clusterItems, function (i, otherNode) { $.each(clusterItems, function (i, otherNode) {
// attempt to identify the previous primary node // attempt to identify the previous primary node
if (node.nodeId !== otherNode.nodeId && otherNode.primary === true) { if (node.nodeId !== otherNode.nodeId && otherNode.primary === true) {
@ -476,7 +473,7 @@ nf.ClusterTable = (function () {
otherNode.status = 'CONNECTED'; otherNode.status = 'CONNECTED';
// set the new node state // set the new node state
clusterData.updateItem(otherNode.nodeId, otherNode); data.updateItem(otherNode.nodeId, otherNode);
// no need to continue processing // no need to continue processing
return false; return false;
@ -484,7 +481,7 @@ nf.ClusterTable = (function () {
}); });
// end the update // end the update
clusterData.endUpdate(); data.endUpdate();
}).fail(nf.Common.handleAjaxError); }).fail(nf.Common.handleAjaxError);
} }
}, },
@ -495,7 +492,7 @@ nf.ClusterTable = (function () {
* @argument {string} row The row * @argument {string} row The row
*/ */
promptForRemoval: function (row) { promptForRemoval: function (row) {
var grid = $('#cluster-table'); var grid = $('#cluster-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(grid)) { if (nf.Common.isDefinedAndNotNull(grid)) {
var data = grid.getData(); var data = grid.getData();
var node = data.getItem(row); var node = data.getItem(row);
@ -559,7 +556,7 @@ nf.ClusterTable = (function () {
* @argument {string} row The row * @argument {string} row The row
*/ */
showNodeDetails: function (row) { showNodeDetails: function (row) {
var grid = $('#cluster-table'); var grid = $('#cluster-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(grid)) { if (nf.Common.isDefinedAndNotNull(grid)) {
var data = grid.getData(); var data = grid.getData();
var item = data.getItem(row); var item = data.getItem(row);