mirror of https://github.com/apache/nifi.git
NIFI-2534: - Refreshing using component IDs. - Code clean up.
This closes #874. Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
parent
2fd39676a8
commit
b3f36489ad
|
@ -143,7 +143,7 @@ nf.Actions = (function () {
|
||||||
var connections = nf.Connection.getComponentConnections(remoteProcessGroup.id);
|
var connections = nf.Connection.getComponentConnections(remoteProcessGroup.id);
|
||||||
$.each(connections, function (_, connection) {
|
$.each(connections, function (_, connection) {
|
||||||
if (connection.permissions.canRead) {
|
if (connection.permissions.canRead) {
|
||||||
nf.Connection.reload(connection.component);
|
nf.Connection.reload(connection.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ nf.Actions = (function () {
|
||||||
|
|
||||||
startRequests.push(updateResource(uri, entity).done(function (response) {
|
startRequests.push(updateResource(uri, entity).done(function (response) {
|
||||||
if (nf.CanvasUtils.isProcessGroup(selected)) {
|
if (nf.CanvasUtils.isProcessGroup(selected)) {
|
||||||
nf.ProcessGroup.reload(d.component);
|
nf.ProcessGroup.reload(d.id);
|
||||||
} else {
|
} else {
|
||||||
nf[d.type].set(response);
|
nf[d.type].set(response);
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,7 @@ nf.Actions = (function () {
|
||||||
|
|
||||||
stopRequests.push(updateResource(uri, entity).done(function (response) {
|
stopRequests.push(updateResource(uri, entity).done(function (response) {
|
||||||
if (nf.CanvasUtils.isProcessGroup(selected)) {
|
if (nf.CanvasUtils.isProcessGroup(selected)) {
|
||||||
nf.ProcessGroup.reload(d.component);
|
nf.ProcessGroup.reload(d.id);
|
||||||
} else {
|
} else {
|
||||||
nf[d.type].set(response);
|
nf[d.type].set(response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1194,11 +1194,11 @@ nf.CanvasUtils = (function () {
|
||||||
if (sourceData.permissions.canRead) {
|
if (sourceData.permissions.canRead) {
|
||||||
// update the source status if necessary
|
// update the source status if necessary
|
||||||
if (nf.CanvasUtils.isProcessor(source)) {
|
if (nf.CanvasUtils.isProcessor(source)) {
|
||||||
nf.Processor.reload(sourceData.component);
|
nf.Processor.reload(sourceData.id);
|
||||||
} else if (nf.CanvasUtils.isInputPort(source)) {
|
} else if (nf.CanvasUtils.isInputPort(source)) {
|
||||||
nf.Port.reload(sourceData.component);
|
nf.Port.reload(sourceData.id);
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(source)) {
|
} else if (nf.CanvasUtils.isRemoteProcessGroup(source)) {
|
||||||
nf.RemoteProcessGroup.reload(sourceData.component);
|
nf.RemoteProcessGroup.reload(sourceData.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1212,9 +1212,9 @@ nf.CanvasUtils = (function () {
|
||||||
if (destinationData.permissions.canRead) {
|
if (destinationData.permissions.canRead) {
|
||||||
// update the destination component accordingly
|
// update the destination component accordingly
|
||||||
if (nf.CanvasUtils.isProcessor(destination)) {
|
if (nf.CanvasUtils.isProcessor(destination)) {
|
||||||
nf.Processor.reload(destinationData.component);
|
nf.Processor.reload(destinationData.id);
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
|
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
|
||||||
nf.RemoteProcessGroup.reload(destinationData.component);
|
nf.RemoteProcessGroup.reload(destinationData.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1371,7 +1371,7 @@ nf.CanvasUtils = (function () {
|
||||||
// move the components into the destination and...
|
// move the components into the destination and...
|
||||||
moveComponents(components, groupData.id).done(function () {
|
moveComponents(components, groupData.id).done(function () {
|
||||||
// reload the target group
|
// reload the target group
|
||||||
nf.ProcessGroup.reload(groupData.component);
|
nf.ProcessGroup.reload(groupData.id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1676,11 +1676,11 @@ nf.Connection = (function () {
|
||||||
/**
|
/**
|
||||||
* Reloads the connection state from the server and refreshes the UI.
|
* Reloads the connection state from the server and refreshes the UI.
|
||||||
*
|
*
|
||||||
* @param {object} connection The connection to reload
|
* @param {string} id The connection id
|
||||||
*/
|
*/
|
||||||
reload: function (connection) {
|
reload: function (id) {
|
||||||
if (connectionMap.has(connection.id)) {
|
if (connectionMap.has(id)) {
|
||||||
var connectionEntity = connectionMap.get(connection.id);
|
var connectionEntity = connectionMap.get(id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: connectionEntity.uri,
|
url: connectionEntity.uri,
|
||||||
|
|
|
@ -188,8 +188,7 @@ nf.ControllerService = (function () {
|
||||||
if (reference.referenceType === 'Processor') {
|
if (reference.referenceType === 'Processor') {
|
||||||
// reload the processor on the canvas if appropriate
|
// reload the processor on the canvas if appropriate
|
||||||
if (nf.Canvas.getGroupId() === reference.groupId) {
|
if (nf.Canvas.getGroupId() === reference.groupId) {
|
||||||
var processor = nf.Processor.get(reference.id);
|
nf.Processor.reload(reference.id);
|
||||||
nf.Processor.reload(processor.component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the current active thread count
|
// update the current active thread count
|
||||||
|
|
|
@ -277,11 +277,11 @@ nf.Funnel = (function () {
|
||||||
* Reloads the funnel state from the server and refreshes the UI.
|
* Reloads the funnel state from the server and refreshes the UI.
|
||||||
* If the funnel is currently unknown, this function just returns.
|
* If the funnel is currently unknown, this function just returns.
|
||||||
*
|
*
|
||||||
* @param {object} funnel The funnel to reload
|
* @param {string} id The funnel id
|
||||||
*/
|
*/
|
||||||
reload: function (funnel) {
|
reload: function (id) {
|
||||||
if (funnelMap.has(funnel.id)) {
|
if (funnelMap.has(id)) {
|
||||||
var funnelEntity = funnelMap.get(funnel.id);
|
var funnelEntity = funnelMap.get(id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: funnelEntity.uri,
|
url: funnelEntity.uri,
|
||||||
|
|
|
@ -457,11 +457,11 @@ nf.Label = (function () {
|
||||||
* Reloads the label state from the server and refreshes the UI.
|
* Reloads the label state from the server and refreshes the UI.
|
||||||
* If the label is currently unknown, this function just returns.
|
* If the label is currently unknown, this function just returns.
|
||||||
*
|
*
|
||||||
* @param {object} label The label to reload
|
* @param {string} id The label id
|
||||||
*/
|
*/
|
||||||
reload: function (label) {
|
reload: function (id) {
|
||||||
if (labelMap.has(label.id)) {
|
if (labelMap.has(id)) {
|
||||||
var labelEntity = labelMap.get(label.id);
|
var labelEntity = labelMap.get(id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: labelEntity.uri,
|
url: labelEntity.uri,
|
||||||
|
|
|
@ -948,15 +948,11 @@ nf.PolicyManagement = (function () {
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Canvas.reload({
|
|
||||||
'transition': true
|
|
||||||
});
|
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
nf.Common.handleAjaxError(xhr, status, error);
|
nf.Common.handleAjaxError(xhr, status, error);
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
|
}).always(function () {
|
||||||
nf.Canvas.reload({
|
nf.Canvas.reload({
|
||||||
'transition': true
|
'transition': true
|
||||||
});
|
});
|
||||||
|
|
|
@ -602,21 +602,17 @@ nf.Port = (function () {
|
||||||
* Reloads the port state from the server and refreshes the UI.
|
* Reloads the port state from the server and refreshes the UI.
|
||||||
* If the port is currently unknown, this function just returns.
|
* If the port is currently unknown, this function just returns.
|
||||||
*
|
*
|
||||||
* @param {object} port The port to reload
|
* @param {string} id The port id
|
||||||
*/
|
*/
|
||||||
reload: function (port) {
|
reload: function (id) {
|
||||||
if (portMap.has(port.id)) {
|
if (portMap.has(id)) {
|
||||||
var portEntity = portMap.get(port.id);
|
var portEntity = portMap.get(id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: portEntity.uri,
|
url: portEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
if (nf.Common.isDefinedAndNotNull(response.inputPort)) {
|
|
||||||
nf.Port.set(response);
|
nf.Port.set(response);
|
||||||
} else {
|
|
||||||
nf.Port.set(response);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1084,12 +1084,11 @@ nf.ProcessGroup = (function () {
|
||||||
* Reloads the process group state from the server and refreshes the UI.
|
* Reloads the process group state from the server and refreshes the UI.
|
||||||
* If the process group is currently unknown, this function reloads the canvas.
|
* If the process group is currently unknown, this function reloads the canvas.
|
||||||
*
|
*
|
||||||
* @param {object} processGroup The process group to reload
|
* @param {string} id The process group id
|
||||||
*/
|
*/
|
||||||
reload: function (processGroup) {
|
reload: function (id) {
|
||||||
if(nf.Common.isDefinedAndNotNull(processGroup)) {
|
if (processGroupMap.has(id)) {
|
||||||
if (processGroupMap.has(processGroup.id)) {
|
var processGroupEntity = processGroupMap.get(id);
|
||||||
var processGroupEntity = processGroupMap.get(processGroup.id);
|
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: processGroupEntity.uri,
|
url: processGroupEntity.uri,
|
||||||
|
@ -1098,11 +1097,6 @@ nf.ProcessGroup = (function () {
|
||||||
nf.ProcessGroup.set(response);
|
nf.ProcessGroup.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
nf.Canvas.reload({
|
|
||||||
'transition': true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -376,7 +376,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
$.each(connections, function (_, connection) {
|
$.each(connections, function (_, connection) {
|
||||||
if (connection.permissions.canRead) {
|
if (connection.permissions.canRead) {
|
||||||
if (connection.sourceId === processor.id) {
|
if (connection.sourceId === processor.id) {
|
||||||
nf.Connection.reload(connection.component);
|
nf.Connection.reload(connection.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -577,7 +577,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
var requests = [];
|
var requests = [];
|
||||||
|
|
||||||
// reload the processor in case an property descriptors have updated
|
// reload the processor in case an property descriptors have updated
|
||||||
requests.push(nf.Processor.reload(processor));
|
requests.push(nf.Processor.reload(processor.id));
|
||||||
|
|
||||||
// get the processor history
|
// get the processor history
|
||||||
requests.push($.ajax({
|
requests.push($.ajax({
|
||||||
|
@ -764,7 +764,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
// show the custom ui
|
// show the custom ui
|
||||||
nf.CustomUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () {
|
nf.CustomUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () {
|
||||||
// once the custom ui is closed, reload the processor
|
// once the custom ui is closed, reload the processor
|
||||||
nf.Processor.reload(processor);
|
nf.Processor.reload(processor.id);
|
||||||
|
|
||||||
// and reload the processor's outgoing connections
|
// and reload the processor's outgoing connections
|
||||||
reloadProcessorConnections(processor);
|
reloadProcessorConnections(processor);
|
||||||
|
|
|
@ -859,11 +859,11 @@ nf.Processor = (function () {
|
||||||
* Reloads the processor state from the server and refreshes the UI.
|
* Reloads the processor state from the server and refreshes the UI.
|
||||||
* If the processor is currently unknown, this function just returns.
|
* If the processor is currently unknown, this function just returns.
|
||||||
*
|
*
|
||||||
* @param {object} processor The processor to reload
|
* @param {string} id The processor id
|
||||||
*/
|
*/
|
||||||
reload: function (processor) {
|
reload: function (id) {
|
||||||
if (processorMap.has(processor.id)) {
|
if (processorMap.has(id)) {
|
||||||
var processorEntity = processorMap.get(processor.id);
|
var processorEntity = processorMap.get(id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: processorEntity.uri,
|
url: processorEntity.uri,
|
||||||
|
|
|
@ -166,7 +166,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
// if can modify, the over status of this node may have changed
|
// if can modify, the over status of this node may have changed
|
||||||
if (nf.CanvasUtils.canModify(remoteProcessGroup)) {
|
if (nf.CanvasUtils.canModify(remoteProcessGroup)) {
|
||||||
// reload the remote process group
|
// reload the remote process group
|
||||||
nf.RemoteProcessGroup.reload(remoteProcessGroupData.component);
|
nf.RemoteProcessGroup.reload(remoteProcessGroupData.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide the dialog
|
// hide the dialog
|
||||||
|
|
|
@ -930,11 +930,11 @@ nf.RemoteProcessGroup = (function () {
|
||||||
* Reloads the remote process group state from the server and refreshes the UI.
|
* Reloads the remote process group state from the server and refreshes the UI.
|
||||||
* If the remote process group is currently unknown, this function just returns.
|
* If the remote process group is currently unknown, this function just returns.
|
||||||
*
|
*
|
||||||
* @param {object} remoteProcessGroup The remote process group to reload
|
* @param {string} id The remote process group id
|
||||||
*/
|
*/
|
||||||
reload: function (remoteProcessGroup) {
|
reload: function (id) {
|
||||||
if (remoteProcessGroupMap.has(remoteProcessGroup.id)) {
|
if (remoteProcessGroupMap.has(id)) {
|
||||||
var remoteProcessGroupEntity = remoteProcessGroupMap.get(remoteProcessGroup.id);
|
var remoteProcessGroupEntity = remoteProcessGroupMap.get(id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: remoteProcessGroupEntity.uri,
|
url: remoteProcessGroupEntity.uri,
|
||||||
|
@ -943,10 +943,10 @@ nf.RemoteProcessGroup = (function () {
|
||||||
nf.RemoteProcessGroup.set(response);
|
nf.RemoteProcessGroup.set(response);
|
||||||
|
|
||||||
// reload the group's connections
|
// reload the group's connections
|
||||||
var connections = nf.Connection.getComponentConnections(remoteProcessGroup.id);
|
var connections = nf.Connection.getComponentConnections(id);
|
||||||
$.each(connections, function (_, connection) {
|
$.each(connections, function (_, connection) {
|
||||||
if (connection.permissions.canRead) {
|
if (connection.permissions.canRead) {
|
||||||
nf.Connection.reload(connection.component);
|
nf.Connection.reload(connection.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue