Skip to content

Commit

Permalink
fix: conflict over extensible table actions button generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeyyeKurtulus committed May 14, 2024
1 parent c9dc968 commit 6c65e85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*ngTemplateOutlet="actionsTemplate || gridActions; context: { $implicit: row, index: i }"
></ng-container>
<ng-template #gridActions>
@if (hasAvailableActions(i, row)) {
@if (hasAvailableActions(row)) {
<abp-grid-actions [index]="i" [record]="row" text="AbpUi::Actions"></abp-grid-actions>
}
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,20 @@ export class ExtensibleTableComponent<R = any> implements OnChanges {
});
}

hasAvailableActions(index, row): boolean {
const { permission, visible } = this.actionList.get(index).value;
return this.permissionService.getGrantedPolicy(permission) && visible(row);
hasAvailableActions(rowData): boolean {
let isActionAvailable = true;
this.actionList.toArray().map(action => {
const { visible, permission } = action;
if (rowData && action) {
const visibilityCheck = visible({
record: rowData,
getInjected: this.getInjected,
});
const permissionCheck = this.permissionService.getGrantedPolicy(permission);

isActionAvailable = visibilityCheck && permissionCheck;
}
});
return isActionAvailable;
}
}

0 comments on commit 6c65e85

Please sign in to comment.