Merge pull request #13135 from vvlladd28/bug/js-library/delete-enable

Fixed bug in delete enabled calculation in JS library
This commit is contained in:
Igor Kulikov 2025-04-08 20:18:59 +03:00 committed by GitHub
commit 75d1f4ed35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,7 +97,7 @@ export class JsLibraryTableConfigResolver {
entity => checkBoxCell(entity.tenantId.id === NULL_UUID)), entity => checkBoxCell(entity.tenantId.id === NULL_UUID)),
); );
this.config.cellActionDescriptors = this.configureCellActions(getCurrentAuthUser(this.store)); this.config.cellActionDescriptors = this.configureCellActions();
this.config.groupActionDescriptors = [{ this.config.groupActionDescriptors = [{
name: this.translate.instant('action.delete'), name: this.translate.instant('action.delete'),
@ -137,6 +137,7 @@ export class JsLibraryTableConfigResolver {
resourceSubType: '' resourceSubType: ''
}; };
const authUser = getCurrentAuthUser(this.store); const authUser = getCurrentAuthUser(this.store);
this.config.deleteEnabled = (resource) => this.isResourceEditable(resource, authUser.authority);
this.config.entitySelectionEnabled = (resource) => this.isResourceEditable(resource, authUser.authority); this.config.entitySelectionEnabled = (resource) => this.isResourceEditable(resource, authUser.authority);
this.config.detailsReadonly = (resource) => this.detailsReadonly(resource, authUser.authority); this.config.detailsReadonly = (resource) => this.detailsReadonly(resource, authUser.authority);
return this.config; return this.config;
@ -309,7 +310,7 @@ export class JsLibraryTableConfigResolver {
} }
} }
private configureCellActions(authUser: AuthUser): Array<CellActionDescriptor<ResourceInfo>> { private configureCellActions(): Array<CellActionDescriptor<ResourceInfo>> {
const actions: Array<CellActionDescriptor<ResourceInfo>> = []; const actions: Array<CellActionDescriptor<ResourceInfo>> = [];
actions.push( actions.push(
{ {
@ -321,7 +322,7 @@ export class JsLibraryTableConfigResolver {
{ {
name: this.translate.instant('javascript.delete'), name: this.translate.instant('javascript.delete'),
icon: 'delete', icon: 'delete',
isEnabled: (resource) => this.isResourceEditable(resource, authUser.authority), isEnabled: (resource) => this.config.deleteEnabled(resource),
onAction: ($event, entity) => this.deleteResource($event, entity) onAction: ($event, entity) => this.deleteResource($event, entity)
}, },
); );