mirror of https://github.com/apache/nifi.git
NIFI-259:
- Code clean up. - Adding component state actions to the controller service and reporting task tables.
This commit is contained in:
parent
65dfcd06a3
commit
ae6f615365
|
@ -596,7 +596,7 @@ public class ControllerServiceResource extends ApplicationResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the component state
|
// get the component state
|
||||||
final ComponentStateDTO descriptor = serviceFacade.getControllerServiceState(id);
|
final ComponentStateDTO state = serviceFacade.getControllerServiceState(id);
|
||||||
|
|
||||||
// create the revision
|
// create the revision
|
||||||
final RevisionDTO revision = new RevisionDTO();
|
final RevisionDTO revision = new RevisionDTO();
|
||||||
|
@ -605,7 +605,7 @@ public class ControllerServiceResource extends ApplicationResource {
|
||||||
// generate the response entity
|
// generate the response entity
|
||||||
final ComponentStateEntity entity = new ComponentStateEntity();
|
final ComponentStateEntity entity = new ComponentStateEntity();
|
||||||
entity.setRevision(revision);
|
entity.setRevision(revision);
|
||||||
entity.setComponentState(descriptor);
|
entity.setComponentState(state);
|
||||||
|
|
||||||
// generate the response
|
// generate the response
|
||||||
return clusterContext(generateOkResponse(entity)).build();
|
return clusterContext(generateOkResponse(entity)).build();
|
||||||
|
|
|
@ -606,7 +606,7 @@ public class ProcessorResource extends ApplicationResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the component state
|
// get the component state
|
||||||
final ComponentStateDTO descriptor = serviceFacade.getProcessorState(groupId, id);
|
final ComponentStateDTO state = serviceFacade.getProcessorState(groupId, id);
|
||||||
|
|
||||||
// create the revision
|
// create the revision
|
||||||
final RevisionDTO revision = new RevisionDTO();
|
final RevisionDTO revision = new RevisionDTO();
|
||||||
|
@ -615,7 +615,7 @@ public class ProcessorResource extends ApplicationResource {
|
||||||
// generate the response entity
|
// generate the response entity
|
||||||
final ComponentStateEntity entity = new ComponentStateEntity();
|
final ComponentStateEntity entity = new ComponentStateEntity();
|
||||||
entity.setRevision(revision);
|
entity.setRevision(revision);
|
||||||
entity.setComponentState(descriptor);
|
entity.setComponentState(state);
|
||||||
|
|
||||||
// generate the response
|
// generate the response
|
||||||
return clusterContext(generateOkResponse(entity)).build();
|
return clusterContext(generateOkResponse(entity)).build();
|
||||||
|
|
|
@ -589,7 +589,7 @@ public class ReportingTaskResource extends ApplicationResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the component state
|
// get the component state
|
||||||
final ComponentStateDTO descriptor = serviceFacade.getReportingTaskState(id);
|
final ComponentStateDTO state = serviceFacade.getReportingTaskState(id);
|
||||||
|
|
||||||
// create the revision
|
// create the revision
|
||||||
final RevisionDTO revision = new RevisionDTO();
|
final RevisionDTO revision = new RevisionDTO();
|
||||||
|
@ -598,7 +598,7 @@ public class ReportingTaskResource extends ApplicationResource {
|
||||||
// generate the response entity
|
// generate the response entity
|
||||||
final ComponentStateEntity entity = new ComponentStateEntity();
|
final ComponentStateEntity entity = new ComponentStateEntity();
|
||||||
entity.setRevision(revision);
|
entity.setRevision(revision);
|
||||||
entity.setComponentState(descriptor);
|
entity.setComponentState(state);
|
||||||
|
|
||||||
// generate the response
|
// generate the response
|
||||||
return clusterContext(generateOkResponse(entity)).build();
|
return clusterContext(generateOkResponse(entity)).build();
|
||||||
|
|
|
@ -120,6 +120,10 @@ nf.ComponentState = (function () {
|
||||||
var componentStateGrid = $('#component-state-table').data('gridInstance');
|
var componentStateGrid = $('#component-state-table').data('gridInstance');
|
||||||
var componentStateData = componentStateGrid.getData();
|
var componentStateData = componentStateGrid.getData();
|
||||||
componentStateData.setItems([]);
|
componentStateData.setItems([]);
|
||||||
|
|
||||||
|
// clear the total number entries
|
||||||
|
$('#displayed-component-state-entries').text('0');
|
||||||
|
$('#total-component-state-entries').text('0');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +173,6 @@ nf.ComponentState = (function () {
|
||||||
// clear the fields
|
// clear the fields
|
||||||
$('#component-state-name').text('');
|
$('#component-state-name').text('');
|
||||||
$('#component-state-description').text('');
|
$('#component-state-description').text('');
|
||||||
$('#total-component-state-entries').text('');
|
|
||||||
|
|
||||||
// clear any filter strings
|
// clear any filter strings
|
||||||
$('#component-state-filter').addClass(config.styles.filterList).val(config.filterText);
|
$('#component-state-filter').addClass(config.styles.filterList).val(config.filterText);
|
||||||
|
@ -202,9 +205,9 @@ nf.ComponentState = (function () {
|
||||||
// initialize the processor configuration dialog
|
// initialize the processor configuration dialog
|
||||||
$('#component-state-dialog').modal({
|
$('#component-state-dialog').modal({
|
||||||
headerText: 'Component State',
|
headerText: 'Component State',
|
||||||
overlayBackground: true,
|
overlayBackground: false,
|
||||||
buttons: [{
|
buttons: [{
|
||||||
buttonText: 'Ok',
|
buttonText: 'Close',
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: function () {
|
||||||
$(this).modal('hide');
|
$(this).modal('hide');
|
||||||
|
@ -327,6 +330,7 @@ nf.ComponentState = (function () {
|
||||||
|
|
||||||
// initialize the number of display items
|
// initialize the number of display items
|
||||||
$('#displayed-component-state-entries').text('0');
|
$('#displayed-component-state-entries').text('0');
|
||||||
|
$('#total-component-state-entries').text('0');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -601,11 +601,15 @@ nf.Settings = (function () {
|
||||||
// more details formatter
|
// more details formatter
|
||||||
var moreControllerServiceDetails = function (row, cell, value, columnDef, dataContext) {
|
var moreControllerServiceDetails = function (row, cell, value, columnDef, dataContext) {
|
||||||
var markup = '<img src="images/iconDetails.png" title="View Details" class="pointer view-controller-service" style="margin-top: 5px; float: left;" />';
|
var markup = '<img src="images/iconDetails.png" title="View Details" class="pointer view-controller-service" style="margin-top: 5px; float: left;" />';
|
||||||
|
|
||||||
|
// always include a button to view the usage
|
||||||
|
markup += '<img src="images/iconUsage.png" title="Usage" class="pointer controller-service-usage" style="margin-left: 6px; margin-top: 3px; float: left;" />';
|
||||||
|
|
||||||
var hasErrors = !nf.Common.isEmpty(dataContext.validationErrors);
|
var hasErrors = !nf.Common.isEmpty(dataContext.validationErrors);
|
||||||
var hasBulletins = !nf.Common.isEmpty(dataContext.bulletins);
|
var hasBulletins = !nf.Common.isEmpty(dataContext.bulletins);
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
markup += '<img src="images/iconAlert.png" class="has-errors" style="margin-top: 4px; margin-left: 1px; float: left;" />';
|
markup += '<img src="images/iconAlert.png" class="has-errors" style="margin-top: 4px; margin-left: 3px; float: left;" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBulletins) {
|
if (hasBulletins) {
|
||||||
|
@ -649,31 +653,33 @@ nf.Settings = (function () {
|
||||||
var controllerServiceActionFormatter = function (row, cell, value, columnDef, dataContext) {
|
var controllerServiceActionFormatter = function (row, cell, value, columnDef, dataContext) {
|
||||||
var markup = '';
|
var markup = '';
|
||||||
|
|
||||||
// only DFMs can edit a controller service
|
// only DFMs can edit a controller service and view state
|
||||||
if (nf.Common.isDFM()) {
|
if (nf.Common.isDFM()) {
|
||||||
if (dataContext.state === 'ENABLED' || dataContext.state === 'ENABLING') {
|
if (dataContext.state === 'ENABLED' || dataContext.state === 'ENABLING') {
|
||||||
markup += '<img src="images/iconDisable.png" title="Disable" class="pointer disable-controller-service" style="margin-top: 2px;" /> ';
|
markup += '<img src="images/iconDisable.png" title="Disable" class="pointer disable-controller-service" style="margin-top: 2px;" />';
|
||||||
} else if (dataContext.state === 'DISABLED') {
|
} else if (dataContext.state === 'DISABLED') {
|
||||||
markup += '<img src="images/iconEdit.png" title="Edit" class="pointer edit-controller-service" style="margin-top: 2px;" /> ';
|
markup += '<img src="images/iconEdit.png" title="Edit" class="pointer edit-controller-service" style="margin-top: 2px;" />';
|
||||||
|
|
||||||
// if there are no validation errors allow enabling
|
// if there are no validation errors allow enabling
|
||||||
if (nf.Common.isEmpty(dataContext.validationErrors)) {
|
if (nf.Common.isEmpty(dataContext.validationErrors)) {
|
||||||
markup += '<img src="images/iconEnable.png" title="Enable" class="pointer enable-controller-service" style="margin-top: 2px;"/> ';
|
markup += '<img src="images/iconEnable.png" title="Enable" class="pointer enable-controller-service" style="margin-top: 2px; margin-left: 3px;"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
markup += '<img src="images/iconDelete.png" title="Remove" class="pointer delete-controller-service" style="margin-top: 2px;" /> ';
|
markup += '<img src="images/iconDelete.png" title="Remove" class="pointer delete-controller-service" style="margin-top: 2px; margin-left: 3px;" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataContext.persistsState === true) {
|
||||||
|
markup += '<img src="images/iconViewState.png" title="View State" class="pointer view-state-controller-service" style="margin-top: 2px; margin-left: 3px;" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// always include a button to view the usage
|
|
||||||
markup += '<img src="images/iconUsage.png" title="Usage" class="pointer controller-service-usage" style="margin-top: 2px;"/> ';
|
|
||||||
|
|
||||||
return markup;
|
return markup;
|
||||||
};
|
};
|
||||||
|
|
||||||
// define the column model for the controller services table
|
// define the column model for the controller services table
|
||||||
var controllerServicesColumns = [
|
var controllerServicesColumns = [
|
||||||
{id: 'moreDetails', name: ' ', resizable: false, formatter: moreControllerServiceDetails, sortable: false, width: 65, maxWidth: 65},
|
{id: 'moreDetails', name: ' ', resizable: false, formatter: moreControllerServiceDetails, sortable: false, width: 90, maxWidth: 90},
|
||||||
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
|
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
|
||||||
{id: 'type', field: 'type', name: 'Type', formatter: typeFormatter, sortable: true, resizable: true},
|
{id: 'type', field: 'type', name: 'Type', formatter: typeFormatter, sortable: true, resizable: true},
|
||||||
{id: 'state', field: 'state', name: 'State', formatter: controllerServiceStateFormatter, sortable: true, resizeable: true}
|
{id: 'state', field: 'state', name: 'State', formatter: controllerServiceStateFormatter, sortable: true, resizeable: true}
|
||||||
|
@ -728,20 +734,22 @@ nf.Settings = (function () {
|
||||||
nf.ControllerService.disable(controllerService);
|
nf.ControllerService.disable(controllerService);
|
||||||
} else if (target.hasClass('delete-controller-service')) {
|
} else if (target.hasClass('delete-controller-service')) {
|
||||||
nf.ControllerService.remove(controllerService);
|
nf.ControllerService.remove(controllerService);
|
||||||
} else if (target.hasClass('controller-service-usage')) {
|
} else if (target.hasClass('view-state-controller-service')) {
|
||||||
// close the settings dialog
|
nf.ComponentState.showState(controllerService, controllerService.state === 'DISABLED');
|
||||||
$('#shell-close-button').click();
|
|
||||||
|
|
||||||
// open the documentation for this reporting task
|
|
||||||
nf.Shell.showPage('../nifi-docs/documentation?' + $.param({
|
|
||||||
select: nf.Common.substringAfterLast(controllerService.type, '.')
|
|
||||||
})).done(function() {
|
|
||||||
nf.Settings.showSettings();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') {
|
} else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') {
|
||||||
if (target.hasClass('view-controller-service')) {
|
if (target.hasClass('view-controller-service')) {
|
||||||
nf.ControllerService.showDetails(controllerService);
|
nf.ControllerService.showDetails(controllerService);
|
||||||
|
} else if (target.hasClass('controller-service-usage')) {
|
||||||
|
// close the settings dialog
|
||||||
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
|
// open the documentation for this reporting task
|
||||||
|
nf.Shell.showPage('../nifi-docs/documentation?' + $.param({
|
||||||
|
select: nf.Common.substringAfterLast(controllerService.type, '.')
|
||||||
|
})).done(function() {
|
||||||
|
nf.Settings.showSettings();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1248,11 +1256,15 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
var moreReportingTaskDetails = function (row, cell, value, columnDef, dataContext) {
|
var moreReportingTaskDetails = function (row, cell, value, columnDef, dataContext) {
|
||||||
var markup = '<img src="images/iconDetails.png" title="View Details" class="pointer view-reporting-task" style="margin-top: 5px; float: left;" />';
|
var markup = '<img src="images/iconDetails.png" title="View Details" class="pointer view-reporting-task" style="margin-top: 5px; float: left;" />';
|
||||||
|
|
||||||
|
// always include a button to view the usage
|
||||||
|
markup += '<img src="images/iconUsage.png" title="Usage" class="pointer reporting-task-usage" style="margin-left: 6px; margin-top: 3px;"/>';
|
||||||
|
|
||||||
var hasErrors = !nf.Common.isEmpty(dataContext.validationErrors);
|
var hasErrors = !nf.Common.isEmpty(dataContext.validationErrors);
|
||||||
var hasBulletins = !nf.Common.isEmpty(dataContext.bulletins);
|
var hasBulletins = !nf.Common.isEmpty(dataContext.bulletins);
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
markup += '<img src="images/iconAlert.png" class="has-errors" style="margin-top: 4px; margin-left: 1px; float: left;" />';
|
markup += '<img src="images/iconAlert.png" class="has-errors" style="margin-top: 4px; margin-left: 3px; float: left;" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBulletins) {
|
if (hasBulletins) {
|
||||||
|
@ -1295,31 +1307,33 @@ nf.Settings = (function () {
|
||||||
var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) {
|
var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) {
|
||||||
var markup = '';
|
var markup = '';
|
||||||
|
|
||||||
// only DFMs can edit reporting tasks
|
// only DFMs can edit reporting tasks and view state
|
||||||
if (nf.Common.isDFM()) {
|
if (nf.Common.isDFM()) {
|
||||||
if (dataContext.state === 'RUNNING') {
|
if (dataContext.state === 'RUNNING') {
|
||||||
markup += '<img src="images/iconStop.png" title="Stop" class="pointer stop-reporting-task" style="margin-top: 2px;" /> ';
|
markup += '<img src="images/iconStop.png" title="Stop" class="pointer stop-reporting-task" style="margin-top: 2px;" />';
|
||||||
} else if (dataContext.state === 'STOPPED' || dataContext.state === 'DISABLED') {
|
} else if (dataContext.state === 'STOPPED' || dataContext.state === 'DISABLED') {
|
||||||
markup += '<img src="images/iconEdit.png" title="Edit" class="pointer edit-reporting-task" style="margin-top: 2px;" /> ';
|
markup += '<img src="images/iconEdit.png" title="Edit" class="pointer edit-reporting-task" style="margin-top: 2px;" />';
|
||||||
|
|
||||||
// support starting when stopped and no validation errors
|
// support starting when stopped and no validation errors
|
||||||
if (dataContext.state === 'STOPPED' && nf.Common.isEmpty(dataContext.validationErrors)) {
|
if (dataContext.state === 'STOPPED' && nf.Common.isEmpty(dataContext.validationErrors)) {
|
||||||
markup += '<img src="images/iconRun.png" title="Start" class="pointer start-reporting-task" style="margin-top: 2px;"/> ';
|
markup += '<img src="images/iconRun.png" title="Start" class="pointer start-reporting-task" style="margin-top: 2px; margin-left: 3px;"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
markup += '<img src="images/iconDelete.png" title="Remove" class="pointer delete-reporting-task" style="margin-top: 2px;" /> ';
|
markup += '<img src="images/iconDelete.png" title="Remove" class="pointer delete-reporting-task" style="margin-top: 2px; margin-left: 3px;" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataContext.persistsState === true) {
|
||||||
|
markup += '<img src="images/iconViewState.png" title="View State" class="pointer view-state-reporting-task" style="margin-top: 2px; margin-left: 3px;" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// always include a button to view the usage
|
|
||||||
markup += '<img src="images/iconUsage.png" title="Usage" class="pointer reporting-task-usage" style="margin-top: 2px;"/> ';
|
|
||||||
|
|
||||||
return markup;
|
return markup;
|
||||||
};
|
};
|
||||||
|
|
||||||
// define the column model for the reporting tasks table
|
// define the column model for the reporting tasks table
|
||||||
var reportingTasksColumnModel = [
|
var reportingTasksColumnModel = [
|
||||||
{id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 65, maxWidth: 65},
|
{id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 90, maxWidth: 90},
|
||||||
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
|
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
|
||||||
{id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter},
|
{id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter},
|
||||||
{id: 'state', field: 'state', name: 'Run Status', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter}
|
{id: 'state', field: 'state', name: 'Run Status', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter}
|
||||||
|
@ -1374,20 +1388,23 @@ nf.Settings = (function () {
|
||||||
nf.ReportingTask.stop(reportingTask);
|
nf.ReportingTask.stop(reportingTask);
|
||||||
} else if (target.hasClass('delete-reporting-task')) {
|
} else if (target.hasClass('delete-reporting-task')) {
|
||||||
nf.ReportingTask.remove(reportingTask);
|
nf.ReportingTask.remove(reportingTask);
|
||||||
} else if (target.hasClass('reporting-task-usage')) {
|
} else if (target.hasClass('view-state-reporting-task')) {
|
||||||
// close the settings dialog
|
var canClear = reportingTask.state === 'STOPPED' && reportingTask.activeThreadCount === 0;
|
||||||
$('#shell-close-button').click();
|
nf.ComponentState.showState(reportingTask, canClear);
|
||||||
|
|
||||||
// open the documentation for this reporting task
|
|
||||||
nf.Shell.showPage('../nifi-docs/documentation?' + $.param({
|
|
||||||
select: nf.Common.substringAfterLast(reportingTask.type, '.')
|
|
||||||
})).done(function() {
|
|
||||||
nf.Settings.showSettings();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') {
|
} else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') {
|
||||||
if (target.hasClass('view-reporting-task')) {
|
if (target.hasClass('view-reporting-task')) {
|
||||||
nf.ReportingTask.showDetails(reportingTask);
|
nf.ReportingTask.showDetails(reportingTask);
|
||||||
|
} else if (target.hasClass('reporting-task-usage')) {
|
||||||
|
// close the settings dialog
|
||||||
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
|
// open the documentation for this reporting task
|
||||||
|
nf.Shell.showPage('../nifi-docs/documentation?' + $.param({
|
||||||
|
select: nf.Common.substringAfterLast(reportingTask.type, '.')
|
||||||
|
})).done(function() {
|
||||||
|
nf.Settings.showSettings();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue