@devtron-labs/devtron-fe-common-lib 0.2.24 → 0.2.26-beta-1

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.
Files changed (31) hide show
  1. package/dist/Common/Common.service.d.ts +2 -0
  2. package/dist/Common/Types.d.ts +3 -2
  3. package/dist/Shared/Components/KeyValueTable/KeyValueTable.component.d.ts +1 -1
  4. package/dist/Shared/Components/KeyValueTable/KeyValueTable.types.d.ts +28 -7
  5. package/dist/Shared/Components/KeyValueTable/constants.d.ts +2 -0
  6. package/dist/Shared/Components/TabGroup/TabGroup.component.d.ts +2 -0
  7. package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +111 -0
  8. package/dist/Shared/Components/TabGroup/TabGroup.utils.d.ts +7 -0
  9. package/dist/Shared/Components/TabGroup/index.d.ts +2 -0
  10. package/dist/Shared/Components/index.d.ts +1 -0
  11. package/dist/Shared/constants.d.ts +3 -0
  12. package/dist/Shared/types.d.ts +13 -0
  13. package/dist/assets/index.css +1 -1
  14. package/dist/{cssMode-CRUBjsi5.js → cssMode-D6wT7TAh.js} +1 -1
  15. package/dist/{freemarker2-CLlxqsl-.js → freemarker2-Cz5jtPuQ.js} +1 -1
  16. package/dist/{handlebars-B6lyOnzG.js → handlebars-BZvwbEKY.js} +1 -1
  17. package/dist/{html-lAmXB-IE.js → html-rkAGHfZm.js} +1 -1
  18. package/dist/{htmlMode--9UVZVdn.js → htmlMode-D3ZKl7nj.js} +1 -1
  19. package/dist/{index-5BYTRdf3.js → index-DBeUZp3g.js} +18644 -18461
  20. package/dist/index.js +498 -493
  21. package/dist/{javascript-694ZVMg8.js → javascript-D-lGoUa0.js} +1 -1
  22. package/dist/{jsonMode-Dmh6ZoP5.js → jsonMode-B5APL9CY.js} +1 -1
  23. package/dist/{liquid-cCgHRKYN.js → liquid-CgBClg2M.js} +1 -1
  24. package/dist/{mdx-BunKYBub.js → mdx-C-u9yyhx.js} +1 -1
  25. package/dist/{python-B1avY699.js → python-C2VF9B2p.js} +1 -1
  26. package/dist/{razor-BEndl8O8.js → razor-BqqYiLer.js} +1 -1
  27. package/dist/{tsMode-DLdiu18i.js → tsMode-CoGjXPdz.js} +1 -1
  28. package/dist/{typescript-DRxjI6mI.js → typescript-B8NOcSlu.js} +1 -1
  29. package/dist/{xml-DlajdoYB.js → xml-vMEctUNX.js} +1 -1
  30. package/dist/{yaml-Md-8DsZ-.js → yaml-B3WL3doS.js} +1 -1
  31. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { RuntimeParamsAPIResponseType, RuntimeParamsListItemType } from '../Shared/types';
1
2
  import { TeamList, ResponseType, DeploymentNodeType, CDMaterialServiceEnum, CDMaterialServiceQueryParams, CDMaterialResponseType, CDMaterialFilterQuery, EnvironmentListHelmResponse } from './Types';
2
3
  import { ApiResourceType } from '../Pages';
3
4
  export declare const getTeamListMin: () => Promise<TeamList>;
@@ -14,6 +15,7 @@ export declare const SourceTypeMap: {
14
15
  };
15
16
  export declare function getUserRole(appName?: string): Promise<UserRole>;
16
17
  export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType<any>>;
18
+ export declare const parseRuntimeParams: (response: RuntimeParamsAPIResponseType) => RuntimeParamsListItemType[];
17
19
  export declare const processCDMaterialServiceResponse: (cdMaterialsResult: any, stage: DeploymentNodeType, offset: number, filter: CDMaterialFilterQuery, disableDefaultSelection?: boolean) => CDMaterialResponseType;
18
20
  export declare const genericCDMaterialsService: (serviceType: CDMaterialServiceEnum, cdMaterialID: number, stage: DeploymentNodeType, signal: AbortSignal, queryParams?: CDMaterialServiceQueryParams) => Promise<CDMaterialResponseType>;
19
21
  export declare function extractImage(image: string): string;
@@ -1,9 +1,9 @@
1
1
  import { default as React, ReactNode, CSSProperties } from 'react';
2
2
  import { Placement } from 'tippy.js';
3
+ import { UserGroupDTO } from '../Pages/GlobalConfigurations';
3
4
  import { ImageComment, ReleaseTag } from './ImageTags.Types';
4
5
  import { ACTION_STATE, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.';
5
- import { UserGroupDTO } from '../Pages/GlobalConfigurations';
6
- import { RegistryType, Severity } from '../Shared';
6
+ import { RegistryType, RuntimeParamsListItemType, Severity } from '../Shared';
7
7
  /**
8
8
  * Generic response type object with support for overriding the result type
9
9
  *
@@ -596,6 +596,7 @@ export interface CDMaterialsMetaInfo {
596
596
  * This is the ID of user that has request the material
597
597
  */
598
598
  requestedUserId: number;
599
+ runtimeParams: RuntimeParamsListItemType[];
599
600
  }
600
601
  export interface ImagePromotionMaterialInfo {
601
602
  isApprovalPendingForPromotion: boolean;
@@ -1,2 +1,2 @@
1
1
  import { KeyValueTableProps } from './KeyValueTable.types';
2
- export declare const KeyValueTable: <K extends string>({ config, maskValue, isSortable, headerComponent, onChange, onDelete, placeholder, isAdditionNotAllowed, readOnly, showError, validationSchema, errorMessages, onError, }: KeyValueTableProps<K>) => JSX.Element;
2
+ export declare const KeyValueTable: <K extends string>({ config, maskValue, isSortable, headerComponent, onChange, onDelete, placeholder, isAdditionNotAllowed, readOnly, showError, validationSchema: parentValidationSchema, errorMessages: parentErrorMessages, onError, validateDuplicateKeys, validateEmptyKeys, }: KeyValueTableProps<K>) => JSX.Element;
@@ -35,6 +35,29 @@ export interface KeyValueConfig<K extends string> {
35
35
  /** An array of key-value rows. */
36
36
  rows: KeyValueRow<K>[];
37
37
  }
38
+ type ErrorUIProps = {
39
+ /**
40
+ * Indicates whether to show errors.
41
+ */
42
+ showError: true;
43
+ /**
44
+ * @default - false
45
+ * If true, would validate for duplicate keys and if present would show error tooltip on the cell.
46
+ */
47
+ validateDuplicateKeys?: boolean;
48
+ /**
49
+ * @default - false
50
+ * If true, would validate for rows having values but no key and if error would show error tooltip on the cell.
51
+ */
52
+ validateEmptyKeys?: boolean;
53
+ } | {
54
+ /**
55
+ * Indicates whether to show errors.
56
+ */
57
+ showError?: false;
58
+ validateDuplicateKeys?: never;
59
+ validateEmptyKeys?: never;
60
+ };
38
61
  /**
39
62
  * Type representing a mask for key-value pairs.
40
63
  * @template K - A string representing the key type.
@@ -49,7 +72,7 @@ export type KeyValuePlaceholder<K extends string> = {
49
72
  * Interface representing the properties for a key-value table component.
50
73
  * @template K - A string representing the key type.
51
74
  */
52
- export interface KeyValueTableProps<K extends string> {
75
+ export type KeyValueTableProps<K extends string> = {
53
76
  /** The configuration for the key-value table. */
54
77
  config: KeyValueConfig<K>;
55
78
  /** An optional mask for the key-value pairs. */
@@ -75,18 +98,15 @@ export interface KeyValueTableProps<K extends string> {
75
98
  * @param deletedRowIndex - The index of the row that was deleted.
76
99
  */
77
100
  onDelete?: (deletedRowId: string | number) => void;
78
- /**
79
- * Indicates whether to show errors.
80
- */
81
- showError?: boolean;
82
101
  /**
83
102
  * The function to use to validate the value of the cell.
84
103
  * @param value - The value to validate.
85
104
  * @param key - The row key of the value.
105
+ * @param rowId - The id of the row.
86
106
  * @returns Return true if the value is valid, otherwise false
87
107
  * and set `showError` to `true` and provide errorMessages array to show error message.
88
108
  */
89
- validationSchema?: (value: string, key: K) => boolean;
109
+ validationSchema?: (value: string, key: K, rowId: string | number) => boolean;
90
110
  /**
91
111
  * An array of error messages to be displayed in the cell error tooltip.
92
112
  */
@@ -96,4 +116,5 @@ export interface KeyValueTableProps<K extends string> {
96
116
  * @param errorState - The error state, true when any cell has error, otherwise false.
97
117
  */
98
118
  onError?: (errorState: boolean) => void;
99
- }
119
+ } & ErrorUIProps;
120
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const DUPLICATE_KEYS_VALIDATION_MESSAGE = "Keys must be unique";
2
+ export declare const EMPTY_KEY_VALIDATION_MESSAGE = "Key cannot be empty";
@@ -0,0 +1,2 @@
1
+ import { TabGroupProps } from './TabGroup.types';
2
+ export declare const TabGroup: ({ tabs, size, rightComponent, alignActiveBorderWithContainer, hideTopPadding, }: TabGroupProps) => JSX.Element;
@@ -0,0 +1,111 @@
1
+ import { LinkProps, NavLinkProps } from 'react-router-dom';
2
+ import { ComponentSizeType } from '../../constants';
3
+ import { DataAttributes } from '../../types';
4
+ type TabComponentProps<TabTypeProps> = TabTypeProps & DataAttributes;
5
+ type ConditionalTabType = {
6
+ /**
7
+ * Type of the tab, either `button`, `link` or `navLink`.
8
+ */
9
+ tabType: 'button';
10
+ /**
11
+ * Props passed to button component.
12
+ */
13
+ props?: TabComponentProps<Omit<React.ComponentProps<'button'>, 'className' | 'style'>>;
14
+ /**
15
+ * Indicates if the tab is currently active.
16
+ */
17
+ active?: boolean;
18
+ } | {
19
+ /**
20
+ * Type of the tab, either `button`, `link` or `navLink`.
21
+ */
22
+ tabType: 'navLink';
23
+ /**
24
+ * Props passed to nav link component.
25
+ */
26
+ props: TabComponentProps<Omit<NavLinkProps, 'className' | 'style' | 'activeClassName'>>;
27
+ /**
28
+ * Active state is determined by matching the URL.
29
+ */
30
+ active?: false;
31
+ } | {
32
+ /**
33
+ * Type of the tab, either `button`, `link` or `navLink`.
34
+ */
35
+ tabType: 'link';
36
+ /**
37
+ * Props passed to link component.
38
+ */
39
+ props: TabComponentProps<Omit<LinkProps, 'className' | 'style'>>;
40
+ /**
41
+ * Indicates if the tab is currently active.
42
+ */
43
+ active?: boolean;
44
+ };
45
+ export type TabProps = {
46
+ /**
47
+ * Unique identifier for the tab.
48
+ */
49
+ id: string | number;
50
+ /**
51
+ * Text label for the tab.
52
+ */
53
+ label: string;
54
+ /**
55
+ * Icon component to be displayed in the tab.
56
+ * This should be a functional component that renders an SVG.
57
+ */
58
+ icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
59
+ /**
60
+ * Type of the icon, determining whether it uses a stroke or fill style.
61
+ */
62
+ iconType?: 'stroke' | 'fill';
63
+ /**
64
+ * Badge number to be displayed on the tab, typically for notifications.
65
+ */
66
+ badge?: number;
67
+ /**
68
+ * Indicates if an indicator should be shown on the tab.
69
+ */
70
+ showIndicator?: boolean;
71
+ /**
72
+ * Indicates if a warning state should be displayed on the tab.
73
+ * @note error state will take precedence over warning state.
74
+ */
75
+ showWarning?: boolean;
76
+ /**
77
+ * Indicates if an error state should be displayed on the tab.
78
+ * @note error state will take precedence over warning state.
79
+ */
80
+ showError?: boolean;
81
+ /**
82
+ * Disables the tab, preventing interaction and indicating an inactive state.
83
+ */
84
+ disabled?: boolean;
85
+ } & ConditionalTabType;
86
+ export interface TabGroupProps {
87
+ /**
88
+ * Array of tabs to be rendered.
89
+ */
90
+ tabs: TabProps[];
91
+ /**
92
+ * Size of the tabs.
93
+ * @default ComponentSizeType.large
94
+ */
95
+ size?: ComponentSizeType.large | ComponentSizeType.medium;
96
+ /**
97
+ * Optional component to be rendered on the right side of the tab list.
98
+ */
99
+ rightComponent?: React.ReactElement;
100
+ /**
101
+ * Set to `true` to align the active tab's border with the bottom border of the parent container.
102
+ * @default false
103
+ */
104
+ alignActiveBorderWithContainer?: boolean;
105
+ /**
106
+ * Determines if the top padding of the tab group should be hidden.
107
+ * @default false
108
+ */
109
+ hideTopPadding?: boolean;
110
+ }
111
+ export {};
@@ -0,0 +1,7 @@
1
+ import { TabGroupProps, TabProps } from './TabGroup.types';
2
+ export declare const getClassNameBySizeMap: ({ hideTopPadding, alignActiveBorderWithContainer, }: Pick<TabGroupProps, "hideTopPadding" | "alignActiveBorderWithContainer">) => Record<TabGroupProps["size"], {
3
+ tabClassName: string;
4
+ iconClassName: string;
5
+ badgeClassName: string;
6
+ }>;
7
+ export declare const getIconColorClassMap: ({ active }: Pick<TabProps, "active">) => Record<TabProps["iconType"], string>;
@@ -0,0 +1,2 @@
1
+ export * from './TabGroup.component';
2
+ export * from './TabGroup.types';
@@ -36,6 +36,7 @@ export * from './ShowMoreText';
36
36
  export * from './CollapsibleList';
37
37
  export * from './DeploymentConfigDiff';
38
38
  export * from './DetectBottom';
39
+ export * from './TabGroup';
39
40
  export * from './EditImageFormField';
40
41
  export * from './Collapse';
41
42
  export * from './FilterButton';
@@ -1,3 +1,5 @@
1
+ import { OptionType } from '../Common/Types';
2
+ import { CDMaterialSidebarType } from './types';
1
3
  export declare const ARTIFACT_STATUS: {
2
4
  PROGRESSING: string;
3
5
  DEGRADED: string;
@@ -401,4 +403,5 @@ export declare enum SelectAllGroupedResourceIdentifiers {
401
403
  allExistingAndFutureProdEnvironments = "-2",
402
404
  allExistingAndFutureEnvironments = "-3"
403
405
  }
406
+ export declare const CD_MATERIAL_SIDEBAR_TABS: OptionType<CDMaterialSidebarType, CDMaterialSidebarType>[];
404
407
  export declare const TRIGGER_STATUS_PROGRESSING: string[];
@@ -1,4 +1,5 @@
1
1
  import { OptionType, CommonNodeAttr, ResponseType, UserApprovalConfigType, VulnerabilityType, DeploymentAppTypes, ServerErrors, SortingParams } from '../Common';
2
+ import { KeyValueListType } from './Components';
2
3
  import { EnvironmentTypeEnum, PatchOperationType } from './constants';
3
4
  export declare enum EnvType {
4
5
  CHART = "helm_charts",
@@ -286,6 +287,10 @@ export declare enum CIMaterialSidebarType {
286
287
  CODE_SOURCE = "Code Source",
287
288
  PARAMETERS = "Parameters"
288
289
  }
290
+ export declare enum CDMaterialSidebarType {
291
+ IMAGE = "Image",
292
+ PARAMETERS = "Parameters"
293
+ }
289
294
  /**
290
295
  * @example Usage with specific enum for path & `unknown` type for value
291
296
  * ```ts
@@ -565,4 +570,12 @@ export type BaseFilterQueryParams<T> = {
565
570
  */
566
571
  showAll?: boolean;
567
572
  } & SortingParams<T>;
573
+ export type DataAttributes = Record<`data-${string}`, unknown>;
574
+ export interface RuntimeParamsListItemType extends KeyValueListType {
575
+ id: number;
576
+ }
577
+ export declare enum RuntimeParamsHeadingType {
578
+ KEY = "key",
579
+ VALUE = "value"
580
+ }
568
581
  export {};