Move can delete check to instance method and override cluster check

rancher/dashboard#530
This commit is contained in:
Westly Wright 2020-04-27 12:18:06 -07:00
parent 5ab5ae7eb5
commit 22182006d8
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
2 changed files with 11 additions and 2 deletions

View File

@ -43,4 +43,8 @@ export default {
return this.$rootGetters['i18n/t']('cluster.provider.importedconfig');
}
},
canDelete() {
return this.hasLink('remove') && !this?.spec?.internal;
},
};

View File

@ -404,7 +404,6 @@ export default {
const canCreate = (this.schema?.attributes?.verbs || []).includes('create') && this.$rootGetters['type-map/isCreatable'](this.type);
const canUpdate = !!links.update && this.$rootGetters['type-map/isEditable'](this.type);
const canViewInApi = this.$rootGetters['prefs/get'](DEV);
const canDelete = !!links.remove;
const hasYaml = this.hasLink('rioview') || this.hasLink('view');
const all = [
@ -454,7 +453,7 @@ export default {
label: 'Delete',
icon: 'icon icon-fw icon-trash',
bulkable: true,
enabled: canDelete,
enabled: this.canDelete,
bulkAction: 'promptRemove',
},
{ divider: true },
@ -481,6 +480,12 @@ export default {
// ------------------------------------------------------------------
canDelete() {
return this.hasLink('remove');
},
// ------------------------------------------------------------------
hasLink() {
return (linkName) => {
return !!this.linkFor(linkName);