Skip to content

Commit

Permalink
fix(kubernetes): fix copy manifest from infrastructure button (spinna…
Browse files Browse the repository at this point in the history
  • Loading branch information
maggieneterval authored Mar 19, 2019
1 parent 2ac15b2 commit 5b03078
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 77 deletions.
2 changes: 0 additions & 2 deletions app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { KUBERNETES_DEPLOY_MANIFEST_STAGE } from './pipelines/stages/deployManif
import { KUBERNETES_DELETE_MANIFEST_STAGE } from './pipelines/stages/deleteManifest/deleteManifestStage';
import { KUBERNETES_PATCH_MANIFEST_STAGE } from './pipelines/stages/patchManifest/patchManifestStage';
import { KUBERNETES_SCALE_MANIFEST_STAGE } from './pipelines/stages/scaleManifest/scaleManifestStage';
import { KUBERNETES_MANIFEST_ENTRY } from './manifest/wizard/manifestEntry.component';
import { KUBERNETES_UNDO_ROLLOUT_MANIFEST_STAGE } from './pipelines/stages/undoRolloutManifest/undoRolloutManifestStage';
import { KUBERNETES_FIND_ARTIFACTS_FROM_RESOURCE_STAGE } from './pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage';
import { KUBERNETES_V2_LOAD_BALANCER_DETAILS_CTRL } from './loadBalancer/details/details.controller';
Expand Down Expand Up @@ -70,7 +69,6 @@ module(KUBERNETES_V2_MODULE, [
KUBERNETES_MANIFEST_UNDO_ROLLOUT_CTRL,
KUBERNETES_MANIFEST_PAUSE_ROLLOUT_CTRL,
KUBERNETES_MANIFEST_RESUME_ROLLOUT_CTRL,
KUBERNETES_MANIFEST_ENTRY,
KUBERNETES_MANIFEST_STATUS,
KUBERNETES_MANIFEST_CONDITION,
KUBERNETES_MANIFEST_ARTIFACT,
Expand Down
1 change: 0 additions & 1 deletion app/scripts/modules/kubernetes/src/v2/manifest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export * from './rollout/undo.controller';
export * from './scale/scale.controller';
export * from './status/condition.component';
export * from './status/status.component';
export * from './wizard/manifestEntry.component';

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from 'kubernetes/v2/manifest/manifestCommandBuilder.service';

import { IManifestBindArtifact } from './ManifestBindArtifactsSelector';
import { yamlDocumentsToString } from '../../../manifest/editor/yaml/yamlEditorUtils';

export class KubernetesV2DeployManifestConfigCtrl implements IController {
public state = {
Expand All @@ -29,6 +30,7 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {
public manifestArtifactDelegate: NgGenericArtifactDelegate;
public manifestArtifactController: ExpectedArtifactSelectorViewController;
public sources = [this.textSource, this.artifactSource];
public rawManifest: string;

public static $inject = ['$scope'];

Expand Down Expand Up @@ -63,6 +65,9 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {
this.state.loaded = true;
this.manifestArtifactDelegate.setAccounts(get(this, ['metadata', 'backingData', 'artifactAccounts'], []));
this.manifestArtifactController.updateAccounts(this.manifestArtifactDelegate.getSelectedExpectedArtifact());
if (stage.source === this.textSource) {
this.initRawManifest();
}
});
}

Expand Down Expand Up @@ -97,11 +102,26 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {

public handleCopy = (manifest: IManifest) => {
this.$scope.stage.manifests = [manifest];
this.initRawManifest();
// This method is called from a React component.
this.$scope.$applyAsync();
};

public checkFeatureFlag(flag: string): boolean {
return !!SETTINGS.feature[flag];
}

// If we have more than one manifest, render as a
// list of manifests. Otherwise, hide the fact
// that the underlying model is a list.
public initRawManifest = (): void => {
this.rawManifest = yamlDocumentsToString(this.$scope.stage.manifests);
};

public handleRawManifestChange = (rawManifest: string, manifests: any): void => {
this.rawManifest = rawManifest;
this.$scope.stage.manifests = manifests;
// This method is called from a React component.
this.$scope.$applyAsync();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ <h4>Manifest Configuration</h4>
</label>
</stage-config-field>
</ng-form>
<kubernetes-manifest-entry ng-if="stage.source === ctrl.textSource" manifests="stage.manifests" command="stage">
</kubernetes-manifest-entry>
<yaml-editor
ng-if="stage.source === ctrl.textSource"
value="ctrl.rawManifest"
on-change="ctrl.handleRawManifestChange"
>
</yaml-editor>
<div ng-if="ctrl.checkFeatureFlag('artifactsRewrite')">
<stage-config-field
label="Manifest Artifact"
Expand Down

0 comments on commit 5b03078

Please sign in to comment.