mirror of https://github.com/apache/nifi.git
NIFI-3246:
- Preventing the editing of controller services that are defined in an ancestor process group. - Adding a go to link for users to easily navigate to where services are actually defined. This closes #1594 Signed-off-by: Scott Aslan <scottyaslan@gmail.com>
This commit is contained in:
parent
78382c66bc
commit
768e89b579
|
@ -28,6 +28,7 @@
|
|||
<div id="general-process-group-configuration">
|
||||
<div class="setting">
|
||||
<div class="setting-name">Process group name</div>
|
||||
<span id="process-group-id" class="hidden"></span>
|
||||
<div class="editable setting-field">
|
||||
<input type="text" id="process-group-name" class="setting-input"/>
|
||||
</div>
|
||||
|
|
|
@ -753,23 +753,38 @@
|
|||
var markup = '';
|
||||
|
||||
if (dataContext.permissions.canRead && dataContext.permissions.canWrite) {
|
||||
if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') {
|
||||
markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
} else if (dataContext.component.state === 'DISABLED') {
|
||||
markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
|
||||
// if there are no validation errors allow enabling
|
||||
if (nfCommon.isEmpty(dataContext.component.validationErrors)) {
|
||||
markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
|
||||
var definedByCurrentGroup = false;
|
||||
if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
|
||||
// when opened in the process group context, the current group is store in #process-group-id
|
||||
if (dataContext.component.parentGroupId === $('#process-group-id').text()) {
|
||||
definedByCurrentGroup = true;
|
||||
}
|
||||
} else {
|
||||
// when there is no parent group, the service is defined at the controller level and should be editable
|
||||
definedByCurrentGroup = true;
|
||||
}
|
||||
|
||||
if (dataContext.component.persistsState === true) {
|
||||
markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
}
|
||||
if (definedByCurrentGroup === true) {
|
||||
if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') {
|
||||
markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
} else if (dataContext.component.state === 'DISABLED') {
|
||||
markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
|
||||
if (canWriteControllerServiceParent(dataContext)) {
|
||||
markup += '<div class="pointer delete-controller-service fa fa-trash" title="Remove" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
// if there are no validation errors allow enabling
|
||||
if (nfCommon.isEmpty(dataContext.component.validationErrors)) {
|
||||
markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (dataContext.component.persistsState === true) {
|
||||
markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
}
|
||||
|
||||
if (canWriteControllerServiceParent(dataContext)) {
|
||||
markup += '<div class="pointer delete-controller-service fa fa-trash" title="Remove" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
}
|
||||
} else {
|
||||
markup += '<div class="pointer go-to-controller-service fa fa-long-arrow-right" title="Go To" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -875,6 +890,24 @@
|
|||
|
||||
// close the settings dialog
|
||||
$('#shell-close-button').click();
|
||||
} else if (target.hasClass('go-to-controller-service')) {
|
||||
// load the parent group of the selected service
|
||||
nfProcessGroup.enterGroup(controllerServiceEntity.component.parentGroupId);
|
||||
|
||||
// open/select the specific service
|
||||
$.Deferred(function (deferred) {
|
||||
if ($('#process-group-configuration').is(':visible')) {
|
||||
nfProcessGroupConfiguration.loadConfiguration(controllerServiceEntity.component.parentGroupId).done(function () {
|
||||
deferred.resolve();
|
||||
});
|
||||
} else {
|
||||
nfProcessGroupConfiguration.showConfiguration(controllerServiceEntity.component.parentGroupId).done(function () {
|
||||
deferred.resolve();
|
||||
});
|
||||
}
|
||||
}).done(function () {
|
||||
nfProcessGroupConfiguration.selectControllerService(controllerServiceEntity.id);
|
||||
});
|
||||
}
|
||||
} else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') {
|
||||
if (target.hasClass('view-controller-service')) {
|
||||
|
|
|
@ -151,6 +151,23 @@
|
|||
}
|
||||
};
|
||||
|
||||
// record the group id
|
||||
$('#process-group-id').text(groupId);
|
||||
|
||||
// update the click listener
|
||||
$('#process-group-configuration-refresh-button').off('click').on('click', function () {
|
||||
loadConfiguration(groupId);
|
||||
});
|
||||
|
||||
// update the new controller service click listener
|
||||
$('#add-process-group-configuration-controller-service').off('click').on('click', function () {
|
||||
var selectedTab = $('#process-group-configuration-tabs li.selected-tab').text();
|
||||
if (selectedTab === 'Controller Services') {
|
||||
var controllerServicesUri = config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
|
||||
nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
|
||||
}
|
||||
});
|
||||
|
||||
var processGroup = $.Deferred(function (deferred) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
|
@ -164,7 +181,6 @@
|
|||
var processGroup = response.component;
|
||||
|
||||
// populate the process group settings
|
||||
$('#process-group-id').text(processGroup.id);
|
||||
$('#process-group-name').removeClass('unset').val(processGroup.name);
|
||||
$('#process-group-comments').removeClass('unset').val(processGroup.comments);
|
||||
|
||||
|
@ -253,6 +269,7 @@
|
|||
$('#process-group-configuration-save').mouseout();
|
||||
|
||||
// reset the fields
|
||||
$('#process-group-id').text('');
|
||||
$('#process-group-name').val('');
|
||||
$('#process-group-comments').val('');
|
||||
|
||||
|
@ -330,21 +347,6 @@
|
|||
* Shows the settings dialog.
|
||||
*/
|
||||
showConfiguration: function (groupId) {
|
||||
// update the click listener
|
||||
$('#process-group-configuration-refresh-button').off('click').on('click', function () {
|
||||
loadConfiguration(groupId);
|
||||
});
|
||||
|
||||
// update the new controller service click listener
|
||||
$('#add-process-group-configuration-controller-service').off('click').on('click', function () {
|
||||
var selectedTab = $('#process-group-configuration-tabs li.selected-tab').text();
|
||||
if (selectedTab === 'Controller Services') {
|
||||
var controllerServicesUri = config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
|
||||
nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
|
||||
}
|
||||
});
|
||||
|
||||
// load the configuration
|
||||
return loadConfiguration(groupId).done(showConfiguration);
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue