@devtron-labs/devtron-fe-common-lib 0.3.3-beta-3 → 0.3.3-beta-6

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 (64) hide show
  1. package/dist/Common/Constants.d.ts +0 -2
  2. package/dist/Common/Helper.d.ts +0 -6
  3. package/dist/Common/Security/ScanVulnerabilitiesTable.d.ts +2 -0
  4. package/dist/Common/Security/types.d.ts +4 -0
  5. package/dist/Common/index.d.ts +1 -0
  6. package/dist/Shared/Components/ImageCardAccordion/ImageCardAccordion.d.ts +1 -1
  7. package/dist/Shared/Components/ImageCardAccordion/types.d.ts +0 -1
  8. package/dist/Shared/Components/{Security/Vulnerabilities → Vulnerabilities}/Vulnerabilities.d.ts +1 -1
  9. package/dist/Shared/Components/Vulnerabilities/constants.d.ts +4 -0
  10. package/dist/Shared/Components/{Security/Vulnerabilities → Vulnerabilities}/index.d.ts +0 -1
  11. package/dist/Shared/Components/{Security/Vulnerabilities → Vulnerabilities}/service.d.ts +1 -1
  12. package/dist/Shared/Components/{Security/Vulnerabilities → Vulnerabilities}/types.d.ts +1 -2
  13. package/dist/Shared/Components/{Security/Vulnerabilities → Vulnerabilities}/utils.d.ts +1 -1
  14. package/dist/Shared/Components/index.d.ts +1 -1
  15. package/dist/Shared/Hooks/index.d.ts +1 -0
  16. package/dist/Shared/Hooks/useForm/index.d.ts +2 -0
  17. package/dist/Shared/Hooks/useForm/useForm.d.ts +29 -0
  18. package/dist/Shared/Hooks/useForm/useForm.types.d.ts +30 -0
  19. package/dist/Shared/Hooks/useForm/useForm.utils.d.ts +10 -0
  20. package/dist/Shared/constants.d.ts +0 -4
  21. package/dist/Shared/types.d.ts +0 -1
  22. package/dist/assets/index.css +1 -1
  23. package/dist/{cssMode-CKXudWDB.js → cssMode-D2t4Dha2.js} +1 -1
  24. package/dist/{freemarker2-CjiAIcLl.js → freemarker2-D39zFABe.js} +1 -1
  25. package/dist/{handlebars-Y7tt15pg.js → handlebars-CWWNQuBG.js} +1 -1
  26. package/dist/{html-D6pb7ASx.js → html-NBLaPghp.js} +1 -1
  27. package/dist/{htmlMode-DEtOB0tt.js → htmlMode-BW3N7Ngk.js} +1 -1
  28. package/dist/{index-CrVyh0Oi.js → index-B-RFEefS.js} +30854 -32467
  29. package/dist/index.js +316 -321
  30. package/dist/{javascript-D3p_vUxf.js → javascript-CTIA1K6g.js} +1 -1
  31. package/dist/{jsonMode-Bw255hje.js → jsonMode-Pq5noLEn.js} +1 -1
  32. package/dist/{liquid-QWFaWZJp.js → liquid-CUj8Ueht.js} +1 -1
  33. package/dist/{mdx-Be6B58yP.js → mdx-DpNdDQgw.js} +1 -1
  34. package/dist/{python-CsYxx99z.js → python-CicdeGFS.js} +1 -1
  35. package/dist/{razor-BkiFiZ3A.js → razor-nppHFG5T.js} +1 -1
  36. package/dist/{tsMode-CJpV580F.js → tsMode-BiiFbfNx.js} +1 -1
  37. package/dist/{typescript-CAsn1vFX.js → typescript-CO7t4-PG.js} +1 -1
  38. package/dist/{xml-DY66nCMQ.js → xml-BImtN4Hu.js} +1 -1
  39. package/dist/{yaml-DVJGr1T9.js → yaml-WCaeYmeb.js} +1 -1
  40. package/package.json +3 -4
  41. package/dist/Shared/Components/Security/SecurityModal/SecurityModal.d.ts +0 -14
  42. package/dist/Shared/Components/Security/SecurityModal/components/IndexedTextDisplay.d.ts +0 -4
  43. package/dist/Shared/Components/Security/SecurityModal/components/InfoCard.d.ts +0 -4
  44. package/dist/Shared/Components/Security/SecurityModal/components/OpenDetailViewButton.d.ts +0 -4
  45. package/dist/Shared/Components/Security/SecurityModal/components/Sidebar.d.ts +0 -4
  46. package/dist/Shared/Components/Security/SecurityModal/components/Table.d.ts +0 -4
  47. package/dist/Shared/Components/Security/SecurityModal/components/index.d.ts +0 -4
  48. package/dist/Shared/Components/Security/SecurityModal/config/CodeScan.d.ts +0 -100
  49. package/dist/Shared/Components/Security/SecurityModal/config/EmptyState.d.ts +0 -2
  50. package/dist/Shared/Components/Security/SecurityModal/config/ImageScan.d.ts +0 -4
  51. package/dist/Shared/Components/Security/SecurityModal/config/InfoCard.d.ts +0 -2
  52. package/dist/Shared/Components/Security/SecurityModal/config/KubernetesManifest.d.ts +0 -4
  53. package/dist/Shared/Components/Security/SecurityModal/config/Sidebar.d.ts +0 -2
  54. package/dist/Shared/Components/Security/SecurityModal/config/Table.d.ts +0 -2
  55. package/dist/Shared/Components/Security/SecurityModal/config/index.d.ts +0 -3
  56. package/dist/Shared/Components/Security/SecurityModal/constants.d.ts +0 -56
  57. package/dist/Shared/Components/Security/SecurityModal/index.d.ts +0 -4
  58. package/dist/Shared/Components/Security/SecurityModal/service.d.ts +0 -5
  59. package/dist/Shared/Components/Security/SecurityModal/types.d.ts +0 -269
  60. package/dist/Shared/Components/Security/SecurityModal/utils.d.ts +0 -34
  61. package/dist/Shared/Components/Security/SecuritySummaryCard/SecuritySummaryCard.d.ts +0 -3
  62. package/dist/Shared/Components/Security/SecuritySummaryCard/index.d.ts +0 -1
  63. package/dist/Shared/Components/Security/SecuritySummaryCard/types.d.ts +0 -16
  64. package/dist/Shared/Components/Security/index.d.ts +0 -3
@@ -85,8 +85,6 @@ export declare const ROUTES: {
85
85
  PLUGIN_GLOBAL_LIST_DETAIL_V2: string;
86
86
  PLUGIN_GLOBAL_LIST_V2: string;
87
87
  PLUGIN_GLOBAL_LIST_TAGS: string;
88
- K8S_RESOURCE_SECURITY: string;
89
- SCAN_RESULT: string;
90
88
  PLUGIN_LIST_MIN: string;
91
89
  DEPLOYMENT_CHARTS_LIST: string;
92
90
  USER_LIST_MIN: string;
@@ -22,12 +22,6 @@ export declare const refresh: () => void;
22
22
  export declare const reportIssue: () => void;
23
23
  export declare function useEffectAfterMount(cb: any, dependencies: any): void;
24
24
  export declare function getCookie(sKey: any): string;
25
- export declare function useForm(stateSchema: any, validationSchema: {}, callback: any): {
26
- state: any;
27
- disable: boolean;
28
- handleOnChange: (event: any) => void;
29
- handleOnSubmit: (event: any) => void;
30
- };
31
25
  export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
32
26
  export declare function useSearchString(): UseSearchString;
33
27
  export declare const closeOnEscKeyPressed: (e: any, actionClose: () => void) => void;
@@ -0,0 +1,2 @@
1
+ import { ScanVulnerabilitiesTableProps } from '../Types';
2
+ export default function ScanVulnerabilitiesTable({ vulnerabilities, hidePolicy, shouldStick, }: ScanVulnerabilitiesTableProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare enum VulnerabilitiesTableSortKeys {
2
+ SEVERITY = "severity",
3
+ PACKAGE = "package"
4
+ }
@@ -28,6 +28,7 @@ export { default as GenericFilterEmptyState } from './EmptyState/GenericFilterEm
28
28
  export * from './SearchBar';
29
29
  export * from './SortableTableHeaderCell';
30
30
  export { default as Toggle } from './Toggle/Toggle';
31
+ export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable';
31
32
  export { default as StyledRadioGroup } from './RadioGroup/RadioGroup';
32
33
  export * from './CIPipeline.Types';
33
34
  export * from './Policy.Types';
@@ -1,3 +1,3 @@
1
1
  import { ImageCardAccordionProps } from './types';
2
- declare const ImageCardAccordion: ({ isSecurityModuleInstalled, artifactId, applicationId, environmentId, changesCard, isScanned, isScanEnabled, isScanV2Enabled, }: ImageCardAccordionProps) => JSX.Element;
2
+ declare const ImageCardAccordion: ({ isSecurityModuleInstalled, artifactId, applicationId, environmentId, changesCard, isScanned, isScanEnabled, }: ImageCardAccordionProps) => JSX.Element;
3
3
  export default ImageCardAccordion;
@@ -9,7 +9,6 @@ export interface ImageCardAccordionProps extends MaterialSecurityInfoType {
9
9
  changesCard: ReactNode;
10
10
  isScanned: boolean;
11
11
  isScanEnabled: boolean;
12
- isScanV2Enabled: boolean;
13
12
  }
14
13
  export interface SecurityDetailsType {
15
14
  vulnerabilities: VulnerabilityType[];
@@ -1,3 +1,3 @@
1
1
  import { VulnerabilitiesProps } from './types';
2
- declare const Vulnerabilities: ({ isScanned, isScanEnabled, artifactId, applicationId, environmentId, setVulnerabilityCount, isScanV2Enabled, }: VulnerabilitiesProps) => JSX.Element;
2
+ declare const Vulnerabilities: ({ isScanned, isScanEnabled, artifactId, applicationId, environmentId, setVulnerabilityCount, }: VulnerabilitiesProps) => JSX.Element;
3
3
  export default Vulnerabilities;
@@ -0,0 +1,4 @@
1
+ export declare const NO_VULNERABILITY_TEXT: {
2
+ SECURED: string;
3
+ NO_VULNERABILITY_FOUND: string;
4
+ };
@@ -1,3 +1,2 @@
1
1
  export { default as Vulnerabilities } from './Vulnerabilities';
2
2
  export * from './utils';
3
- export * from './service';
@@ -1,2 +1,2 @@
1
- import { LastExecutionResponseType } from '../../../types';
1
+ import { LastExecutionResponseType } from '../../types';
2
2
  export declare function getLastExecutionByArtifactAppEnv(artifactId: string | number, appId: number | string, envId: number | string): Promise<LastExecutionResponseType>;
@@ -1,8 +1,7 @@
1
- import { MaterialSecurityInfoType } from '../../../types';
1
+ import { MaterialSecurityInfoType } from '../../types';
2
2
  export interface VulnerabilitiesProps extends MaterialSecurityInfoType {
3
3
  artifactId: number;
4
4
  applicationId: number;
5
5
  environmentId: number;
6
6
  setVulnerabilityCount: React.Dispatch<React.SetStateAction<number>>;
7
- isScanV2Enabled: boolean;
8
7
  }
@@ -1,4 +1,4 @@
1
- import { LastExecutionResponseType, LastExecutionResultType } from '../../../types';
1
+ import { LastExecutionResponseType, LastExecutionResultType } from '../../types';
2
2
  export declare const getSortedVulnerabilities: (vulnerabilities: any) => any;
3
3
  export declare const getParsedScanResult: (scanResult: any) => LastExecutionResultType;
4
4
  export declare const parseLastExecutionResponse: (response: any) => LastExecutionResponseType;
@@ -5,6 +5,7 @@ export * from './ImageCard';
5
5
  export * from './ImageCardAccordion';
6
6
  export * from './ExcludedImageNode';
7
7
  export * from './ScannedByToolModal';
8
+ export * from './Vulnerabilities';
8
9
  export * from './FilterChips';
9
10
  export * from './ActivityIndicator';
10
11
  export * from './GenericSectionErrorState';
@@ -39,5 +40,4 @@ export * from './TabGroup';
39
40
  export * from './EditImageFormField';
40
41
  export * from './Collapse';
41
42
  export * from './FilterButton';
42
- export * from './Security';
43
43
  export * from './Button';
@@ -1,3 +1,4 @@
1
1
  export * from './UsePrompt';
2
2
  export * from './useGetResourceKindsOptions';
3
3
  export * from './UseDownload';
4
+ export * from './useForm';
@@ -0,0 +1,2 @@
1
+ export * from './useForm';
2
+ export * from './useForm.types';
@@ -0,0 +1,29 @@
1
+ import { ChangeEvent, FormEvent } from 'react';
2
+ import { UseFormSubmitHandler, UseFormValidations } from './useForm.types';
3
+ /**
4
+ * A custom hook to manage form state, validation, and submission handling.
5
+ *
6
+ * @template T - A record type representing form data.
7
+ * @param options (optional) - Options for initial form values, validation rules, and form mode.
8
+ * @param options.validations - An object containing validation rules for form fields.
9
+ * @param options.initialValues - An object representing the initial values of the form.
10
+ * @param options.mode (default: `onChange`) - A string to set validation mode, either 'onChange' or 'onBlur'.
11
+ * @returns Returns form state, handlers for change and submission, validation errors, and a trigger function for manual validation.
12
+ */
13
+ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
14
+ validations?: UseFormValidations<T>;
15
+ initialValues?: Partial<T>;
16
+ mode?: "onChange" | "onBlur";
17
+ }) => {
18
+ data: T;
19
+ errors: Partial<Record<keyof T, string | string[]>>;
20
+ register: <S extends unknown>(name: keyof T, sanitizeFn?: (value: string) => S) => {
21
+ onChange: (e: ChangeEvent<HTMLInputElement & HTMLSelectElement>) => void;
22
+ onBlur: () => void;
23
+ };
24
+ handleSubmit: (onValid: UseFormSubmitHandler<T>) => (e: FormEvent<HTMLFormElement>) => void;
25
+ trigger: (name: keyof T | (keyof T)[]) => (string | string[]) | (string | string[])[];
26
+ touchedFields: Partial<Record<keyof T, boolean>>;
27
+ dirtyFields: Partial<Record<keyof T, boolean>>;
28
+ isDirty: boolean;
29
+ };
@@ -0,0 +1,30 @@
1
+ import { FormEvent } from 'react';
2
+ type ValidationRequired = boolean | {
3
+ value: boolean;
4
+ message: string;
5
+ };
6
+ type ValidationPattern = {
7
+ value: RegExp;
8
+ message: string;
9
+ } | {
10
+ value: RegExp;
11
+ message: string;
12
+ }[];
13
+ type ValidationCustom = {
14
+ isValid: (value: string) => boolean;
15
+ message: string;
16
+ } | {
17
+ isValid: (value: string) => boolean;
18
+ message: string;
19
+ }[];
20
+ export interface UseFormValidation {
21
+ required?: ValidationRequired;
22
+ pattern?: ValidationPattern;
23
+ custom?: ValidationCustom;
24
+ }
25
+ export type UseFormErrors<T> = Partial<Record<keyof T, string | string[]>>;
26
+ export type DirtyFields<T> = Partial<Record<keyof T, boolean>>;
27
+ export type TouchedFields<T> = Partial<Record<keyof T, boolean>>;
28
+ export type UseFormValidations<T extends {}> = Partial<Record<keyof T, UseFormValidation>>;
29
+ export type UseFormSubmitHandler<T extends {}> = (data: T, e?: FormEvent<HTMLFormElement>) => void;
30
+ export {};
@@ -0,0 +1,10 @@
1
+ import { UseFormValidation } from './useForm.types';
2
+ /**
3
+ * Validates a form field based on the provided validation rules.
4
+ *
5
+ * @template T - A record type representing form data.
6
+ * @param value - The value of the form field to be validated.
7
+ * @param validation - The validation rules for the form field.
8
+ * @returns Returns error message(s) or null if valid.
9
+ */
10
+ export declare const checkValidation: <T extends Record<keyof T, any> = {}>(value: T[keyof T], validation: UseFormValidation) => string | string[] | null;
@@ -14,10 +14,6 @@ export declare const STAGE_TYPE: {
14
14
  ROLLBACK: string;
15
15
  };
16
16
  export declare const SCAN_TOOL_ID_TRIVY = 3;
17
- /**
18
- * @description This is only used to show mapping for clair, scan tool id for clair can be either 1 or 2
19
- * */
20
- export declare const SCAN_TOOL_ID_CLAIR = 2;
21
17
  export declare const IMAGE_SCAN_TOOL: {
22
18
  Clair: string;
23
19
  Trivy: string;
@@ -413,7 +413,6 @@ export interface LastExecutionResultType {
413
413
  scanned?: boolean;
414
414
  scanEnabled?: boolean;
415
415
  scanToolId?: number;
416
- imageScanDeployInfoId?: number;
417
416
  }
418
417
  export interface LastExecutionResponseType extends ResponseType<LastExecutionResultType> {
419
418
  }