@devtron-labs/devtron-fe-common-lib 1.1.2 → 1.1.3-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 (48) hide show
  1. package/dist/Common/CodeEditor/CodeEditor.reducer.d.ts +2 -1
  2. package/dist/Common/CodeEditor/types.d.ts +2 -1
  3. package/dist/Common/Constants.d.ts +2 -0
  4. package/dist/Common/Hooks/UseRegisterShortcut/utils.d.ts +1 -1
  5. package/dist/Common/RJSF/Form.d.ts +1 -1
  6. package/dist/Common/RJSF/index.d.ts +1 -1
  7. package/dist/Pages/App/AppConfiguration/DeploymentTemplate/GUIView/index.d.ts +2 -0
  8. package/dist/Pages/App/AppConfiguration/DeploymentTemplate/GUIView/types.d.ts +2 -0
  9. package/dist/Pages/App/AppConfiguration/DeploymentTemplate/GUIView/utils.d.ts +6 -0
  10. package/dist/Pages/App/AppConfiguration/DeploymentTemplate/index.d.ts +1 -0
  11. package/dist/Pages/App/AppConfiguration/index.d.ts +1 -0
  12. package/dist/Pages/App/index.d.ts +1 -0
  13. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/types.d.ts +21 -3
  14. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/OverrideStrategyTippyContent.d.ts +2 -1
  15. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/types.d.ts +6 -0
  16. package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/utils.d.ts +1 -1
  17. package/dist/Pages/index.d.ts +1 -0
  18. package/dist/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.utils.d.ts +2 -0
  19. package/dist/Shared/Components/DiffViewer/DiffViewer.component.d.ts +41 -0
  20. package/dist/Shared/Components/DiffViewer/constants.d.ts +2 -0
  21. package/dist/Shared/Components/DiffViewer/index.d.ts +1 -0
  22. package/dist/Shared/Components/DiffViewer/types.d.ts +9 -0
  23. package/dist/Shared/Components/EnterpriseTag/EnterpriseTag.component.d.ts +2 -0
  24. package/dist/Shared/Components/EnterpriseTag/index.d.ts +1 -0
  25. package/dist/Shared/Components/index.d.ts +2 -0
  26. package/dist/Shared/Helpers.d.ts +5 -3
  27. package/dist/Shared/Hooks/useForm/useForm.d.ts +1 -0
  28. package/dist/Shared/Services/app.types.d.ts +3 -0
  29. package/dist/assets/index.css +1 -1
  30. package/dist/{cssMode-CCpgJmm6.js → cssMode-CMaMwk19.js} +1 -1
  31. package/dist/{freemarker2-D_mLuq_o.js → freemarker2-CLqyLn9v.js} +1 -1
  32. package/dist/{handlebars-BD_HtwVy.js → handlebars-BRD1MBC4.js} +1 -1
  33. package/dist/{html-BeeVuZIO.js → html-DACNVWi2.js} +1 -1
  34. package/dist/{htmlMode-kvzZiaeI.js → htmlMode-DOkUWxl6.js} +1 -1
  35. package/dist/{index-BvizpREI.js → index-B0R-eIqT.js} +34719 -32662
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +526 -520
  38. package/dist/{javascript-D4XskaU5.js → javascript-CcPM8gMo.js} +1 -1
  39. package/dist/{jsonMode-B2_O6NDq.js → jsonMode-CcN4cBks.js} +1 -1
  40. package/dist/{liquid-QZD4YWY_.js → liquid-ByxkY-P3.js} +1 -1
  41. package/dist/{mdx-HhIdU7FZ.js → mdx-CB1YZfsJ.js} +1 -1
  42. package/dist/{python-DKTQetrv.js → python-DtLslx5t.js} +1 -1
  43. package/dist/{razor-tzGshwh5.js → razor-BpWch-b7.js} +1 -1
  44. package/dist/{tsMode-BQz40E1q.js → tsMode-CX3PjebE.js} +1 -1
  45. package/dist/{typescript-bBWDHdq_.js → typescript-CYUmpyQQ.js} +1 -1
  46. package/dist/{xml-DJANGkSQ.js → xml-DoPkFoDS.js} +1 -1
  47. package/dist/{yaml-7Qu-laLa.js → yaml-ps_8KiyV.js} +1 -1
  48. package/package.json +2 -1
@@ -32,4 +32,5 @@ export declare const CodeEditorReducer: (state: CodeEditorState, action: Action)
32
32
  code: string;
33
33
  noParsing: boolean;
34
34
  };
35
- export declare const initialState: ({ mode, theme, value, diffView, noParsing, }: CodeEditorInitialValueType) => CodeEditorState;
35
+ export declare const parseValueToCode: (value: string, mode: string, tabSize: number) => string;
36
+ export declare const initialState: ({ mode, theme, value, diffView, noParsing, tabSize, }: CodeEditorInitialValueType) => CodeEditorState;
@@ -28,7 +28,7 @@ interface CodeEditorBaseInterface {
28
28
  validatorSchema?: any;
29
29
  isKubernetes?: boolean;
30
30
  cleanData?: boolean;
31
- chartVersion?: any;
31
+ schemaURI?: string;
32
32
  /**
33
33
  * If true, disable the in-built search of monaco editor
34
34
  * @default false
@@ -81,6 +81,7 @@ export interface CodeEditorInitialValueType {
81
81
  theme?: string;
82
82
  value: string;
83
83
  noParsing?: boolean;
84
+ tabSize: number;
84
85
  }
85
86
  export interface CodeEditorState {
86
87
  mode: MODES;
@@ -4,6 +4,7 @@ export declare const Host: string;
4
4
  export declare const DOCUMENTATION_HOME_PAGE = "https://docs.devtron.ai";
5
5
  export declare const DOCUMENTATION_VERSION = "/v/v0.7";
6
6
  export declare const DISCORD_LINK = "https://discord.devtron.ai/";
7
+ export declare const DEFAULT_JSON_SCHEMA_URI = "https://json-schema.org/draft/2020-12/schema";
7
8
  export declare const DOCUMENTATION: {
8
9
  APP_METRICS: string;
9
10
  APP_TAGS: string;
@@ -257,6 +258,7 @@ export declare const API_STATUS_CODES: {
257
258
  EXPECTATION_FAILED: number;
258
259
  UNPROCESSABLE_ENTITY: number;
259
260
  LOCKED: number;
261
+ UNPROCESSABLE_CONTENT: number;
260
262
  };
261
263
  export declare enum SERVER_MODE {
262
264
  EA_ONLY = "EA_ONLY",
@@ -1,6 +1,6 @@
1
1
  import { ShortcutType } from './types';
2
2
  export declare const preprocessKeys: (keys: ShortcutType["keys"]) => {
3
- keys: ("Control" | "Alt" | "Escape" | "F" | "E" | "R" | "K" | "Shift" | "Meta")[];
3
+ keys: ("Alt" | "Escape" | "F" | "E" | "R" | "K" | "Control" | "Shift" | "Meta")[];
4
4
  id: string;
5
5
  };
6
6
  export declare const verifyCallbackStack: (stack: ShortcutType["callbackStack"]) => void;
@@ -1,3 +1,3 @@
1
1
  import { default as RJSF } from '@rjsf/core';
2
2
  import { FormProps } from './types';
3
- export declare const RJSFForm: import('react').ForwardRefExoticComponent<Pick<FormProps, "children" | "className" | "id" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "onError" | "action" | "name" | "disabled" | "target" | "tagName" | "autoComplete" | "noValidate" | "readonly" | "schema" | "uiSchema" | "formContext" | "formData" | "idPrefix" | "idSeparator" | "fields" | "templates" | "widgets" | "translateString" | "acceptcharset" | "acceptCharset" | "enctype" | "method" | "customValidate" | "extraErrors" | "extraErrorsBlockSubmit" | "noHtml5Validate" | "liveValidate" | "liveOmit" | "omitExtraData" | "showErrorList" | "transformErrors" | "focusOnFirstError" | "experimental_defaultFormStateBehavior" | "_internalFormWrapper"> & import('react').RefAttributes<RJSF<unknown, import('json-schema').JSONSchema7, import('@rjsf/utils').GenericObjectType>>>;
3
+ export declare const RJSFForm: import('react').ForwardRefExoticComponent<Pick<FormProps, "name" | "children" | "className" | "disabled" | "id" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "onError" | "target" | "action" | "tagName" | "autoComplete" | "noValidate" | "readonly" | "schema" | "uiSchema" | "formContext" | "formData" | "idPrefix" | "idSeparator" | "fields" | "templates" | "widgets" | "translateString" | "acceptcharset" | "acceptCharset" | "enctype" | "method" | "customValidate" | "extraErrors" | "extraErrorsBlockSubmit" | "noHtml5Validate" | "liveValidate" | "liveOmit" | "omitExtraData" | "showErrorList" | "transformErrors" | "focusOnFirstError" | "experimental_defaultFormStateBehavior" | "_internalFormWrapper"> & import('react').RefAttributes<RJSF<unknown, import('json-schema').JSONSchema7, import('@rjsf/utils').GenericObjectType>>>;
@@ -1,4 +1,4 @@
1
1
  export { RJSFForm } from './Form';
2
- export * from './types';
2
+ export type * from './types';
3
3
  export { getInferredTypeFromValueType, getRedirectionProps } from './utils';
4
4
  export { HIDE_SUBMIT_BUTTON_UI_SCHEMA } from './constants';
@@ -0,0 +1,2 @@
1
+ export { ViewError as GUIViewError } from './utils';
2
+ export type { ViewErrorType as GUIViewErrorType } from './types';
@@ -0,0 +1,2 @@
1
+ export interface ViewErrorType extends Record<'title' | 'subTitle', string> {
2
+ }
@@ -0,0 +1,6 @@
1
+ import { ViewErrorType } from './types';
2
+ export declare class ViewError implements ViewErrorType {
3
+ title: string;
4
+ subTitle: string;
5
+ constructor(title: string, subTitle: string);
6
+ }
@@ -0,0 +1 @@
1
+ export * from './GUIView';
@@ -0,0 +1 @@
1
+ export * from './DeploymentTemplate';
@@ -0,0 +1 @@
1
+ export * from './AppConfiguration';
@@ -1,4 +1,5 @@
1
1
  import { DraftMetadataDTO, TemplateListType } from '../../../../../../Shared/Services';
2
+ import { ServerErrors } from '../../../../../../Common/ServerError';
2
3
  import { OverrideMergeStrategyType } from '../types';
3
4
  export type DeploymentChartOptionkind = 'base' | 'env' | 'chartVersion' | 'deployment';
4
5
  export interface DeploymentChartVersionType {
@@ -108,15 +109,15 @@ interface BaseDeploymentTemplateConfigState {
108
109
  environmentConfig?: never;
109
110
  mergeStrategy?: never;
110
111
  }
111
- interface EnvironmentOverrideDeploymentTemplateConfigState {
112
+ type EnvironmentOverrideDeploymentTemplateConfigState = {
112
113
  chartConfig?: never;
113
114
  isOverridden: boolean;
114
115
  environmentConfig: EnvironmentConfigType;
115
116
  mergeStrategy: OverrideMergeStrategyType;
116
- }
117
+ };
117
118
  export interface DeploymentTemplateConfigCommonState extends SelectedChartDetailsType {
118
119
  /**
119
- * The first ever state of the deployment template
120
+ * The first ever state of the deployment template on editor
120
121
  */
121
122
  originalTemplate: Record<string, string>;
122
123
  isAppMetricsEnabled: boolean;
@@ -126,6 +127,23 @@ export interface DeploymentTemplateConfigCommonState extends SelectedChartDetail
126
127
  latestDraft?: DraftMetadataDTO;
127
128
  editorTemplate: string;
128
129
  editorTemplateWithoutLockedKeys: string;
130
+ /**
131
+ * This final template to be applied on the deployment in string format
132
+ * In current editor, this may be null initially
133
+ */
134
+ mergedTemplate: string | null;
135
+ /**
136
+ * This final template to be applied on the deployment without locked keys in string format
137
+ * In current editor, this may be null initially
138
+ */
139
+ mergedTemplateWithoutLockedKeys: string | null;
140
+ /**
141
+ * This final template to be applied on the deployment in object format
142
+ * In current editor, this may be null initially
143
+ */
144
+ mergedTemplateObject: Record<string, string> | null;
145
+ isLoadingMergedTemplate: boolean;
146
+ mergedTemplateError: ServerErrors | null;
129
147
  }
130
148
  export type DeploymentTemplateConfigState = DeploymentTemplateConfigCommonState & (BaseDeploymentTemplateConfigState | EnvironmentOverrideDeploymentTemplateConfigState);
131
149
  type DTApplicationMetricsReadOnlyProps = {
@@ -1,2 +1,3 @@
1
- declare const OverrideStrategyTippyContent: () => JSX.Element;
1
+ import { OverrideStrategyTippyContentProps } from './types';
2
+ declare const OverrideStrategyTippyContent: ({ children }: OverrideStrategyTippyContentProps) => JSX.Element;
2
3
  export default OverrideStrategyTippyContent;
@@ -25,3 +25,9 @@ export declare enum ConfigToolbarPopupNodeType {
25
25
  DISCARD_DRAFT = "discardDraft",
26
26
  EDIT_HISTORY = "editHistory"
27
27
  }
28
+ export interface OverrideStrategyTippyContentProps {
29
+ /**
30
+ * Would be rendered as li conveying the information about the merge strategy
31
+ */
32
+ children?: ReactNode;
33
+ }
@@ -1,2 +1,2 @@
1
1
  import { DeploymentStageType } from '../../../../../Shared/constants';
2
- export declare const getDeploymentStageTitle: (stage: DeploymentStageType) => "deployment" | "pre-deployment" | "post-deployment" | "-";
2
+ export declare const getDeploymentStageTitle: (stage: DeploymentStageType) => "-" | "pre-deployment" | "post-deployment" | "deployment";
@@ -1,3 +1,4 @@
1
1
  export * from './GlobalConfigurations';
2
2
  export * from './ResourceBrowser';
3
3
  export * from './Applications';
4
+ export * from './App';
@@ -1,5 +1,6 @@
1
1
  import { DeploymentConfigDiffProps, AppEnvDeploymentConfigListParams } from '..';
2
2
  import { ConfigMapSecretDataConfigDatumDTO, DeploymentTemplateDTO, TemplateListDTO } from '../../Services/app.types';
3
+ import { DiffViewerProps } from '../DiffViewer/types';
3
4
  export declare const getDeploymentTemplateData: (data: DeploymentTemplateDTO) => any;
4
5
  /**
5
6
  * Retrieves the draft data from the given configuration data object.
@@ -37,3 +38,4 @@ export declare const getDefaultVersionAndPreviousDeploymentOptions: (data: Templ
37
38
  previousDeployments: TemplateListDTO[];
38
39
  defaultVersions: TemplateListDTO[];
39
40
  };
41
+ export declare const renderDiffViewNoDifferenceState: (lhsValue: string, rhsValue: string) => DiffViewerProps["codeFoldMessageRenderer"];
@@ -0,0 +1,41 @@
1
+ import { DiffViewerProps } from './types';
2
+ /**
3
+ * Component for showing diff between two string or object.
4
+ *
5
+ * Note: Pass down the object as stringified for optimized performance.
6
+ *
7
+ * @example Usage
8
+ *
9
+ * ```tsx
10
+ * <DiffViewer
11
+ * oldValue={oldValue}
12
+ * newValue={newValue}
13
+ * />
14
+ * ```
15
+ *
16
+ * @example With left/right title for lhs/rhs
17
+ *
18
+ * ```tsx
19
+ * <DiffViewer
20
+ * oldValue={oldValue}
21
+ * newValue={newValue}
22
+ * leftTitle="Title for LHS"
23
+ * rightTitle={
24
+ * <span>Title for RHS</span>
25
+ * }
26
+ * />
27
+ * ```
28
+ *
29
+ * @example With custom message for folded code
30
+ * Note: the entire section would be clickable
31
+ *
32
+ * ```tsx
33
+ * <DiffViewer
34
+ * oldValue={oldValue}
35
+ * newValue={newValue}
36
+ * codeFoldMessageRenderer={(totalFoldedLines, leftStartLineNumber, rightStartLineNumber) => <span>Custom text</span>}
37
+ * />
38
+ * ```
39
+ */
40
+ declare const DiffViewer: ({ oldValue, newValue, leftTitle, rightTitle, ...props }: DiffViewerProps) => JSX.Element;
41
+ export default DiffViewer;
@@ -0,0 +1,2 @@
1
+ import { ReactDiffViewerProps } from 'react-diff-viewer-continued';
2
+ export declare const diffViewerStyles: ReactDiffViewerProps['styles'];
@@ -0,0 +1 @@
1
+ export { default as DiffViewer } from './DiffViewer.component';
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { ReactDiffViewerProps } from 'react-diff-viewer-continued';
3
+ export interface DiffViewerProps extends Pick<ReactDiffViewerProps, 'oldValue' | 'newValue' | 'codeFoldMessageRenderer'> {
4
+ leftTitle?: ReactDiffViewerProps['leftTitle'] | ReactNode;
5
+ rightTitle?: ReactDiffViewerProps['rightTitle'] | ReactNode;
6
+ }
7
+ export interface DiffViewTitleWrapperProps {
8
+ title: DiffViewerProps['leftTitle'];
9
+ }
@@ -0,0 +1,2 @@
1
+ declare const EnterpriseTag: () => JSX.Element;
2
+ export default EnterpriseTag;
@@ -0,0 +1 @@
1
+ export { default as EnterpriseTag } from './EnterpriseTag.component';
@@ -41,3 +41,5 @@ export * from './Collapse';
41
41
  export * from './Security';
42
42
  export * from './Button';
43
43
  export * from './InvalidYAMLTippy';
44
+ export * from './EnterpriseTag';
45
+ export * from './DiffViewer';
@@ -1,5 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { Pair } from 'yaml';
3
+ import { StrictRJSFSchema } from '@rjsf/utils';
3
4
  import { MaterialHistoryType } from '@Shared/Services/app.types';
4
5
  import { MaterialInfo, SortingOrder, UserApprovalConfigType } from '../Common';
5
6
  import { GitTriggers, IntersectionChangeHandler, IntersectionOptions, WebhookEventNameType } from './types';
@@ -65,10 +66,11 @@ export declare const getDefaultValueFromType: (value: unknown) => {};
65
66
  */
66
67
  export declare const groupArrayByObjectKey: <T extends Record<string, any>, K extends keyof T>(array: T[], key: K) => Record<string, T[]>;
67
68
  /**
68
- * @description - Function to get the lower case object
69
- * @param input - The input object
70
- * @returns Record<string, any>
69
+ * This function returns a null/zero value corresponding to @type
70
+ *
71
+ * @param type - a RJSF supported type
71
72
  */
73
+ export declare const getNullValueFromType: (type: StrictRJSFSchema["type"]) => any;
72
74
  export declare const getLowerCaseObject: (input: any) => Record<string, any>;
73
75
  /**
74
76
  * @description - Function to get the webhook date
@@ -61,6 +61,7 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
61
61
  keepTouched?: boolean;
62
62
  /** A boolean indicating whether to retain the current error state of the form fields. */
63
63
  keepErrors?: boolean;
64
+ triggerDirty?: boolean;
64
65
  }) => void;
65
66
  /** An object representing additional form state. */
66
67
  formState: {
@@ -1,3 +1,4 @@
1
+ import { OverrideMergeStrategyType } from '../../Pages/Applications';
1
2
  import { ReleaseTag } from '../../Common';
2
3
  interface WebhookDataType {
3
4
  id: number;
@@ -147,9 +148,11 @@ export declare enum CMSecretExternalType {
147
148
  }
148
149
  export interface ConfigDatum {
149
150
  name: string;
151
+ mergeStrategy: OverrideMergeStrategyType;
150
152
  type: string;
151
153
  external: boolean;
152
154
  data: Record<string, any>;
155
+ patchData: Record<string, any>;
153
156
  defaultData: Record<string, any>;
154
157
  global: boolean;
155
158
  externalType: CMSecretExternalType;