Skip to content

Commit f23f5fc

Browse files
Merge branch 'main' into feat/worker-pod-link
2 parents 40d0b1c + 98e82df commit f23f5fc

File tree

105 files changed

+2902
-1646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2902
-1646
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "0.0.45",
7+
"@devtron-labs/devtron-fe-common-lib": "0.0.48",
88
"@rjsf/core": "^5.13.3",
99
"@rjsf/utils": "^5.13.3",
1010
"@rjsf/validator-ajv8": "^5.13.3",
@@ -46,13 +46,13 @@
4646
"react-virtualized": "^9.22.3",
4747
"recharts": "^2.1.9",
4848
"rxjs": "^7.5.4",
49+
"tippy.js": "^6.3.7",
4950
"xterm": "^4.19.0",
5051
"xterm-addon-fit": "^0.5.0",
5152
"xterm-addon-search": "^0.9.0",
5253
"xterm-webfont": "^2.0.0",
5354
"yaml": "^1.7.2",
54-
"yamljs": "^0.3.0",
55-
"tippy.js": "^6.3.7"
55+
"yamljs": "^0.3.0"
5656
},
5757
"scripts": {
5858
"lint": "eslint src/**/*.tsx",

src/assets/icons/ic-login-dt-with-hat.svg

Lines changed: 289 additions & 0 deletions
Loading

src/assets/icons/ic-sidebar-dt-with-hat.svg

Lines changed: 286 additions & 0 deletions
Loading

src/components/ApplicationGroup/AppGroup.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import {
44
CiPipelineResult,
55
WorkflowResult,
66
NodeAttr,
7-
PipelineType,
8-
WorkflowNodeType,
97
CiPipeline,
108
} from '../app/details/triggerView/types'
119
import { WebhookListResponse } from '../ciPipeline/Webhook/types'
1210
import { processWorkflow } from '../app/details/triggerView/workflow.service'
1311
import { WorkflowTrigger } from '../app/details/triggerView/config'
1412
import { ModuleNameMap, Routes, URLS } from '../../config'
15-
import { get, post, put, ResponseType, trash } from '@devtron-labs/devtron-fe-common-lib'
13+
import { get, post, put, ResponseType, trash, WorkflowNodeType, PipelineType } from '@devtron-labs/devtron-fe-common-lib'
1614
import {
1715
AppGroupList,
1816
CIConfigListType,

src/components/ApplicationGroup/AppGroup.types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import {
44
FilterConditionsListType,
55
ResponseType,
66
UserApprovalConfigType,
7+
WorkflowNodeType
78
} from '@devtron-labs/devtron-fe-common-lib'
89
import { MultiValue } from 'react-select'
9-
import { WebhookPayloads, WorkflowNodeType, WorkflowType } from '../app/details/triggerView/types'
10+
import { WebhookPayloads, WorkflowType } from '../app/details/triggerView/types'
1011
import { EditDescRequest, OptionType } from '../app/types'
1112
import { AppFilterTabs, BulkResponseStatus } from './Constants'
1213

src/components/ApplicationGroup/Constants.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export enum BulkResponseStatus {
4545
'PASS' = 'pass',
4646
'FAIL' = 'fail',
4747
'UNAUTHORIZE' = 'unauthorized',
48+
'SKIP' = 'skip',
4849
}
4950

5051
export const BULK_VIRTUAL_RESPONSE_STATUS = {
@@ -180,6 +181,8 @@ export const CREATE_GROUP_TABS = {
180181

181182
export const GetBranchChangeStatus = (statusText: string): BulkResponseStatus => {
182183
switch (statusText) {
184+
case BulkResponseStatus.SKIP:
185+
return BulkResponseStatus.SKIP
183186
case BULK_VIRTUAL_RESPONSE_STATUS.pass:
184187
return BulkResponseStatus.PASS
185188
case BULK_VIRTUAL_RESPONSE_STATUS.fail:
@@ -191,4 +194,6 @@ export const GetBranchChangeStatus = (statusText: string): BulkResponseStatus =>
191194
}
192195
}
193196

194-
export const FILTER_NAME_REGEX = /^[a-z][a-z0-9-]{1,}[a-z0-9]$/
197+
export const FILTER_NAME_REGEX = /^[a-z][a-z0-9-]{1,}[a-z0-9]$/
198+
export const SKIPPED_RESOURCES_MESSAGE = 'Build action is not applicable'
199+
export const SKIPPED_RESOURCES_STATUS_TEXT = 'Skipped'

src/components/ApplicationGroup/Details/EnvCIDetails/EnvCIDetails.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect, useState } from 'react'
22
import { generatePath, Route, useHistory, useParams, useRouteMatch } from 'react-router-dom'
3-
import { Progressing, showError, sortCallback, useAsync } from '@devtron-labs/devtron-fe-common-lib'
3+
import { Progressing, showError, sortCallback, useAsync, PipelineType } from '@devtron-labs/devtron-fe-common-lib'
44
import { URLS } from '../../../../config'
55
import { APP_GROUP_CI_DETAILS } from '../../../../config/constantMessaging'
66
import { EmptyView, LogResizeButton } from '../../../app/details/cicdHistory/History.components'
@@ -12,7 +12,7 @@ import {
1212
FetchIdDataStatus,
1313
} from '../../../app/details/cicdHistory/types'
1414
import { Details } from '../../../app/details/cIDetails/CIDetails'
15-
import { CiPipeline, PipelineType } from '../../../app/details/triggerView/types'
15+
import { CiPipeline } from '../../../app/details/triggerView/types'
1616
import { getTriggerHistory } from '../../../app/service'
1717
import { asyncWrap, mapByKey, useInterval } from '../../../common'
1818
import { getCIConfigList } from '../../AppGroup.service'

src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ export default function BulkCITrigger({
554554
)
555555
}
556556

557-
const onClickStartBuild = (): void => {
557+
const onClickStartBuild = (e: React.MouseEvent): void => {
558+
e.stopPropagation()
558559
onClickTriggerBulkCI(appIgnoreCache)
559560
}
560561

src/components/ApplicationGroup/Details/TriggerView/BulkSourceChange.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import React, { useEffect, useRef, useState } from 'react'
33
import { ReactComponent as Close } from '../../../../assets/icons/ic-cross.svg'
44
import { ReactComponent as Warn } from '../../../../assets/icons/ic-warning.svg'
55
import SourceUpdateResponseModal from './SourceUpdateResponseModal'
6+
import { BulkSourceChangeProps } from './types'
67

7-
export default function BulkSourceChange({ closePopup, responseList, changeBranch, loading, selectedAppCount }) {
8+
export default function BulkSourceChange({ closePopup, responseList, changeBranch, loading, selectedAppCount }: BulkSourceChangeProps) {
89
const sourceChangeDetailRef = useRef<HTMLDivElement>(null)
910

1011
const [showResponseModal, setShowResponseModal] = useState(false)
@@ -49,7 +50,8 @@ export default function BulkSourceChange({ closePopup, responseList, changeBranc
4950
setShowResponseModal(responseList.length > 0)
5051
}, [responseList])
5152

52-
const updateBranch = () => {
53+
const updateBranch = (e: React.MouseEvent) => {
54+
e.stopPropagation()
5355
if (branchName.length === 0) {
5456
setInputError('This is required')
5557
return
@@ -101,7 +103,6 @@ export default function BulkSourceChange({ closePopup, responseList, changeBranc
101103
<div className="form__row">
102104
<CustomInput
103105
labelClassName="dc__required-field"
104-
autoComplete="off"
105106
name="branch_name"
106107
disabled={false}
107108
value={branchName}
@@ -137,7 +138,7 @@ export default function BulkSourceChange({ closePopup, responseList, changeBranc
137138
<div className="dc__window-bg h-100 bcn-0 bulk-ci-trigger-container" ref={sourceChangeDetailRef}>
138139
{renderHeaderSection()}
139140
{showResponseModal ? (
140-
<SourceUpdateResponseModal closePopup={closePopup} isLoading={false} responseList={responseList} />
141+
<SourceUpdateResponseModal closePopup={closePopup} isLoading={loading} responseList={responseList}/>
141142
) : (
142143
<>
143144
{renderInfoBar()}

src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
Checkbox,
1616
CHECKBOX_VALUE,
1717
VisibleModal,
18+
WorkflowNodeType,
1819
} from '@devtron-labs/devtron-fe-common-lib'
1920
import CDMaterial from '../../../app/details/triggerView/cdMaterial'
2021
import { CIMaterial } from '../../../app/details/triggerView/ciMaterial'
@@ -24,7 +25,6 @@ import {
2425
CIMaterialRouterProps,
2526
MATERIAL_TYPE,
2627
NodeAttr,
27-
WorkflowNodeType,
2828
WorkflowType,
2929
} from '../../../app/details/triggerView/types'
3030
import { Workflow } from '../../../app/details/triggerView/workflow/Workflow'
@@ -57,6 +57,8 @@ import {
5757
BULK_CD_RESPONSE_STATUS_TEXT,
5858
BULK_VIRTUAL_RESPONSE_STATUS,
5959
GetBranchChangeStatus,
60+
SKIPPED_RESOURCES_STATUS_TEXT,
61+
SKIPPED_RESOURCES_MESSAGE,
6062
} from '../../Constants'
6163
import { ReactComponent as DeployIcon } from '../../../../assets/icons/ic-nav-rocket.svg'
6264
import { ReactComponent as Close } from '../../../../assets/icons/ic-cross.svg'
@@ -1001,8 +1003,13 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
10011003
setFilteredWorkflows(_workflows)
10021004
}
10031005

1006+
const isBuildAndBranchTriggerAllowed = (node: NodeAttr): boolean => (
1007+
!node.isLinkedCI && !node.isLinkedCD && node.type !== WorkflowNodeType.WEBHOOK
1008+
)
1009+
10041010
const changeBranch = (value): void => {
10051011
const appIds = []
1012+
const skippedResources = []
10061013
const appNameMap = new Map()
10071014

10081015
filteredWorkflows.forEach((wf) => {
@@ -1011,21 +1018,39 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
10111018
(node) => node.type === WorkflowNodeType.CI || node.type === WorkflowNodeType.WEBHOOK,
10121019
)
10131020
if (_ciNode) {
1014-
// Need to add check for webhook if its source type is git
1015-
if (!_ciNode.isLinkedCI && !_ciNode.isLinkedCD) {
1021+
if (isBuildAndBranchTriggerAllowed(_ciNode)) {
10161022
appIds.push(wf.appId)
10171023
appNameMap.set(wf.appId, wf.name)
10181024
}
1025+
else {
1026+
skippedResources.push({
1027+
appId: wf.appId,
1028+
appName: wf.name,
1029+
statusText: SKIPPED_RESOURCES_STATUS_TEXT,
1030+
status: BulkResponseStatus.SKIP,
1031+
envId: +envId,
1032+
message: SKIPPED_RESOURCES_MESSAGE,
1033+
})
1034+
}
10191035
}
10201036
}
10211037
})
10221038

1023-
if (!appIds.length) {
1039+
if (!appIds.length && !skippedResources.length) {
10241040
toast.error('No valid application present')
10251041
return
10261042
}
1027-
10281043
setIsBranchChangeLoading(true)
1044+
1045+
if (!appIds.length) {
1046+
updateResponseListData(skippedResources)
1047+
setIsBranchChangeLoading(false)
1048+
setCDLoading(false)
1049+
setCILoading(false)
1050+
preventBodyScroll(true)
1051+
return
1052+
}
1053+
10291054
triggerBranchChange(appIds, +envId, value)
10301055
.then((response: any) => {
10311056
const _responseList = []
@@ -1039,10 +1064,10 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
10391064
message: res.message,
10401065
})
10411066
})
1042-
updateResponseListData(_responseList)
1067+
updateResponseListData([..._responseList, ...skippedResources])
10431068
setCDLoading(false)
10441069
setCILoading(false)
1045-
preventBodyScroll(false)
1070+
preventBodyScroll(true)
10461071
})
10471072
.catch((error) => {
10481073
showError(error)
@@ -1206,6 +1231,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
12061231
setIsBranchChangeLoading(false)
12071232
setShowBulkSourceChangeModal(false)
12081233
setResponseList([])
1234+
preventBodyScroll(false)
12091235
}
12101236

12111237
const onShowChangeSourceModal = () => {
@@ -1324,10 +1350,11 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
13241350
promiseList: any[],
13251351
triggeredAppList: { appId: number; envId?: number; appName: string }[],
13261352
type: WorkflowNodeType,
1353+
skippedResources: ResponseRowType[] = [],
13271354
): void => {
1355+
const _responseList = skippedResources
13281356
if (promiseList.length) {
13291357
Promise.allSettled(promiseList).then((responses: any) => {
1330-
const _responseList = []
13311358
responses.forEach((response, index) => {
13321359
if (response.status === 'fulfilled') {
13331360
const statusType = filterStatusType(
@@ -1399,10 +1426,15 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
13991426
})
14001427
} else {
14011428
setCDLoading(false)
1402-
setShowBulkCDModal(false)
14031429
setCILoading(false)
1404-
setShowBulkCIModal(false)
1405-
setResponseList([])
1430+
if (!skippedResources.length) {
1431+
setShowBulkCDModal(false)
1432+
setShowBulkCIModal(false)
1433+
setResponseList([])
1434+
}
1435+
else {
1436+
updateResponseListData(_responseList)
1437+
}
14061438
}
14071439
}
14081440

@@ -1426,18 +1458,29 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
14261458
ReactGA.event(ENV_TRIGGER_VIEW_GA_EVENTS.BulkCITriggered)
14271459
setCILoading(true)
14281460
let node
1461+
const skippedResources = []
14291462
const nodeList: NodeAttr[] = [],
14301463
triggeredAppList: { appId: number; appName: string }[] = []
14311464
for (const _wf of filteredWorkflows) {
14321465
if (_wf.isSelected && (!appsToRetry || appsToRetry[_wf.appId])) {
14331466
node = _wf.nodes.find((node) => {
1434-
return node.type === WorkflowNodeType.CI
1467+
return node.type === WorkflowNodeType.CI || node.type === WorkflowNodeType.WEBHOOK
14351468
})
1436-
// Maybe we dont need to push webhook as well
1437-
if (node && !node.isLinkedCI && !node.isLinkedCD) {
1469+
1470+
if (node && isBuildAndBranchTriggerAllowed(node)) {
14381471
triggeredAppList.push({ appId: _wf.appId, appName: _wf.name })
14391472
nodeList.push(node)
14401473
}
1474+
else if (node && !isBuildAndBranchTriggerAllowed(node)) {
1475+
// skipped can never be in appsToRetry
1476+
skippedResources.push({
1477+
appId: _wf.appId,
1478+
appName: _wf.name,
1479+
statusText: SKIPPED_RESOURCES_STATUS_TEXT,
1480+
status: BulkResponseStatus.SKIP,
1481+
message: SKIPPED_RESOURCES_MESSAGE,
1482+
})
1483+
}
14411484
}
14421485
}
14431486
const _CITriggerPromiseList = []
@@ -1479,13 +1522,15 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
14791522
}
14801523
_CITriggerPromiseList.push(triggerCINode(payload))
14811524
})
1482-
if (!_CITriggerPromiseList.length) {
1525+
1526+
if (!_CITriggerPromiseList.length && !skippedResources.length) {
14831527
toast.error('No valid CI pipeline found')
14841528
setCDLoading(false)
14851529
setCILoading(false)
14861530
return
14871531
}
1488-
handleBulkTrigger(_CITriggerPromiseList, triggeredAppList, WorkflowNodeType.CI)
1532+
1533+
handleBulkTrigger(_CITriggerPromiseList, triggeredAppList, WorkflowNodeType.CI, skippedResources)
14891534
}
14901535

14911536
// Would only set data no need to get data related to materials from it, we will get that in bulk trigger

0 commit comments

Comments
 (0)