I've added some buttons via extending views/details this way
They are displayed fine for admin users. For users with appropriate permission, their display varies with how you open entity details
Steps to recreate
1. Click on an entity in the main menu
2. Click on an item to enter entity details
(button is not displayed)
3. Refresh the page
(button is displayed)
4. Click on an entity name (not in the menu)
5. Click on an item to enter entity details
(button is not displayed)
6. Click on another entity in the menu.
7. Click on the target entity
8. Click on the entity item
(button is displayed)
I believe that it's a matter of caching buttons or rendered views.
Extending views/record/detail won't work as it has no addMenuItem function in it, and can not be called thus.
Setting button with adding them in clientDefs is an option though, but I do not know how to check getPermissionLevel globally, not for a particular entity
Code:
define(['views/detail'], (DetailView) => { return class DetailExtendView extends DetailView{ setup(){ super.setup(); ..... if (this.getAcl().getPermissionLevel('gw') === 'team' || this.getAcl().getPermissionLevel('gw') === 'all' ) { this.addMenuItem('buttons', { name: 'add-gw', iconHtml: '<span class="fas fa-suitcase" style="color:#e5e5e5"></span>', className: 'btn-success', acl: 'edit', text: this.translate('Add GW'), onClick: () => this.actionAddGw(), }); }
They are displayed fine for admin users. For users with appropriate permission, their display varies with how you open entity details
Steps to recreate
1. Click on an entity in the main menu
2. Click on an item to enter entity details
(button is not displayed)
3. Refresh the page
(button is displayed)
4. Click on an entity name (not in the menu)
5. Click on an item to enter entity details
(button is not displayed)
6. Click on another entity in the menu.
7. Click on the target entity
8. Click on the entity item
(button is displayed)
I believe that it's a matter of caching buttons or rendered views.
Extending views/record/detail won't work as it has no addMenuItem function in it, and can not be called thus.
Setting button with adding them in clientDefs is an option though, but I do not know how to check getPermissionLevel globally, not for a particular entity
Comment