-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathAppGroup.types.ts
644 lines (568 loc) · 18 KB
/
AppGroup.types.ts
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
/*
* Copyright (c) 2024. Devtron Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
ACTION_STATE,
CDModalTabType,
DeploymentNodeType,
FilterConditionsListType,
MODAL_TYPE,
ResponseType,
WorkflowNodeType,
WorkflowType,
AppInfoListType,
GVKType,
UseUrlFiltersReturnType,
CommonNodeAttr,
ApprovalConfigDataType,
RuntimePluginVariables,
} from '@devtron-labs/devtron-fe-common-lib'
import { CDMaterialProps, RuntimeParamsErrorState } from '../app/details/triggerView/types'
import { EditDescRequest, NodeType, Nodes, OptionType } from '../app/types'
import { MultiValue } from 'react-select'
import { AppFilterTabs, BulkResponseStatus } from './Constants'
import { WorkloadCheckType } from '../v2/appDetails/sourceInfo/scaleWorkloads/scaleWorkloadsModal.type'
import {
AppConfigState,
EnvConfigurationsNavProps,
EnvConfigurationState,
} from '@Pages/Applications/DevtronApps/Details/AppConfigurations/AppConfig.types'
import { WebhookPayloadType } from '@Components/app/details/triggerView/types'
import { TIME_STAMP_ORDER } from '@Components/app/details/triggerView/Constants'
interface BulkTriggerAppDetailType {
workFlowId: string
appId: number
name: string
material?: any[]
warningMessage?: string
}
export interface BulkCIDetailType extends BulkTriggerAppDetailType {
ciPipelineName: string
ciPipelineId: string
isFirstTrigger: boolean
isCacheAvailable: boolean
isLinkedCI: boolean
isLinkedCD: boolean
title: string
isJobCI: boolean
isWebhookCI: boolean
parentAppId: number
parentCIPipelineId: number
errorMessage: string
hideSearchHeader: boolean
filteredCIPipelines: any
}
export interface BulkCDDetailTypeResponse {
bulkCDDetailType: BulkCDDetailType[]
uniqueReleaseTags: string[]
}
export interface BulkCDDetailType
extends BulkTriggerAppDetailType,
Pick<CDMaterialProps, 'isTriggerBlockedDueToPlugin' | 'configurePluginURL' | 'consequence'>,
Partial<Pick<CommonNodeAttr, 'showPluginWarning' | 'triggerBlockedInfo'>> {
cdPipelineName?: string
cdPipelineId?: string
stageType?: DeploymentNodeType
triggerType?: string
envName: string
envId: number
parentPipelineId?: string
parentPipelineType?: WorkflowNodeType
parentEnvironmentName?: string
approvalConfigData?: ApprovalConfigDataType
requestedUserId?: number
appReleaseTags?: string[]
tagsEditable?: boolean
ciPipelineId?: number
hideImageTaggingHardDelete?: boolean
resourceFilters?: FilterConditionsListType[]
}
export interface ResponseRowType {
appId: number
appName: string
status: BulkResponseStatus
statusText: string
message: string
isVirtual?: boolean
envId?: number
}
interface BulkRuntimeParamsType {
runtimeParams: Record<string, RuntimePluginVariables[]>
setRuntimeParams: React.Dispatch<React.SetStateAction<Record<string, RuntimePluginVariables[]>>>
runtimeParamsErrorState: Record<string, RuntimeParamsErrorState>
setRuntimeParamsErrorState: React.Dispatch<React.SetStateAction<Record<string, RuntimeParamsErrorState>>>
}
export interface BulkCITriggerType extends BulkRuntimeParamsType {
appList: BulkCIDetailType[]
closePopup: (e) => void
updateBulkInputMaterial: (materialList: Record<string, any[]>) => void
onClickTriggerBulkCI: (appIgnoreCache: Record<number, boolean>, appsToRetry?: Record<string, boolean>) => void
getWebhookPayload: (id, webhookTimeStampOrder?: typeof TIME_STAMP_ORDER) => void
webhookPayloads: WebhookPayloadType
setWebhookPayloads: React.Dispatch<React.SetStateAction<WebhookPayloadType>>
isWebhookPayloadLoading: boolean
isShowRegexModal: (_appId: number, ciNodeId: number, inputMaterialList: any[]) => boolean
responseList: ResponseRowType[]
isLoading: boolean
setLoading: React.Dispatch<React.SetStateAction<boolean>>
setPageViewType: React.Dispatch<React.SetStateAction<string>>
}
export interface BulkCDTriggerType extends BulkRuntimeParamsType {
stage: DeploymentNodeType
appList: BulkCDDetailType[]
closePopup: (e) => void
updateBulkInputMaterial: (materialList: Record<string, any>) => void
onClickTriggerBulkCD: (skipIfHibernated: boolean, appsToRetry?: Record<string, boolean>) => void
changeTab?: (
materrialId: string | number,
artifactId: number,
tab: CDModalTabType,
selectedCDDetail?: { id: number; type: DeploymentNodeType },
) => void
toggleSourceInfo?: (materialIndex: number, selectedCDDetail?: { id: number; type: DeploymentNodeType }) => void
selectImage?: (
index: number,
materialType: string,
selectedCDDetail?: { id: number; type: DeploymentNodeType },
) => void
responseList: ResponseRowType[]
isLoading: boolean
setLoading: React.Dispatch<React.SetStateAction<boolean>>
isVirtualEnv?: boolean
uniqueReleaseTags: string[]
}
export interface ProcessWorkFlowStatusType {
cicdInProgress: boolean
workflows: WorkflowType[]
}
export interface CIWorkflowStatusType {
ciPipelineId: number
ciPipelineName: string
ciStatus: string
storageConfigured: boolean
}
export interface CDWorkflowStatusType {
ci_pipeline_id: number
pipeline_id: number
deploy_status: string
pre_status: string
post_status: string
}
export interface WorkflowsResponseType {
workflows: WorkflowType[]
filteredCIPipelines: Map<string, any>
}
export interface TriggerResponseModalBodyProps {
responseList: ResponseRowType[]
isLoading: boolean
isVirtualEnv?: boolean
envName?: string
}
type RetryFailedType =
| {
onClickRetryDeploy: BulkCDTriggerType['onClickTriggerBulkCD']
skipHibernatedApps: boolean
onClickRetryBuild?: never
}
| {
onClickRetryDeploy?: never
skipHibernatedApps?: never
onClickRetryBuild: (appsToRetry: Record<string, boolean>) => void
}
export type TriggerResponseModalFooterProps = Pick<TriggerResponseModalBodyProps, 'isLoading' | 'responseList'> & {
closePopup: (e) => void
} & RetryFailedType
export interface TriggerModalRowType {
rowData: ResponseRowType
index: number
isVirtualEnv?: boolean
envName?: string
}
export interface WorkflowNodeSelectionType {
id: number
name: string
type: WorkflowNodeType
}
export interface WorkflowAppSelectionType {
id: number
name: string
preNodeAvailable: boolean
postNodeAvailable: boolean
}
export interface ConfigAppList {
id: number
name: string
}
export interface EnvApp {
envCount: number
envList: EnvAppList[]
}
export interface EnvDeploymentStatus {
appId: number
pipelineId: number
deployStatus: string
wfrId?: number
}
export interface EnvAppList {
id: number
environment_name: string
cluster_name: string
active: boolean
default: boolean
namespace: string
isClusterCdActive: boolean
environmentIdentifier: string
appCount: number
isVirtualEnvironment?: boolean
}
export interface EmptyEnvState {
title?: string
subTitle?: string
actionHandler?: () => void
}
export interface AppListDataType {
environment: string
namespace: string
cluster: string
appInfoList: AppInfoListType[]
}
export interface EnvSelectorType {
onChange: (e) => void
envId: number
envName: string
}
export interface ApplicationRouteType {
envAppList: ConfigAppList[]
envConfig: EnvConfigurationState
fetchEnvConfig: EnvConfigurationsNavProps['fetchEnvConfig']
appIdToAppApprovalConfigMap: AppConfigState['envIdToEnvApprovalConfigurationMap']
}
export interface AppGroupFilterConfig
extends Pick<UseUrlFiltersReturnType<never>, 'searchKey' | 'offset' | 'pageSize'> {
cluster: string[]
}
export interface GetEnvAppListParamsType extends Pick<AppGroupFilterConfig, 'offset'> {
size: number
envName: string
clusterIds: string
}
export interface EnvironmentsListViewType
extends Partial<Pick<UseUrlFiltersReturnType<never>, 'changePage' | 'changePageSize' | 'clearFilters'>> {
isSuperAdmin: boolean
filterConfig?: AppGroupFilterConfig
appListResponse: EnvAppType
appListLoading: boolean
}
export interface EnvironmentLinkProps {
namespace: string
environmentId: number
appCount: number
handleClusterClick: (e) => void
environmentName: string
}
export interface AppOverridesType {
appList?: ConfigAppList[]
environments: any
setEnvironments: any
}
export interface GroupFilterType {
appListOptions: OptionType[]
selectedAppList: MultiValue<OptionType>
setSelectedAppList: React.Dispatch<React.SetStateAction<MultiValue<OptionType>>>
selectedFilterTab: AppFilterTabs
setSelectedFilterTab: React.Dispatch<React.SetStateAction<AppFilterTabs>>
groupFilterOptions: GroupOptionType[]
selectedGroupFilter: MultiValue<GroupOptionType>
setSelectedGroupFilter: React.Dispatch<React.SetStateAction<MultiValue<GroupOptionType>>>
openCreateGroup: (e, groupId?: string) => void
openDeleteGroup: (e, groupId: string) => void
isSuperAdmin: boolean
}
export interface EnvHeaderType extends GroupFilterType {
envName: string
setEnvName: (label: string) => void
setShowEmpty: (empty: boolean) => void
showEmpty: boolean
}
export interface AppGroupAdminType {
isSuperAdmin: boolean
}
export interface AppGroupDetailDefaultType {
filteredAppIds: string
appGroupListData?: AppGroupListType
isVirtualEnv?: boolean
envName?: string
description?: string
getAppListData?: () => Promise<OptionType[]>
handleSaveDescription?: (description: string) => Promise<void>
}
interface CIPipeline {
appName: string
appId: number
id: number
parentCiPipeline: number
parentAppId: number
pipelineType?: string
}
export interface CIConfigListType {
pipelineList: CIPipeline[]
securityModuleInstalled: boolean
blobStorageConfigured: boolean
}
export interface AppGroupAppFilterContextType {
resourceId: string
appListOptions: OptionType[]
selectedAppList: MultiValue<OptionType>
setSelectedAppList: React.Dispatch<React.SetStateAction<MultiValue<OptionType>>>
isMenuOpen: boolean
setMenuOpen: React.Dispatch<React.SetStateAction<boolean>>
selectedFilterTab: AppFilterTabs
setSelectedFilterTab: React.Dispatch<React.SetStateAction<AppFilterTabs>>
groupFilterOptions: GroupOptionType[]
selectedGroupFilter: MultiValue<GroupOptionType>
setSelectedGroupFilter: React.Dispatch<React.SetStateAction<MultiValue<GroupOptionType>>>
openCreateGroup: (e, groupId?: string, _edit?: boolean) => void
openDeleteGroup: (e, groupId: string, _delete?: boolean) => void
isSuperAdmin: boolean
filterParentType: FilterParentType
}
export interface CreateGroupAppListType {
id: string
appName: string
isSelected: boolean
}
export interface CreateTypeOfAppListType {
id: number
appName: string
}
export interface CreateGroupType {
appList: CreateGroupAppListType[]
selectedAppGroup: GroupOptionType
unAuthorizedApps?: Map<string, boolean>
closePopup: (e, groupId?: number) => void
filterParentType: FilterParentType
}
export interface ApplistEnvType {
appId: number
appName: string
appStatus: string
lastDeployedTime: string
lastDeployedBy?: string
lastDeployedImage?: string
commits?: string[]
ciArtifactId?: number
}
export interface AppGroupListType {
namespace: string
environmentName: string
clusterName: string
environmentId: number
apps: ApplistEnvType[]
description?: string
environmentType?: 'Non-Production' | 'Production'
createdOn?: string
createdBy?: string
clusterId?: number
}
export interface ConfigAppListType extends ResponseType {
result?: ConfigAppList[]
}
export interface EnvAppType extends ResponseType {
result?: EnvApp
}
export interface AppGroupList extends ResponseType {
result?: AppGroupListType
}
export interface EnvDeploymentStatusType extends ResponseType {
result?: EnvDeploymentStatus[]
}
export interface EnvGroupListType {
id: number
name: string
appIds: number[]
description: string
}
export interface CheckPermissionType {
id?: number
appIds: number[]
name?: string
description?: string
envId?: number
active?: boolean
}
export interface EnvGroupListResponse extends ResponseType {
result?: EnvGroupListType[]
}
export interface EnvGroupResponse extends ResponseType {
result?: EnvGroupListType
}
export interface CheckPermissionResponse extends ResponseType {
result?: boolean
}
export interface GroupOptionType extends OptionType {
appIds: number[]
description: string
}
export interface SearchBarType {
placeholder: string
searchText: string
setSearchText: React.Dispatch<React.SetStateAction<string>>
searchApplied: boolean
setSearchApplied: React.Dispatch<React.SetStateAction<boolean>>
}
export interface EditDescRequestResponse extends ResponseType {
result?: EditDescRequest
}
export enum FilterParentType {
app = 'env-group',
env = 'app-group',
}
export interface HibernateStatusRowType {
rowData: HibernateResponseRowType
index: number
isHibernateOperation: boolean
isVirtualEnv?: boolean
hibernateInfoMap: Record<number, HibernateInfoMapProps>
}
export interface HibernateResponseRowType {
id: number
appName: string
success: boolean
authError?: boolean
error?: string
skipped?: string
}
export interface HibernateInfoMapProps {
type: string
excludedUserEmails: string[]
userActionState: ACTION_STATE
}
type HibernateModalType = MODAL_TYPE.HIBERNATE | MODAL_TYPE.UNHIBERNATE
export interface HibernateModalProps {
setOpenedHibernateModalType: React.Dispatch<React.SetStateAction<HibernateModalType>>
selectedAppDetailsList: AppInfoListType | AppInfoListType[]
appDetailsList: AppGroupListType['apps']
envName: string
envId: string
setAppStatusResponseList: React.Dispatch<React.SetStateAction<any[]>>
setShowHibernateStatusDrawer: React.Dispatch<React.SetStateAction<StatusDrawer>>
isDeploymentWindowLoading: boolean
showDefaultDrawer: boolean
openedHibernateModalType: HibernateModalType
isDeploymentBlockedViaWindow: boolean
onClose?: () => void
}
export interface StatusDrawer {
hibernationOperation: boolean
showStatus: boolean
inProgress: boolean
}
export interface ManageAppsResponse {
appName: string
id: number
success: boolean
skipped?: string
error?: string
authError?: boolean
}
export interface RestartWorkloadModalProps {
selectedAppDetailsList: AppInfoListType | AppInfoListType[]
envName: string
envId: string
restartLoader: boolean
setRestartLoader: React.Dispatch<React.SetStateAction<boolean>>
hibernateInfoMap: Record<number, HibernateInfoMapProps>
isDeploymentBlockedViaWindow: boolean
onClose?: () => void
}
export interface RestartStatusListDrawerProps {
bulkRotatePodsMap: BulkRotatePodsMap
statusModalLoading: boolean
envName: string
hibernateInfoMap: Record<number, HibernateInfoMapProps>
}
// ----------------------------Restart Workload DTO--------------------------------------------
export interface ResourceIdentifierDTO extends ResourceErrorMetaData {
name: string
namespace?: string // This is only in the post response structure and not in get api
groupVersionKind: GVKType
}
export interface AppInfoMetaDataDTO {
resourceMetaData: ResourceIdentifierDTO[]
appName: string
errorResponse?: string
}
export interface RestartPodMapDTO {
[appId: number]: AppInfoMetaDataDTO
}
export interface WorkloadListResultDTO {
environmentId: number
namespace: string
restartPodMap: RestartPodMapDTO
}
// ----------------------------Bulk Restart Data Manipulation-----------------------------------
export interface ResourceErrorMetaData {
containsError?: boolean
errorResponse?: string
}
export interface AppStatusMetaData {
failedCount?: number
successCount?: number
}
export interface ResourceMetaData extends WorkloadCheckType, ResourceErrorMetaData {
group: string
kind: Nodes | NodeType
version: string
name: string
}
export interface ResourcesMetaDataMap {
[kindName: string]: ResourceMetaData
}
export interface BulkRotatePodsMetaData extends WorkloadCheckType, AppStatusMetaData {
appName: string
resources?: ResourcesMetaDataMap
namespace: string
errorResponse?: string
}
export interface BulkRotatePodsMap {
[appId: number]: BulkRotatePodsMetaData
}
export interface AllExpandableDropdownTypes {
expandedAppIds: number[]
setExpandedAppIds: React.Dispatch<React.SetStateAction<number[]>>
bulkRotatePodsMap: BulkRotatePodsMap
SvgImage: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
iconClassName?: string
dropdownLabel?: string
isExpandableButtonClicked: boolean
setExpandableButtonClicked: React.Dispatch<React.SetStateAction<boolean>>
}
export interface ManageAppsResponseType {
appName: string
success: boolean
id: string
error: string
}
export enum AppGroupUrlFilters {
cluster = 'cluster',
}
export interface AppGroupUrlFiltersType extends Record<AppGroupUrlFilters, string[]> {}
export interface SetFiltersInLocalStorageParamsType {
filterParentType: FilterParentType
resourceId: string
resourceList: MultiValue<OptionType>
groupList: MultiValue<GroupOptionType>
}
export type AppEnvLocalStorageKeyType = `${string}__filter`