diff --git a/app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts b/app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts index 874733fa148..293c83b6e1d 100644 --- a/app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts +++ b/app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts @@ -8,7 +8,6 @@ import { KUBERNETES_MANIFEST_DELETE_CTRL } from './manifest/delete/delete.contro import { KUBERNETES_MANIFEST_SCALE_CTRL } from './manifest/scale/scale.controller'; import { KUBERNETES_V2_INSTANCE_DETAILS_CTRL } from './instance/details/details.controller'; 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_UNDO_ROLLOUT_MANIFEST_STAGE } from './pipelines/stages/undoRolloutManifest/undoRolloutManifestStage'; import { KUBERNETES_FIND_ARTIFACTS_FROM_RESOURCE_STAGE } from './pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage'; @@ -43,6 +42,7 @@ import { KUBERNETES_V2_RUN_JOB_STAGE } from 'kubernetes/v2/pipelines/stages/runJ // React stages import './pipelines/stages/deployManifest/deployManifestStage'; +import './pipelines/stages/patchManifest/patchManifestStage'; import './pipelines/validation/manifestSelector.validator'; @@ -76,7 +76,6 @@ module(KUBERNETES_V2_MODULE, [ KUBERNETES_V2_SECURITY_GROUP_TRANSFORMER, require('../securityGroup/reader').name, KUBERNETES_DELETE_MANIFEST_STAGE, - KUBERNETES_PATCH_MANIFEST_STAGE, KUBERNETES_SCALE_MANIFEST_STAGE, KUBERNETES_UNDO_ROLLOUT_MANIFEST_STAGE, KUBERNETES_FIND_ARTIFACTS_FROM_RESOURCE_STAGE, diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/DeployManifestStageForm.tsx b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/DeployManifestStageForm.tsx index 85820bc4277..e9f7f8f5629 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/DeployManifestStageForm.tsx +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/DeployManifestStageForm.tsx @@ -46,6 +46,7 @@ export class DeployManifestStageForm extends React.Component< ArtifactTypePatterns.KUBERNETES, ArtifactTypePatterns.FRONT50_PIPELINE_TEMPLATE, ArtifactTypePatterns.EMBEDDED_BASE64, + ArtifactTypePatterns.MAVEN_FILE, ]; public constructor(props: IDeployManifestStageConfigFormProps & IFormikStageConfigInjectedProps) { diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/PatchManifestOptionsForm.tsx b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/PatchManifestOptionsForm.tsx new file mode 100644 index 00000000000..7efc79a7311 --- /dev/null +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/PatchManifestOptionsForm.tsx @@ -0,0 +1,33 @@ +import * as React from 'react'; +import { CheckboxInput, StageConfigField } from '@spinnaker/core'; +import Select, { Option } from 'react-select'; + +export interface IPatchManifestOptionsFormProps { + record: boolean; + onRecordChange: (record: boolean) => void; + strategy: string; + onStrategyChange: (strategy: string) => void; +} + +export const PatchManifestOptionsForm: React.FunctionComponent = ( + props: IPatchManifestOptionsFormProps, +) => { + return ( +
+ + ) => props.onRecordChange(e.target.checked)} + /> + + + - {{ ctrl.textSource | robotToHuman }} - -
-
- -
- - - - - - - - - - - - - - - - -
- - - -

Patch Options

-
- - - - diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts index 6bb71ecad0c..c1ebab9ea37 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts @@ -1,5 +1,3 @@ -import { module } from 'angular'; - import { ArtifactReferenceService, ExecutionArtifactTab, @@ -9,40 +7,27 @@ import { SETTINGS, } from '@spinnaker/core'; -import { KubernetesV2PatchManifestConfigCtrl } from '../patchManifest/patchManifestConfig.controller'; -import { KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM } from './patchOptionsForm.component'; -import { KUBERNETES_MANIFEST_SELECTOR } from 'kubernetes/v2/manifest/selector/selector.component'; import { DeployStatus } from '../deployManifest/manifestStatus/DeployStatus'; import { manifestSelectorValidators } from '../validators/manifestSelectorValidators'; - -export const KUBERNETES_PATCH_MANIFEST_STAGE = 'spinnaker.kubernetes.v2.pipeline.stage.patchManifestStage'; +import { PatchManifestStageConfig } from './PatchManifestStageConfig'; export class PatchStatus extends DeployStatus { public static title = 'PatchStatus'; } const STAGE_NAME = 'Patch (Manifest)'; -module(KUBERNETES_PATCH_MANIFEST_STAGE, [KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM, KUBERNETES_MANIFEST_SELECTOR]) - .config(() => { - if (SETTINGS.feature.versionedProviders) { - Registry.pipeline.registerStage({ - label: STAGE_NAME, - description: 'Patch a Kubernetes object in place.', - key: 'patchManifest', - cloudProvider: 'kubernetes', - templateUrl: require('./patchManifestConfig.html'), - controller: 'KubernetesV2PatchManifestConfigCtrl', - controllerAs: 'ctrl', - executionDetailsSections: [PatchStatus, ExecutionDetailsTasks, ExecutionArtifactTab], - producesArtifacts: true, - defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes - validators: manifestSelectorValidators(STAGE_NAME), - artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['manifestArtifactId', 'requiredArtifactIds']), - artifactRemover: ArtifactReferenceService.removeArtifactFromFields([ - 'manifestArtifactId', - 'requiredArtifactIds', - ]), - }); - } - }) - .controller('KubernetesV2PatchManifestConfigCtrl', KubernetesV2PatchManifestConfigCtrl); +if (SETTINGS.feature.versionedProviders) { + Registry.pipeline.registerStage({ + label: STAGE_NAME, + description: 'Patch a Kubernetes object in place.', + key: 'patchManifest', + cloudProvider: 'kubernetes', + component: PatchManifestStageConfig, + executionDetailsSections: [PatchStatus, ExecutionDetailsTasks, ExecutionArtifactTab], + producesArtifacts: true, + defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes + validators: manifestSelectorValidators(STAGE_NAME), + artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['manifestArtifactId', 'requiredArtifactIds']), + artifactRemover: ArtifactReferenceService.removeArtifactFromFields(['manifestArtifactId', 'requiredArtifactIds']), + }); +} diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchOptionsForm.component.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchOptionsForm.component.ts deleted file mode 100644 index d7a7557d864..00000000000 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchOptionsForm.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { IComponentOptions, IController, module } from 'angular'; - -export interface IPatchOptions { - mergeStrategy: MergeStrategy; - record: boolean; -} - -export enum MergeStrategy { - strategic = 'strategic', - json = 'json', - merge = 'merge', -} - -class KubernetesPatchManifestOptionsFormCtrl implements IController { - public options: IPatchOptions; - public mergeStrategies = MergeStrategy; -} - -const kubernetesPatchManifestOptionsFormComponent: IComponentOptions = { - bindings: { options: '=', onChange: '<' }, - controller: KubernetesPatchManifestOptionsFormCtrl, - controllerAs: 'ctrl', - template: ` -
-
-
- Record Patch Annotation - -
-
-
- -
-
-
- -
-
- Merge Strategy - -
-
-
- -
-
-
-
- `, -}; - -export const KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM = 'spinnaker.kubernetes.v2.manifest.patch.options.component'; -module(KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM, []).component( - 'kubernetesPatchManifestOptionsForm', - kubernetesPatchManifestOptionsFormComponent, -);