Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 99x 99x 99x 99x 99x 99x 99x 99x 99x 99x 99x 99x 99x 99x 78x 77x 77x 99x | /* * Copyright 2021 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import React from 'react' import { connect } from 'formik' import { Layout, MultiTypeInputType } from '@wings-software/uicore' import cx from 'classnames' import { useStrings } from 'framework/strings' import type { ServiceSpec } from 'services/cd-ng' import type { AbstractStepFactory } from '@pipeline/components/AbstractSteps/AbstractStepFactory' import { StepViewType } from '@pipeline/components/AbstractSteps/Step' import { StepWidget } from '@pipeline/components/AbstractSteps/StepWidget' import type { CustomVariablesData } from '@pipeline/components/PipelineSteps/Steps/CustomVariables/CustomVariableEditable' import type { CustomVariableInputSetExtraProps } from '@pipeline/components/PipelineSteps/Steps/CustomVariables/CustomVariableInputSet' import type { AllNGVariables } from '@pipeline/utils/types' import { StepType } from '@pipeline/components/PipelineSteps/PipelineStepInterface' import artifactSourceBaseFactory from '@cd/factory/ArtifactSourceFactory/ArtifactSourceBaseFactory' import manifestSourceBaseFactory from '@cd/factory/ManifestSourceFactory/ManifestSourceBaseFactory' import type { K8SDirectServiceStep } from './K8sServiceSpecInterface' import { KubernetesArtifacts } from './KubernetesArtifacts/KubernetesArtifacts' import { KubernetesManifests } from './KubernetesManifests/KubernetesManifests' import css from './K8sServiceSpec.module.scss' export interface KubernetesInputSetProps { initialValues: K8SDirectServiceStep onUpdate?: ((data: ServiceSpec) => void) | undefined stepViewType?: StepViewType template?: ServiceSpec allValues?: ServiceSpec readonly?: boolean factory?: AbstractStepFactory path?: string stageIdentifier: string formik?: any allowableTypes: MultiTypeInputType[] } const KubernetesServiceSpecInputSetModeFormikForm = (props: KubernetesInputSetProps): React.ReactElement => { const { template, path, factory, allValues, initialValues, onUpdate, readonly = false, stageIdentifier, stepViewType, formik, allowableTypes } = props const { getString } = useStrings() return ( <Layout.Vertical spacing="medium"> {!!(template?.artifacts?.primary?.type || template?.artifacts?.sidecars?.length) && ( <KubernetesArtifacts type={allValues?.artifacts?.primary?.type || ''} template={template} artifacts={allValues?.artifacts} artifactSourceBaseFactory={artifactSourceBaseFactory} stepViewType={stepViewType} stageIdentifier={stageIdentifier} formik={formik} path={path} initialValues={initialValues} readonly={readonly} allowableTypes={allowableTypes} /> )} {!!template?.manifests?.length && ( <KubernetesManifests template={template} manifests={allValues?.manifests} manifestSourceBaseFactory={manifestSourceBaseFactory} stepViewType={stepViewType} stageIdentifier={stageIdentifier} formik={formik} path={path} initialValues={initialValues} readonly={readonly} allowableTypes={allowableTypes} /> )} {!!template?.variables?.length && ( <div id={`Stage.${stageIdentifier}.Service.Variables`} className={cx(css.nopadLeft, css.accordionSummary)}> <div className={css.subheading}>{getString('variablesText')}</div> <div className={css.nestedAccordions}> <StepWidget<CustomVariablesData, CustomVariableInputSetExtraProps> factory={factory as unknown as AbstractStepFactory} initialValues={{ variables: (initialValues.variables || []) as AllNGVariables[], canAddVariable: true }} type={StepType.CustomVariable} stepViewType={StepViewType.InputSet} allowableTypes={allowableTypes} onUpdate={({ variables }: CustomVariablesData) => { onUpdate?.({ variables: variables as any }) }} customStepProps={{ template: { variables: (template?.variables || []) as AllNGVariables[] }, path, allValues: { variables: (allValues?.variables || []) as AllNGVariables[] } }} readonly={readonly} /> </div> </div> )} </Layout.Vertical> ) } export const KubernetesServiceSpecInputSetMode = connect(KubernetesServiceSpecInputSetModeFormikForm) |