mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
fix: some actions should be hidden for read-only user (#855)
* fix: some actions limited for virt-viewer Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: based on schema collectionMethods Signed-off-by: Andy Lee <andy.lee@suse.com> * fix: conditionally add migrate action to available actions * fix: update collectionMethods check to use find for case-insensitive matching * fix: update canEditClusterMembers method to use schema for collectionMethods * fix: update canCreateImage check to use case-insensitive matching --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
|
||||
import shellProject from '@shell/models/management.cattle.io.project';
|
||||
|
||||
// This model controls `Project / Namespace` page in rancher integration mode
|
||||
// Extend management.cattle.io.project model from shell
|
||||
export default class Project extends shellProject {
|
||||
get _availableActions() {
|
||||
const canUpdate = !!this.linkFor('update');
|
||||
|
||||
// disable `Edit Config` action if user does not have update permission.
|
||||
return super._availableActions.map((action) => {
|
||||
if (action.action === 'goToEdit') {
|
||||
return { ...action, enabled: canUpdate };
|
||||
}
|
||||
|
||||
return action;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user