Skip to content

Commit

Permalink
fix(kubernetes): post strategic patch body as object
Browse files Browse the repository at this point in the history
  • Loading branch information
maggieneterval committed Jan 28, 2019
1 parent 51a8542 commit 65c2601
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ export class KubernetesV2PatchManifestConfigCtrl implements IController {

public handlePatchBodyChange = (rawPatchBody: string, patchBody: any): void => {
this.rawPatchBody = rawPatchBody;
this.$scope.stage.patchBody = patchBody;
if (this.getEditorMode() === EditorMode.yaml) {
// YamlEditor patchBody is list of YAML documents, take first as patch
this.$scope.stage.patchBody = Array.isArray(patchBody) && patchBody.length > 0 ? patchBody[0] : null;
} else {
this.$scope.stage.patchBody = patchBody;
}
// Called from a React component.
this.$scope.$applyAsync();
};
Expand Down Expand Up @@ -115,8 +120,8 @@ export class KubernetesV2PatchManifestConfigCtrl implements IController {
}
};

public handleMergeStrategyChange = (mergeStrategy: MergeStrategy): void => {
this.setRawPatchBody(mergeStrategy);
public handleMergeStrategyChange = (): void => {
this.handlePatchBodyChange('', null);
this.$scope.$applyAsync();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class KubernetesPatchManifestOptionsFormComponent implements IComponentOptions {
<div class="input-group">
<select class="form-control input-sm"
ng-model="ctrl.options.mergeStrategy"
ng-change="ctrl.onChange(ctrl.options.mergeStrategy)">
ng-change="ctrl.onChange()">
<option ng-repeat="strategy in ctrl.mergeStrategies" value="{{strategy}}"
ng-selected="ctrl.options.mergeStrategy === strategy">
{{strategy}}
Expand Down

0 comments on commit 65c2601

Please sign in to comment.