Skip to content

Commit

Permalink
Merge pull request #2124 from mantis-toboggan-md/bugfix-view-config
Browse files Browse the repository at this point in the history
yaml save button error display
  • Loading branch information
vincent99 committed Dec 21, 2020
2 parents ee25967 + f5b9fb4 commit 75b275f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/ResourceYaml.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
21 changes: 18 additions & 3 deletions plugins/steve/resource-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 75b275f

Please sign in to comment.