fix(stack): incorrect stack name (#6587)

pull/6603/head
Hao Zhang 2022-02-27 16:04:48 +08:00 committed by GitHub
parent d71d291895
commit eaffde39f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -65,7 +65,7 @@
<tr ng-if="$ctrl.resourceControl.Type === $ctrl.RCTI.STACK && $ctrl.resourceType !== $ctrl.RCTS.STACK">
<td colspan="2">
<i class="fa fa-info-circle" aria-hidden="true" style="margin-right: 2px"></i>
Access control on this resource is inherited from the following stack: {{ $ctrl.resourceControl.ResourceId }}
Access control on this resource is inherited from the following stack: {{ $ctrl.removeEndpointId($ctrl.resourceControl.ResourceId) }}
<portainer-tooltip
message="Access control applied on a stack is also applied on each resource in the stack."
position="bottom"

View File

@ -56,6 +56,17 @@ angular.module('portainer.app').controller('porAccessControlPanelController', [
});
};
ctrl.removeEndpointId = function (stackName) {
if (!stackName) {
return stackName;
}
const firstUnderlineIndex = stackName.indexOf('_');
if (firstUnderlineIndex < 0) {
return stackName;
}
return stackName.substring(firstUnderlineIndex + 1);
};
function validateForm() {
ctrl.state.formValidationError = '';
var error = '';