@devtron-labs/devtron-fe-common-lib 0.5.0-beta-9 → 0.5.0-beta-10

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 (65) hide show
  1. package/dist/Common/Constants.d.ts +3 -1
  2. package/dist/Common/Types.d.ts +2 -6
  3. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/DTApplicationMetricsFormField.d.ts +3 -0
  4. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/constants.d.ts +2 -0
  5. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/index.d.ts +4 -0
  6. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/service.d.ts +4 -0
  7. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/types.d.ts +171 -0
  8. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/OverrideStrategyTippyContent.d.ts +2 -0
  9. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/constants.d.ts +5 -0
  10. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/index.d.ts +5 -0
  11. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/types.d.ts +27 -0
  12. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/utils.d.ts +2 -0
  13. package/dist/Pages/{CDPipeline → Applications/DevtronApps/Details/CDPipeline}/types.d.ts +4 -4
  14. package/dist/Pages/{App → Applications/DevtronApps/Details}/index.d.ts +1 -0
  15. package/dist/Pages/Applications/DevtronApps/index.d.ts +1 -0
  16. package/dist/Pages/Applications/index.d.ts +1 -0
  17. package/dist/Pages/index.d.ts +1 -2
  18. package/dist/Shared/Components/Button/Button.component.d.ts +1 -1
  19. package/dist/Shared/Components/Button/types.d.ts +6 -0
  20. package/dist/Shared/Components/CICDHistory/AppStatusDetailsChart.d.ts +1 -1
  21. package/dist/Shared/Components/CICDHistory/DeploymentHistoryDiff/DeploymentHistoryDiffView.d.ts +1 -1
  22. package/dist/Shared/Components/CICDHistory/StatusFilterButtonComponent.d.ts +1 -1
  23. package/dist/Shared/Components/CICDHistory/types.d.ts +4 -7
  24. package/dist/Shared/Components/CollapsibleList/CollapsibleList.component.d.ts +2 -2
  25. package/dist/Shared/Components/CollapsibleList/CollapsibleList.types.d.ts +14 -35
  26. package/dist/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.component.d.ts +1 -1
  27. package/dist/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.types.d.ts +6 -6
  28. package/dist/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiffNavigation.d.ts +1 -1
  29. package/dist/Shared/Components/InvalidYAMLTippy/InvalidYAMLTippyWrapper.d.ts +3 -0
  30. package/dist/Shared/Components/InvalidYAMLTippy/constants.d.ts +1 -0
  31. package/dist/Shared/Components/InvalidYAMLTippy/index.d.ts +2 -0
  32. package/dist/Shared/Components/InvalidYAMLTippy/types.d.ts +6 -0
  33. package/dist/Shared/Components/InvalidYAMLTippy/utils.d.ts +2 -0
  34. package/dist/Shared/Components/SelectPicker/constants.d.ts +5 -0
  35. package/dist/Shared/Components/SelectPicker/type.d.ts +2 -2
  36. package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +9 -1
  37. package/dist/Shared/Components/index.d.ts +1 -0
  38. package/dist/Shared/Hooks/useForm/useForm.d.ts +29 -26
  39. package/dist/Shared/Hooks/useForm/useForm.types.d.ts +15 -8
  40. package/dist/Shared/Hooks/useForm/useForm.utils.d.ts +1 -1
  41. package/dist/Shared/Services/app.types.d.ts +35 -22
  42. package/dist/Shared/constants.d.ts +3 -1
  43. package/dist/Shared/types.d.ts +12 -1
  44. package/dist/assets/index.css +1 -1
  45. package/dist/{cssMode-BhUcblV3.js → cssMode-CF5oEoSx.js} +1 -1
  46. package/dist/{freemarker2-Cz9j4LM-.js → freemarker2-D5f9Brqi.js} +1 -1
  47. package/dist/{handlebars-CnEwOfUD.js → handlebars-DmztQ6uh.js} +1 -1
  48. package/dist/{html-C4c0kwtM.js → html-BkNwpbVt.js} +1 -1
  49. package/dist/{htmlMode-BE-O4MZ9.js → htmlMode-BMGB0WxP.js} +1 -1
  50. package/dist/{index-C8gCqDz-.js → index-Z6dDBXQx.js} +23613 -23493
  51. package/dist/index.js +538 -519
  52. package/dist/{javascript-Bze6GaRd.js → javascript-BbBjreqf.js} +1 -1
  53. package/dist/{jsonMode-euZ6gVcq.js → jsonMode-D3xZcCST.js} +1 -1
  54. package/dist/{liquid-CiWYWKGZ.js → liquid-BIunNzMy.js} +1 -1
  55. package/dist/{mdx-Cg0mMyWJ.js → mdx-BGyn0vGx.js} +1 -1
  56. package/dist/{python-CQfygZrL.js → python-CYlE4dm9.js} +1 -1
  57. package/dist/{razor-a8zEbLwR.js → razor-CLUfULMH.js} +1 -1
  58. package/dist/{tsMode-B_DEfseq.js → tsMode-C53f9ZkL.js} +1 -1
  59. package/dist/{typescript-DaKMt18y.js → typescript-D9WYQDuI.js} +1 -1
  60. package/dist/{xml-LXTt4QtJ.js → xml-BhdzokqI.js} +1 -1
  61. package/dist/{yaml-jev_LNsL.js → yaml-BPAPwIde.js} +1 -1
  62. package/package.json +2 -1
  63. package/dist/Pages/App/AppConfigurations/index.d.ts +0 -1
  64. package/dist/Pages/App/AppConfigurations/utils.d.ts +0 -2
  65. /package/dist/Pages/{CDPipeline → Applications/DevtronApps/Details/CDPipeline}/index.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { ChangeEvent, FormEvent } from 'react';
2
- import { UseFormSubmitHandler, UseFormValidations } from './useForm.types';
1
+ import { BaseSyntheticEvent, ChangeEvent } from 'react';
2
+ import { UseFormSubmitHandler, UseFormValidations, UseFormErrorHandler } from './useForm.types';
3
3
  /**
4
4
  * A custom hook to manage form state, validation, and submission handling.
5
5
  *
@@ -16,20 +16,19 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
16
16
  * - 'onBlur': Validation occurs when the input loses focus.
17
17
  * @default 'onChange'
18
18
  */
19
- validationMode?: "onChange" | "onBlur";
19
+ validationMode?: "onChange" | "onBlur" | "onSubmit";
20
20
  }) => {
21
21
  /** The current form data. */
22
22
  data: T;
23
23
  /** An object containing validation errors for each form field. */
24
- errors: Partial<Record<keyof T, string | string[]>>;
25
- /**
26
- * Registers form input fields with onChange, onBlur and onFocus handlers.
27
- *
28
- * @param name - The key of the form field to register.
29
- * @param sanitizeFn - An optional function to sanitize the input value.
30
- * @returns An object containing form field `name`, `onChange`, `onBlur` and `onFocus` event handlers.
31
- */
32
- register: <V extends unknown = string, S extends unknown = unknown>(name: keyof T, sanitizeFn?: (value: V) => S, registerOptions?: {
24
+ errors: Partial<Record<keyof T, string[]>>;
25
+ register: <Value extends unknown, SFnReturnType extends unknown, CustomComponent extends boolean>(name: keyof T, registerOptions?: {
26
+ /**
27
+ * A function to sanitize the input value.
28
+ * @param value The input value.
29
+ * @returns The sanitized value.
30
+ */
31
+ sanitizeFn?: (value: CustomComponent extends true ? Value : string) => SFnReturnType;
33
32
  /**
34
33
  * Prevents the input value from being trimmed.
35
34
  *
@@ -39,26 +38,30 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
39
38
  * @default false - By default, the input will be trimmed.
40
39
  */
41
40
  noTrim?: boolean;
41
+ /** A boolean flag indicating if the input is a custom component. */
42
+ isCustomComponent?: CustomComponent;
42
43
  }) => {
43
- onChange: (e: ChangeEvent<HTMLInputElement>) => void;
44
+ onChange: (e: CustomComponent extends true ? Value : ChangeEvent<HTMLInputElement>) => void;
44
45
  onBlur: () => void;
45
46
  onFocus: () => void;
46
47
  name: keyof T;
47
48
  };
48
- /**
49
- * Handles form submission, validates all form fields, and calls the provided `onValid` function if valid.
50
- *
51
- * @param onValid - A function to handle valid form data on submission.
52
- * @returns The event handler for form submission.
53
- */
54
- handleSubmit: (onValid: UseFormSubmitHandler<T>) => (e: FormEvent<HTMLFormElement>) => void;
55
- /**
56
- * Manually triggers validation for specific form fields.
57
- *
58
- * @param name - The key(s) of the form field(s) to validate.
59
- * @returns The validation error(s), if any.
60
- */
49
+ handleSubmit: (onValid: UseFormSubmitHandler<T>, onError?: UseFormErrorHandler<T>) => (e?: BaseSyntheticEvent) => Promise<void>;
61
50
  trigger: (name: keyof T | (keyof T)[]) => (string | string[]) | (string | string[])[];
51
+ setValue: (name: keyof T, value: T[keyof T], valueOptions?: {
52
+ /** A boolean indicating whether to mark the field as dirty after setting the value. */
53
+ shouldDirty?: boolean;
54
+ /** A boolean indicating whether to mark the field as touched after setting the value. */
55
+ shouldTouch?: boolean;
56
+ }) => void;
57
+ reset: (formData: T, resetOptions?: {
58
+ /** A boolean indicating whether to retain the current dirty state of the form fields. */
59
+ keepDirty?: boolean;
60
+ /** A boolean indicating whether to retain the current touched state of the form fields. */
61
+ keepTouched?: boolean;
62
+ /** A boolean indicating whether to retain the current error state of the form fields. */
63
+ keepErrors?: boolean;
64
+ }) => void;
62
65
  /** An object representing additional form state. */
63
66
  formState: {
64
67
  /** An object indicating which fields have been touched (interacted with). */
@@ -1,4 +1,4 @@
1
- import { FormEvent } from 'react';
1
+ import { BaseSyntheticEvent } from 'react';
2
2
  /**
3
3
  * Describes the "required" validation rule.
4
4
  * It can be a simple boolean or an object containing a boolean value and an error message.
@@ -24,10 +24,10 @@ type ValidationPattern = {
24
24
  * If validation fails, an error message is provided.
25
25
  */
26
26
  type ValidationCustom = {
27
- isValid: (value: string) => boolean;
27
+ isValid: (value: any) => boolean;
28
28
  message: string;
29
29
  } | {
30
- isValid: (value: string) => boolean;
30
+ isValid: (value: any) => boolean;
31
31
  message: string;
32
32
  }[];
33
33
  /**
@@ -41,9 +41,9 @@ export interface UseFormValidation {
41
41
  }
42
42
  /**
43
43
  * Represents the structure for form validation errors.
44
- * Maps each field to an error message or an array of error messages.
44
+ * Maps each field to an array of error messages.
45
45
  */
46
- export type UseFormErrors<T> = Partial<Record<keyof T, string | string[]>>;
46
+ export type UseFormErrors<T> = Partial<Record<keyof T, string[]>>;
47
47
  /**
48
48
  * Represents the fields that have been modified ("dirty") in the form.
49
49
  * Maps each field to a boolean value indicating whether it has been changed.
@@ -58,12 +58,19 @@ export type TouchedFields<T> = Partial<Record<keyof T, boolean>>;
58
58
  * Defines the structure for form validations.
59
59
  * Maps each form field to its corresponding validation rules.
60
60
  */
61
- export type UseFormValidations<T extends {}> = Partial<Record<keyof T, UseFormValidation>>;
61
+ export type UseFormValidations<T extends {}> = ((formData: T) => Partial<Record<keyof T, UseFormValidation>>) | Partial<Record<keyof T, UseFormValidation>>;
62
62
  /**
63
63
  * Describes the function signature for handling form submission.
64
64
  *
65
65
  * @param data - The form data collected during submission.
66
- * @param e - The form event, optionally passed when the form is submitted.
66
+ * @param e - The event, optionally passed when `handleSubmit` is called.
67
67
  */
68
- export type UseFormSubmitHandler<T extends {}> = (data: T, e?: FormEvent<HTMLFormElement>) => void;
68
+ export type UseFormSubmitHandler<T extends {}> = (data: T, e?: BaseSyntheticEvent) => void;
69
+ /**
70
+ * A type defining the function signature for handling form validation errors.
71
+ *
72
+ * @param errors - An object containing the validation errors for form fields.
73
+ * @param e - The event, optionally passed when `handleSubmit` is called.
74
+ */
75
+ export type UseFormErrorHandler<T extends {}> = (errors: UseFormErrors<T>, e?: BaseSyntheticEvent) => void;
69
76
  export {};
@@ -7,4 +7,4 @@ import { UseFormValidation } from './useForm.types';
7
7
  * @param validation - The validation rules for the form field.
8
8
  * @returns Returns error message(s) or null if valid.
9
9
  */
10
- export declare const checkValidation: <T extends Record<keyof T, any> = {}>(value: T[keyof T], validation: UseFormValidation) => string | string[] | null;
10
+ export declare const checkValidation: <T extends Record<keyof T, any> = {}>(value: T[keyof T], validation: UseFormValidation) => string[] | null;
@@ -99,12 +99,23 @@ export declare enum AppEnvDeploymentConfigType {
99
99
  PREVIOUS_DEPLOYMENTS = "PreviousDeployments",
100
100
  DEFAULT_VERSION = "DefaultVersion"
101
101
  }
102
+ export declare enum DraftState {
103
+ Init = 1,
104
+ Discarded = 2,
105
+ Published = 3,
106
+ AwaitApproval = 4
107
+ }
108
+ export declare enum DraftAction {
109
+ Add = 1,
110
+ Update = 2,
111
+ Delete = 3
112
+ }
102
113
  export interface DraftMetadataDTO {
103
114
  appId: number;
104
115
  envId: number;
105
116
  resource: number;
106
117
  resourceName: string;
107
- action: number;
118
+ action: DraftAction;
108
119
  data: string;
109
120
  userComment: string;
110
121
  changeProposed: boolean;
@@ -113,31 +124,44 @@ export interface DraftMetadataDTO {
113
124
  };
114
125
  draftId: number;
115
126
  draftVersionId: number;
116
- draftState: number;
127
+ draftState: DraftState;
117
128
  approvers: string[];
118
129
  canApprove: boolean;
119
130
  commentsCount: number;
120
131
  dataEncrypted: boolean;
121
132
  isAppAdmin: boolean;
122
133
  }
134
+ export declare enum CMSecretExternalType {
135
+ Internal = "",
136
+ KubernetesConfigMap = "KubernetesConfigMap",
137
+ KubernetesSecret = "KubernetesSecret",
138
+ AWSSecretsManager = "AWSSecretsManager",
139
+ AWSSystemManager = "AWSSystemManager",
140
+ HashiCorpVault = "HashiCorpVault",
141
+ ESO_GoogleSecretsManager = "ESO_GoogleSecretsManager",
142
+ ESO_AWSSecretsManager = "ESO_AWSSecretsManager",
143
+ ESO_AzureSecretsManager = "ESO_AzureSecretsManager",
144
+ ESO_HashiCorpVault = "ESO_HashiCorpVault"
145
+ }
123
146
  export interface ConfigDatum {
124
147
  name: string;
125
148
  type: string;
126
149
  external: boolean;
127
- data: Record<string, string>;
128
- defaultData: Record<string, string>;
150
+ data: Record<string, any>;
151
+ defaultData: Record<string, any>;
129
152
  global: boolean;
130
- externalType: string;
131
- esoSecretData: {};
132
- defaultESOSecretData: {};
133
- secretData: Record<string, string>;
134
- defaultSecretData: Record<string, string>;
153
+ externalType: CMSecretExternalType;
154
+ esoSecretData: Record<string, any>;
155
+ defaultESOSecretData: Record<string, any>;
156
+ secretData: Record<string, any>[];
157
+ defaultSecretData: Record<string, any>[];
135
158
  roleARN: string;
136
159
  subPath: boolean;
137
160
  filePermission: string;
138
161
  overridden: boolean;
139
- mountPath?: string;
140
- defaultMountPath?: string;
162
+ mountPath: string;
163
+ defaultMountPath: string;
164
+ esoSubPath: string[];
141
165
  }
142
166
  export interface ConfigMapSecretDataConfigDatumDTO extends ConfigDatum {
143
167
  draftMetadata: DraftMetadataDTO;
@@ -197,17 +221,6 @@ export interface TemplateListDTO {
197
221
  status?: string;
198
222
  pipelineId?: number;
199
223
  }
200
- export interface ManifestTemplateDTO {
201
- data: string;
202
- resolvedData: string;
203
- variableSnapshot: null;
204
- }
205
- export declare enum DraftState {
206
- Init = 1,
207
- Discarded = 2,
208
- Published = 3,
209
- AwaitApproval = 4
210
- }
211
224
  export declare enum EnvResourceType {
212
225
  ConfigMap = "configmap",
213
226
  Secret = "secrets",
@@ -1,5 +1,5 @@
1
1
  import { OptionType } from '../Common/Types';
2
- import { CDMaterialSidebarType } from './types';
2
+ import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType } from './types';
3
3
  export declare const ARTIFACT_STATUS: {
4
4
  PROGRESSING: string;
5
5
  DEGRADED: string;
@@ -411,3 +411,5 @@ export declare enum SelectAllGroupedResourceIdentifiers {
411
411
  }
412
412
  export declare const CD_MATERIAL_SIDEBAR_TABS: OptionType<CDMaterialSidebarType, CDMaterialSidebarType>[];
413
413
  export declare const TRIGGER_STATUS_PROGRESSING: string[];
414
+ export declare const CONFIGURATION_TYPE_VALUES: ConfigurationType[];
415
+ export declare const DEFAULT_LOCKED_KEYS_CONFIG: Readonly<ConfigKeysWithLockType>;
@@ -104,7 +104,6 @@ export interface Node {
104
104
  port: number;
105
105
  canBeHibernated: boolean;
106
106
  isHibernated: boolean;
107
- hasDrift?: boolean;
108
107
  }
109
108
  export interface iNodes extends Array<iNode> {
110
109
  }
@@ -573,6 +572,18 @@ export type BaseFilterQueryParams<T> = {
573
572
  */
574
573
  showAll?: boolean;
575
574
  } & SortingParams<T>;
575
+ export declare enum ConfigurationType {
576
+ GUI = "GUI",
577
+ YAML = "YAML"
578
+ }
579
+ export interface BaseURLParams {
580
+ appId: string;
581
+ envId: string;
582
+ }
583
+ export interface ConfigKeysWithLockType {
584
+ config: string[];
585
+ allowed: boolean;
586
+ }
576
587
  export type DataAttributes = Record<`data-${string}`, unknown>;
577
588
  export interface RuntimeParamsListItemType extends KeyValueListType {
578
589
  id: number;