Skip to content

Commit 82caa5f

Browse files
authored
Merge pull request #497 from devtron-labs/chore/rc-26-ht-25-sync
chore: sync main with hotfix 25
2 parents dd65fc6 + b399ccd commit 82caa5f

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.4.0",
3+
"version": "1.4.0-patch-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Common.service.ts

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { MutableRefObject } from 'react'
1818
import moment from 'moment'
19-
import { sanitizeApprovalConfigData, sanitizeUserApprovalList } from '@Shared/Helpers'
19+
import { sanitizeApprovalConfigData, sanitizeUserApprovalList, stringComparatorBySortOrder } from '@Shared/Helpers'
2020
import { PolicyBlockInfo, RuntimeParamsAPIResponseType, RuntimePluginVariables } from '@Shared/types'
2121
import { get, post } from './Api'
2222
import { GitProviderType, ROUTES } from './Constants'
@@ -42,7 +42,7 @@ import {
4242
GlobalVariableOptionType,
4343
} from './Types'
4444
import { ApiResourceType } from '../Pages'
45-
import { RefVariableType } from './CIPipeline.Types'
45+
import { RefVariableType, VariableTypeFormat } from './CIPipeline.Types'
4646

4747
export const getTeamListMin = (): Promise<TeamList> => {
4848
// ignore active field
@@ -203,7 +203,7 @@ const cdMaterialListModal = ({
203203
deploymentWindowArtifactMetadata: material.deploymentWindowArtifactMetadata ?? null,
204204
configuredInReleases: material.configuredInReleases ?? [],
205205
appWorkflowId: material.appWorkflowId ?? null,
206-
deploymentBlockedState: sanitizeDeploymentBlockedState(material.deploymentBlockedState)
206+
deploymentBlockedState: sanitizeDeploymentBlockedState(material.deploymentBlockedState),
207207
}
208208
})
209209
return materials
@@ -244,8 +244,37 @@ const processCDMaterialsApprovalInfo = (enableApproval: boolean, cdMaterialsResu
244244
}
245245
}
246246

247-
export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): RuntimePluginVariables[] =>
248-
(response?.runtimePluginVariables ?? []).map((variable) => ({ ...variable, defaultValue: variable.value }))
247+
export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): RuntimePluginVariables[] => {
248+
const envVariables = Object.entries(response?.envVariables || {}).map<RuntimePluginVariables>(
249+
([key, value]) => ({
250+
name: key,
251+
value,
252+
defaultValue: '',
253+
format: VariableTypeFormat.STRING,
254+
isRequired: false,
255+
valueType: RefVariableType.NEW,
256+
variableStepScope: RefVariableType.GLOBAL,
257+
stepName: null,
258+
stepType: null,
259+
// TODO: (Rohit/Eshank) Replace this with getUniqueId (nanoId method)
260+
stepVariableId: Math.floor(new Date().valueOf() * Math.random()),
261+
valueConstraint: null,
262+
description: null,
263+
fileReferenceId: null,
264+
fileMountDir: null,
265+
}),
266+
)
267+
268+
const runtimeParams = (response?.runtimePluginVariables ?? []).map<RuntimePluginVariables>((variable) => ({
269+
...variable,
270+
defaultValue: variable.value,
271+
}))
272+
273+
runtimeParams.push(...envVariables)
274+
runtimeParams.sort((a, b) => stringComparatorBySortOrder(a.name, b.name))
275+
276+
return runtimeParams
277+
}
249278

250279
const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
251280
if (!cdMaterialsResult) {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export interface customEnv {
9292
FEATURE_PROMO_EMBEDDED_BUTTON_TEXT?: string
9393
FEATURE_PROMO_EMBEDDED_MODAL_TITLE?: string
9494
FEATURE_PROMO_EMBEDDED_IFRAME_URL?: string
95+
FEATURE_SWAP_TRAFFIC_ENABLE?: boolean
9596
FEATURE_BULK_RESTART_WORKLOADS_FROM_RB: string
9697
FEATURE_RB_SYNC_CLUSTER_ENABLE?: boolean
9798
FEATURE_DEFAULT_MERGE_STRATEGY?: OverrideMergeStrategyType

0 commit comments

Comments
 (0)