@devtron-labs/devtron-fe-common-lib 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -192,6 +192,11 @@ export interface UserApprovalMetadataType {
192
192
  approvedUsersData: ApprovalUserDataType[];
193
193
  requestedUserData: ApprovalUserDataType;
194
194
  }
195
+ export declare enum FilterStates {
196
+ BLOCKED = 0,
197
+ ALLOWED = 1,
198
+ ERROR = 2
199
+ }
195
200
  export interface CDMaterialType {
196
201
  index: number;
197
202
  id: string;
@@ -217,6 +222,7 @@ export interface CDMaterialType {
217
222
  imageComment?: ImageComment;
218
223
  imageReleaseTags?: ReleaseTag[];
219
224
  artifactStatus?: string;
225
+ filterState: FilterStates;
220
226
  }
221
227
  export interface CommonNodeAttr {
222
228
  connectingCiPipelineId?: number;
package/dist/index.js CHANGED
@@ -424,6 +424,12 @@ exports.DeploymentNodeType = void 0;
424
424
  DeploymentNodeType["POSTCD"] = "POSTCD";
425
425
  DeploymentNodeType["APPROVAL"] = "APPROVAL";
426
426
  })(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
427
+ exports.FilterStates = void 0;
428
+ (function (FilterStates) {
429
+ FilterStates[FilterStates["BLOCKED"] = 0] = "BLOCKED";
430
+ FilterStates[FilterStates["ALLOWED"] = 1] = "ALLOWED";
431
+ FilterStates[FilterStates["ERROR"] = 2] = "ERROR";
432
+ })(exports.FilterStates || (exports.FilterStates = {}));
427
433
  exports.DeploymentAppTypes = void 0;
428
434
  (function (DeploymentAppTypes) {
429
435
  DeploymentAppTypes["HELM"] = "helm";
@@ -22567,6 +22573,7 @@ function getUserRole(appName) {
22567
22573
  function setImageTags(request, pipelineId, artifactId) {
22568
22574
  return post("".concat(ROUTES.IMAGE_TAGGING, "/").concat(pipelineId, "/").concat(artifactId), request);
22569
22575
  }
22576
+ // TODO: Add enum for filterState as well
22570
22577
  var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
22571
22578
  var URL = (!imageTag) ? "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=").concat(stageMap[stageType]) : "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=").concat(stageMap[stageType], "&search=").concat(imageTag);
22572
22579
  return get(URL, {
@@ -22581,7 +22588,9 @@ var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalN
22581
22588
  }
22582
22589
  else {
22583
22590
  var materials = artifacts.map(function (material, index) {
22591
+ var _a;
22584
22592
  var artifactStatusValue = '';
22593
+ var filterState = (_a = material.filterState) !== null && _a !== void 0 ? _a : exports.FilterStates.ALLOWED;
22585
22594
  return {
22586
22595
  index: index,
22587
22596
  id: material.id,
@@ -22601,7 +22610,7 @@ var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalN
22601
22610
  vulnerabilitiesLoading: true,
22602
22611
  scanned: material.scanned,
22603
22612
  scanEnabled: material.scanEnabled,
22604
- isSelected: !material.vulnerable && index === 0,
22613
+ isSelected: !material.vulnerable && filterState === exports.FilterStates.ALLOWED && index === 0,
22605
22614
  vulnerable: material.vulnerable,
22606
22615
  runningOnParentCd: material.runningOnParentCd,
22607
22616
  artifactStatus: artifactStatusValue,
@@ -22628,6 +22637,7 @@ var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalN
22628
22637
  };
22629
22638
  })
22630
22639
  : [],
22640
+ filterState: filterState,
22631
22641
  };
22632
22642
  });
22633
22643
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -2,7 +2,7 @@ import moment from 'moment';
2
2
  import {get, post} from './Api';
3
3
  import { ROUTES } from './Constants'
4
4
  import { sortCallback } from './Helper';
5
- import { TeamList ,ResponseType, DeploymentNodeType, CDModalTab } from './Types';
5
+ import { TeamList ,ResponseType, DeploymentNodeType, CDModalTab, FilterStates } from './Types';
6
6
 
7
7
  export const getTeamListMin = (): Promise<TeamList> => {
8
8
  // ignore active field
@@ -51,6 +51,7 @@ export function setImageTags(request, pipelineId: number, artifactId: number){
51
51
  return post(`${ROUTES.IMAGE_TAGGING}/${pipelineId}/${artifactId}`,request )
52
52
  }
53
53
 
54
+ // TODO: Add enum for filterState as well
54
55
  export const getCDMaterials = (
55
56
  cdMaterialId,
56
57
  stageType: DeploymentNodeType,
@@ -71,6 +72,8 @@ export const getCDMaterials = (
71
72
  else {
72
73
  const materials = artifacts.map((material, index) => {
73
74
  let artifactStatusValue = ''
75
+ const filterState = material.filterState ?? FilterStates.ALLOWED
76
+
74
77
  return {
75
78
  index,
76
79
  id: material.id,
@@ -90,7 +93,7 @@ export const getCDMaterials = (
90
93
  vulnerabilitiesLoading: true,
91
94
  scanned: material.scanned,
92
95
  scanEnabled: material.scanEnabled,
93
- isSelected: !material.vulnerable && index === 0,
96
+ isSelected: !material.vulnerable && filterState === FilterStates.ALLOWED && index === 0,
94
97
  vulnerable: material.vulnerable,
95
98
  runningOnParentCd: material.runningOnParentCd,
96
99
  artifactStatus: artifactStatusValue,
@@ -118,6 +121,7 @@ export const getCDMaterials = (
118
121
  }
119
122
  })
120
123
  : [],
124
+ filterState,
121
125
  }
122
126
  })
123
127
  return {
@@ -215,6 +215,11 @@ export interface UserApprovalMetadataType {
215
215
  requestedUserData: ApprovalUserDataType
216
216
  }
217
217
 
218
+ export enum FilterStates {
219
+ BLOCKED = 0,
220
+ ALLOWED = 1,
221
+ ERROR = 2
222
+ }
218
223
 
219
224
  export interface CDMaterialType {
220
225
  index: number
@@ -241,6 +246,7 @@ export interface CDMaterialType {
241
246
  imageComment?: ImageComment
242
247
  imageReleaseTags?: ReleaseTag[]
243
248
  artifactStatus?: string
249
+ filterState: FilterStates;
244
250
  }
245
251
 
246
252
  export interface CommonNodeAttr {