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 | 110x 110x 110x 110x 110x 110x 28x 28x 1x 27x 110x 30x 30x 30x 1x 29x 1x 28x 110x 3x 1x 1x 1x 1x 1x | /* * Copyright 2022 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 { getMultiTypeFromValue, MultiTypeInputType } from '@wings-software/uicore' import { isEmpty } from 'lodash-es' import { getScopeFromValue } from '@common/components/EntityReference/EntityReference' import { Scope } from '@common/interfaces/SecretsInterface' import type { ManifestConfig, ManifestConfigWrapper } from 'services/cd-ng' import { GitRepoName, ManifestStoreMap } from '../Manifesthelper' import type { CommandFlags, HelmWithGcsDataType, HelmWithGITDataType, HelmWithHTTPDataType } from '../ManifestInterface' const getRepoNameBasedonScope = (initialValues: ManifestConfig, prevStepData: any): string => { const connectorScope = getScopeFromValue(initialValues?.spec.store?.spec.connectorRef) switch (connectorScope) { case Scope.ACCOUNT: return initialValues?.spec.store.spec.connectorRef === `account.${prevStepData.connectorRef.connector.identifier}` ? initialValues?.spec.store?.spec.repoName : '' case Scope.PROJECT: return prevStepData?.connectorRef?.connector?.identifier === initialValues?.spec.store?.spec.connectorRef ? initialValues?.spec.store?.spec.repoName : '' case Scope.ORG: return `${prevStepData.connectorRef.scope}.${prevStepData.connectorRef.connector.identifier}` === initialValues?.spec.store.spec.connectorRef ? initialValues?.spec.store?.spec.repoName : '' default: return '' } } export const getRepositoryName = (prevStepData: any, initialValues: ManifestConfig): string => { const gitConnectionType: string = prevStepData?.store === ManifestStoreMap.Git ? 'connectionType' : 'type' const connectionType = prevStepData?.connectorRef?.connector?.spec?.[gitConnectionType] === GitRepoName.Repo || prevStepData?.urlType === GitRepoName.Repo ? GitRepoName.Repo : GitRepoName.Account if (getMultiTypeFromValue(prevStepData?.connectorRef) !== MultiTypeInputType.FIXED) { return prevStepData.connectorRef } else { if (connectionType === GitRepoName.Repo) { return prevStepData.connectorRef?.connector?.spec.url } return getRepoNameBasedonScope(initialValues, prevStepData) } } export const handleCommandFlagsSubmitData = ( manifestObj: ManifestConfigWrapper, formData: (HelmWithGcsDataType | HelmWithGITDataType | HelmWithHTTPDataType) & { store?: string connectorRef?: string } ): void => { if (formData?.commandFlags.length && formData?.commandFlags[0].commandType) { ;(manifestObj.manifest as ManifestConfig).spec.commandFlags = formData?.commandFlags.map( (commandFlag: CommandFlags) => commandFlag.commandType && commandFlag.flag ? { commandType: commandFlag.commandType, flag: commandFlag.flag } : {} ) const filteredCommandFlags = manifestObj?.manifest?.spec?.commandFlags.filter( (currFlag: CommandFlags) => !isEmpty(currFlag) ) Iif (filteredCommandFlags.length === 0 && manifestObj?.manifest?.spec) { delete manifestObj.manifest.spec.commandFlags } } } |