Skip to content

Commit

Permalink
fix(provider/kubernetes): add error message when manifest yaml isn't …
Browse files Browse the repository at this point in the history
…valid (#4739)
  • Loading branch information
Scott Bloch-Wehba-Seaward authored Jan 30, 2018
1 parent a5a68f2 commit efbeef4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface IKubernetesManifestCommand {

export interface IKubernetesManifestCommandMetadata {
manifestText: string;
yamlError: boolean;
backingData: any;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IComponentOptions, IController, module } from 'angular';

import { IKubernetesManifestCommand, IKubernetesManifestCommandMetadata } from '../manifestCommandBuilder.service';

import './manifestEntry.less'
import './manifestEntry.less';

class KubernetesManifestCtrl implements IController {
public command: IKubernetesManifestCommand;
Expand All @@ -17,7 +17,8 @@ class KubernetesManifestEntryComponent implements IComponentOptions {
public template = `
<div class="container-fluid form-horizontal">
<ng-form name="manifest">
<div class="form-group">
<div class="form-group" ng-class="{ 'kubernetes-manifest-error': ctrl.metadata.yamlError }">
<div style="" class="kubernetes-manifest-yaml-error-message">Invalid YAML</div>
<textarea class="code form-control kubernetes-manifest-entry" ng-model="ctrl.metadata.manifestText" ng-change="ctrl.change()" rows="40"></textarea>
</div>
</ng-form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
.kubernetes-manifest-entry {
resize: vertical
resize: vertical;
}

.kubernetes-manifest-yaml-error-message {
display: none;
}

.kubernetes-manifest-error {
.kubernetes-manifest-yaml-error-message {
display: block;
position: absolute;
width: 200px;
padding: 0.2em 1em;
left: 50%;
margin-left: calc(-100px + -0.5em);
background: red;
color: white;
}

.kubernetes-manifest-entry {
background: rgb(255, 220, 220);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {
}

public change() {
this.$scope.ctrl.metadata.yamlError = false;
try {
this.$scope.stage.manifest = load(this.metadata.manifestText);
} catch (e) {}
} catch (e) {
this.$scope.ctrl.metadata.yamlError = true;
}
}
}

0 comments on commit efbeef4

Please sign in to comment.