Skip to content

Commit 7785d2d

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/devtron-fe-common-lib into feat/app-status-modal
2 parents eabc1f0 + f92ca67 commit 7785d2d

23 files changed

+515
-572
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.12.0-pre-0",
3+
"version": "1.12.0-pre-2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-nav-rocket.svg

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/Common/CIPipeline.Types.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { DynamicDataTableCellValidationState } from '@Shared/Components'
17+
import { DynamicDataTableCellValidationState, KeyValueTableData } from '@Shared/Components'
1818

1919
export interface MaterialType {
2020
name: string
@@ -158,7 +158,7 @@ export interface PortMapType {
158158
portOnLocal: number
159159
portOnContainer: number
160160
}
161-
interface ConditionDetails {
161+
export interface ConditionDetails {
162162
id: number
163163
conditionOnVariable: string
164164
conditionOperator: string
@@ -266,7 +266,7 @@ export enum WORKFLOW_CACHE_CONFIG_ENUM {
266266

267267
export interface FormType {
268268
name: string
269-
args: { key: string; value: string }[]
269+
args: KeyValueTableData[]
270270
materials: MaterialType[]
271271
gitHost: Githost
272272
webhookEvents: WebhookEvent[]
@@ -314,23 +314,29 @@ export enum InputOutputVariablesHeaderKeys {
314314
VALUE = 'val',
315315
}
316316

317-
export type InputOutputVariablesErrorObj = Record<InputOutputVariablesHeaderKeys, DynamicDataTableCellValidationState>
317+
export enum ConditionDataTableHeaderKeys {
318+
VARIABLE = 'variable',
319+
OPERATOR = 'operator',
320+
VALUE = 'val',
321+
}
322+
323+
type InputOutputVariablesErrorObj = Record<InputOutputVariablesHeaderKeys, DynamicDataTableCellValidationState>
324+
type ConditionDetailsErrorObj = Record<ConditionDataTableHeaderKeys, DynamicDataTableCellValidationState>
325+
326+
interface StepDetailTaskErrorObj {
327+
inputVariables?: Record<number, InputOutputVariablesErrorObj>
328+
outputVariables?: Record<number, InputOutputVariablesErrorObj>
329+
isInputVariablesValid?: boolean
330+
isOutputVariablesValid?: boolean
331+
conditionDetails?: Record<number, ConditionDetailsErrorObj>
332+
isConditionDetailsValid?: boolean
333+
}
318334

319335
export interface TaskErrorObj {
320336
isValid: boolean
321337
name: ErrorObj
322-
inlineStepDetail?: {
323-
inputVariables?: Record<number, InputOutputVariablesErrorObj>
324-
outputVariables?: Record<number, InputOutputVariablesErrorObj>
325-
isInputVariablesValid?: boolean
326-
isOutputVariablesValid?: boolean
327-
}
328-
pluginRefStepDetail?: {
329-
inputVariables?: Record<number, InputOutputVariablesErrorObj>
330-
outputVariables?: Record<number, InputOutputVariablesErrorObj>
331-
isInputVariablesValid?: boolean
332-
isOutputVariablesValid?: boolean
333-
}
338+
inlineStepDetail?: StepDetailTaskErrorObj
339+
pluginRefStepDetail?: StepDetailTaskErrorObj
334340
}
335341
export interface FormErrorObjectType {
336342
name: ErrorObj

src/Common/Common.service.ts

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ import {
2222
sanitizeUserApprovalList,
2323
stringComparatorBySortOrder,
2424
} from '@Shared/Helpers'
25-
import {
26-
PolicyBlockInfo,
27-
RuntimeParamsAPIResponseType,
28-
RuntimePluginVariables,
29-
} from '@Shared/types'
25+
import { PolicyBlockInfo, RuntimeParamsAPIResponseType, RuntimePluginVariables } from '@Shared/types'
3026
import { GitProviderType, ROUTES } from './Constants'
3127
import { getUrlWithSearchParams, sortCallback } from './Helper'
3228
import {
@@ -49,10 +45,14 @@ import {
4945
GlobalVariableDTO,
5046
GlobalVariableOptionType,
5147
UserRole,
48+
EnvAppsMetaDTO,
49+
GetAppsInfoForEnvProps,
50+
AppMeta,
5251
} from './Types'
5352
import { ApiResourceType, STAGE_MAP } from '../Pages'
5453
import { RefVariableType, VariableTypeFormat } from './CIPipeline.Types'
5554
import { get, post } from './API'
55+
import { StatusType } from '@Shared/Components'
5656

5757
export const getTeamListMin = (): Promise<TeamList> => {
5858
// ignore active field
@@ -264,7 +264,7 @@ export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): Runt
264264
const runtimeParams = (response?.runtimePluginVariables ?? []).map<RuntimePluginVariables>((variable) => ({
265265
...variable,
266266
defaultValue: variable.value,
267-
stepVariableId: variable.stepVariableId || Math.floor(new Date().valueOf() * Math.random())
267+
stepVariableId: variable.stepVariableId || Math.floor(new Date().valueOf() * Math.random()),
268268
}))
269269

270270
runtimeParams.push(...envVariables)
@@ -515,3 +515,25 @@ export const getGlobalVariables = async ({
515515
throw err
516516
}
517517
}
518+
519+
export const getAppsInfoForEnv = async ({ envId, appIds }: GetAppsInfoForEnvProps): Promise<EnvAppsMetaDTO> => {
520+
const url = getUrlWithSearchParams(`${ROUTES.ENV}/${envId}/${ROUTES.APP_METADATA}`, {
521+
appIds: appIds?.join(),
522+
})
523+
const response = await get<EnvAppsMetaDTO>(url)
524+
525+
return {
526+
appCount: response.result?.appCount ?? 0,
527+
apps: (response.result?.apps ?? []).reduce<AppMeta[]>((agg, { appId, appName, appStatus }) => {
528+
if (!appId) {
529+
return agg
530+
}
531+
agg.push({
532+
appId,
533+
appName: appName || '',
534+
appStatus: appStatus || StatusType.UNKNOWN,
535+
})
536+
return agg
537+
}, []),
538+
}
539+
}

src/Common/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ export const ROUTES = {
158158
ENVIRONMENT_DATA: 'global/environment-variables',
159159
DASHBOARD_EVENT: 'dashboard-event',
160160
LICENSE_DATA: 'license/data',
161+
ENV: 'env',
162+
APP_METADATA: 'app-metadata',
161163
} as const
162164

163165
export enum KEY_VALUE {

src/Common/Types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
TargetPlatformItemDTO,
2828
ButtonProps,
2929
ComponentLayoutType,
30+
StatusType,
3031
} from '../Shared'
3132
import {
3233
ACTION_STATE,
@@ -1110,3 +1111,19 @@ export enum ActionTypes {
11101111
EDIT = 'edit',
11111112
APPROVER = 'approver',
11121113
}
1114+
1115+
export interface GetAppsInfoForEnvProps {
1116+
envId: number
1117+
appIds?: number[]
1118+
}
1119+
1120+
export interface AppMeta {
1121+
appId: number
1122+
appStatus: StatusType
1123+
appName: string
1124+
}
1125+
1126+
export interface EnvAppsMetaDTO {
1127+
appCount: number
1128+
apps: AppMeta[]
1129+
}

src/Shared/Components/AnimatedDeployButton/AnimatedDeployButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
import { SyntheticEvent, useEffect, useRef, useState } from 'react'
1818
import { motion } from 'framer-motion'
1919

20-
import { ReactComponent as ICDeploy } from '@Icons/ic-nav-rocket.svg'
2120
import DeployAudio from '@Sounds/DeployAudio.mp3'
2221
import { ComponentSizeType } from '@Shared/constants'
2322

2423
import { Button } from '../Button'
24+
import { Icon } from '../Icon'
2525
import { AnimatedDeployButtonProps } from './types'
2626

2727
import './animatedDeployButton.scss'
@@ -83,7 +83,7 @@ const AnimatedDeployButton = ({ isVirtualEnvironment, onButtonClick }: AnimatedD
8383
: {}
8484
}
8585
>
86-
<ICDeploy className="icon-dim-16" />
86+
<Icon name="ic-rocket-launch" color={null} />
8787
</motion.div>
8888
}
8989
size={ComponentSizeType.large}

0 commit comments

Comments
 (0)