Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

Commit 5b03078

Browse files
fix(kubernetes): fix copy manifest from infrastructure button (#6719)
1 parent 2ac15b2 commit 5b03078

6 files changed

Lines changed: 26 additions & 77 deletions

File tree

‎app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { KUBERNETES_DEPLOY_MANIFEST_STAGE } from './pipelines/stages/deployManif
1111
import { KUBERNETES_DELETE_MANIFEST_STAGE } from './pipelines/stages/deleteManifest/deleteManifestStage';
1212
import { KUBERNETES_PATCH_MANIFEST_STAGE } from './pipelines/stages/patchManifest/patchManifestStage';
1313
import { KUBERNETES_SCALE_MANIFEST_STAGE } from './pipelines/stages/scaleManifest/scaleManifestStage';
14-
import { KUBERNETES_MANIFEST_ENTRY } from './manifest/wizard/manifestEntry.component';
1514
import { KUBERNETES_UNDO_ROLLOUT_MANIFEST_STAGE } from './pipelines/stages/undoRolloutManifest/undoRolloutManifestStage';
1615
import { KUBERNETES_FIND_ARTIFACTS_FROM_RESOURCE_STAGE } from './pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage';
1716
import { KUBERNETES_V2_LOAD_BALANCER_DETAILS_CTRL } from './loadBalancer/details/details.controller';
@@ -70,7 +69,6 @@ module(KUBERNETES_V2_MODULE, [
7069
KUBERNETES_MANIFEST_UNDO_ROLLOUT_CTRL,
7170
KUBERNETES_MANIFEST_PAUSE_ROLLOUT_CTRL,
7271
KUBERNETES_MANIFEST_RESUME_ROLLOUT_CTRL,
73-
KUBERNETES_MANIFEST_ENTRY,
7472
KUBERNETES_MANIFEST_STATUS,
7573
KUBERNETES_MANIFEST_CONDITION,
7674
KUBERNETES_MANIFEST_ARTIFACT,

‎app/scripts/modules/kubernetes/src/v2/manifest/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ export * from './rollout/undo.controller';
88
export * from './scale/scale.controller';
99
export * from './status/condition.component';
1010
export * from './status/status.component';
11-
export * from './wizard/manifestEntry.component';

‎app/scripts/modules/kubernetes/src/v2/manifest/wizard/manifestEntry.component.ts‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎app/scripts/modules/kubernetes/src/v2/manifest/wizard/manifestEntry.less‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifestConfig.controller.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from 'kubernetes/v2/manifest/manifestCommandBuilder.service';
1818

1919
import { IManifestBindArtifact } from './ManifestBindArtifactsSelector';
20+
import { yamlDocumentsToString } from '../../../manifest/editor/yaml/yamlEditorUtils';
2021

2122
export class KubernetesV2DeployManifestConfigCtrl implements IController {
2223
public state = {
@@ -29,6 +30,7 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {
2930
public manifestArtifactDelegate: NgGenericArtifactDelegate;
3031
public manifestArtifactController: ExpectedArtifactSelectorViewController;
3132
public sources = [this.textSource, this.artifactSource];
33+
public rawManifest: string;
3234

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

@@ -63,6 +65,9 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {
6365
this.state.loaded = true;
6466
this.manifestArtifactDelegate.setAccounts(get(this, ['metadata', 'backingData', 'artifactAccounts'], []));
6567
this.manifestArtifactController.updateAccounts(this.manifestArtifactDelegate.getSelectedExpectedArtifact());
68+
if (stage.source === this.textSource) {
69+
this.initRawManifest();
70+
}
6671
});
6772
}
6873

@@ -97,11 +102,26 @@ export class KubernetesV2DeployManifestConfigCtrl implements IController {
97102

98103
public handleCopy = (manifest: IManifest) => {
99104
this.$scope.stage.manifests = [manifest];
105+
this.initRawManifest();
100106
// This method is called from a React component.
101107
this.$scope.$applyAsync();
102108
};
103109

104110
public checkFeatureFlag(flag: string): boolean {
105111
return !!SETTINGS.feature[flag];
106112
}
113+
114+
// If we have more than one manifest, render as a
115+
// list of manifests. Otherwise, hide the fact
116+
// that the underlying model is a list.
117+
public initRawManifest = (): void => {
118+
this.rawManifest = yamlDocumentsToString(this.$scope.stage.manifests);
119+
};
120+
121+
public handleRawManifestChange = (rawManifest: string, manifests: any): void => {
122+
this.rawManifest = rawManifest;
123+
this.$scope.stage.manifests = manifests;
124+
// This method is called from a React component.
125+
this.$scope.$applyAsync();
126+
};
107127
}

‎app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifestConfig.html‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ <h4>Manifest Configuration</h4>
2222
</label>
2323
</stage-config-field>
2424
</ng-form>
25-
<kubernetes-manifest-entry ng-if="stage.source === ctrl.textSource" manifests="stage.manifests" command="stage">
26-
</kubernetes-manifest-entry>
25+
<yaml-editor
26+
ng-if="stage.source === ctrl.textSource"
27+
value="ctrl.rawManifest"
28+
on-change="ctrl.handleRawManifestChange"
29+
>
30+
</yaml-editor>
2731
<div ng-if="ctrl.checkFeatureFlag('artifactsRewrite')">
2832
<stage-config-field
2933
label="Manifest Artifact"

0 commit comments

Comments
 (0)