Move test for blocked-PUT into canEditYaml getter

This commit is contained in:
Jordon Leach 2021-11-03 09:50:40 -04:00
parent 3cfc9840ba
commit df8fe73dd7
1 changed files with 7 additions and 3 deletions

View File

@ -603,8 +603,8 @@ export default class Resource {
enabled: this.canCustomEdit,
},
{
action: this.canUpdate ? 'goToEditYaml' : 'goToViewYaml',
label: this.t(this.canUpdate ? 'action.editYaml' : 'action.viewYaml'),
action: this.canEditYaml ? 'goToEditYaml' : 'goToViewYaml',
label: this.t(this.canEditYaml ? 'action.editYaml' : 'action.viewYaml'),
icon: 'icon icon-file',
enabled: this.canYaml,
},
@ -680,7 +680,11 @@ export default class Resource {
}
get canYaml() {
return this.hasLink('view') && !this.schema?.resourceMethods.find(x => x === 'blocked-PUT'); // 'blocked-PUT' will prevent config from saving when editing as yaml
return this.hasLink('view');
}
get canEditYaml() {
return this.schema?.resourceMethods.find(x => x === 'blocked-PUT') ? false : this.canUpdate;
}
// ------------------------------------------------------------------