NIFI-4591:

- Ensuring View Details button is visible if the user has read access and the service is defined in the current Process Group.

This closes #2262

Signed-off-by: Scott Aslan <scottyaslan@gmail.com>
This commit is contained in:
Matt Gilman 2017-11-09 12:48:42 -05:00 committed by Scott Aslan
parent f11e03886f
commit 387dce5ad0
1 changed files with 27 additions and 18 deletions

View File

@ -844,7 +844,7 @@
var controllerServiceActionFormatter = function (row, cell, value, columnDef, dataContext) { var controllerServiceActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = ''; var markup = '';
if (dataContext.permissions.canRead && dataContext.permissions.canWrite) { if (dataContext.permissions.canRead) {
var definedByCurrentGroup = false; var definedByCurrentGroup = false;
if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
// when opened in the process group context, the current group is store in #process-group-id // when opened in the process group context, the current group is store in #process-group-id
@ -857,6 +857,8 @@
} }
if (definedByCurrentGroup === true) { if (definedByCurrentGroup === true) {
if (dataContext.permissions.canWrite) {
// write permission... allow actions based on the current state of the service
if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') { if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') {
markup += '<div class="pointer view-controller-service fa fa-gear" title="View Configuration" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div class="pointer view-controller-service fa fa-gear" title="View Configuration" style="margin-top: 2px; margin-right: 3px;" ></div>';
markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>';
@ -881,6 +883,13 @@
markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>';
} }
} else { } else {
// no write permission... allow viewing configuration if in current group
if (definedByCurrentGroup === true) {
markup += '<div class="pointer view-controller-service fa fa-gear" title="View Configuration" style="margin-top: 2px; margin-right: 3px;" ></div>';
}
}
} else {
// not defined in current group... show go to arrow
markup += '<div class="pointer go-to-controller-service fa fa-long-arrow-right" title="Go To" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div class="pointer go-to-controller-service fa fa-long-arrow-right" title="Go To" style="margin-top: 2px; margin-right: 3px;" ></div>';
} }
} }