From 3371e177c68edf8b539f2b12b44802fd2b8ce75e Mon Sep 17 00:00:00 2001 From: Nancy Butler <42977925+mantis-toboggan-md@users.noreply.github.com> Date: Thu, 17 Dec 2020 15:00:41 -0700 Subject: [PATCH 1/2] add viewconfig action --- plugins/steve/resource-instance.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/steve/resource-instance.js b/plugins/steve/resource-instance.js index 6ec18294eee..e8415afd1c8 100644 --- a/plugins/steve/resource-instance.js +++ b/plugins/steve/resource-instance.js @@ -30,7 +30,7 @@ import { import { ANNOTATIONS_TO_IGNORE_REGEX, DESCRIPTION, LABELS_TO_IGNORE_REGEX } from '@/config/labels-annotations'; import { - AS, _YAML, MODE, _CLONE, _EDIT, _VIEW, _UNFLAG + AS, _YAML, MODE, _CLONE, _EDIT, _VIEW, _UNFLAG, _CONFIG } from '@/config/query-params'; import { cleanForNew, normalizeType } from './normalize'; @@ -618,13 +618,13 @@ export default { const all = [ { divider: true }, { - action: 'goToEdit', + action: this.canUpdate ? 'goToEdit' : 'goToViewConfig', label: this.t(this.canUpdate ? 'action.edit' : 'action.view'), icon: 'icon icon-edit', enabled: this.canCustomEdit, }, { - action: 'goToEditYaml', + action: this.canUpdate ? 'goToEditYaml' : 'goToViewYaml', label: this.t(this.canUpdate ? 'action.editYaml' : 'action.viewYaml'), icon: 'icon icon-file', enabled: this.canYaml, @@ -946,6 +946,21 @@ export default { }; }, + goToViewConfig() { + return (moreQuery = {}) => { + const location = this.detailLocation; + + location.query = { + ...location.query, + [MODE]: _VIEW, + [AS]: _CONFIG, + ...moreQuery + }; + + this.currentRouter().push(location); + }; + }, + goToEditYaml() { return () => { const location = this.detailLocation; From f5b9fb4c13a2a060e2d0b91799ae1a6d457cc2ea Mon Sep 17 00:00:00 2001 From: Nancy Butler <42977925+mantis-toboggan-md@users.noreply.github.com> Date: Mon, 21 Dec 2020 10:35:28 -0700 Subject: [PATCH 2/2] yaml btn errors --- components/ResourceYaml.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ResourceYaml.vue b/components/ResourceYaml.vue index 1b1bc91f72a..5fdc0e1185d 100644 --- a/components/ResourceYaml.vue +++ b/components/ResourceYaml.vue @@ -255,7 +255,7 @@ export default { await this.$emit('apply-hooks', BEFORE_SAVE_HOOKS); try { - this.value.saveYaml(yaml); + await this.value.saveYaml(yaml); } catch (err) { return onError.call(this, err); }