@devtron-labs/devtron-fe-common-lib 0.7.3 → 1.0.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 (38) hide show
  1. package/dist/Common/Api.d.ts +1 -1
  2. package/dist/Common/Constants.d.ts +2 -0
  3. package/dist/Common/DraggableWrapper/types.d.ts +2 -1
  4. package/dist/Common/Helper.d.ts +5 -0
  5. package/dist/Common/RJSF/Form.d.ts +2 -1
  6. package/dist/Common/Types.d.ts +9 -0
  7. package/dist/Pages/ResourceBrowser/ResourceBrowser.Types.d.ts +47 -0
  8. package/dist/Pages/ResourceBrowser/index.d.ts +2 -0
  9. package/dist/Pages/ResourceBrowser/service.d.ts +3 -0
  10. package/dist/Pages/ResourceBrowser/types.d.ts +10 -0
  11. package/dist/Shared/API/APIQueuing.d.ts +1 -1
  12. package/dist/Shared/Components/BulkSelection/types.d.ts +8 -5
  13. package/dist/Shared/Components/CollapsibleList/CollapsibleList.types.d.ts +2 -1
  14. package/dist/Shared/Components/Security/SecurityModal/config/ImageScan.d.ts +2 -1
  15. package/dist/Shared/Components/Security/SecurityModal/config/index.d.ts +1 -0
  16. package/dist/Shared/Components/Security/SecurityModal/index.d.ts +1 -1
  17. package/dist/Shared/types.d.ts +37 -1
  18. package/dist/Shared/validations.d.ts +1 -0
  19. package/dist/assets/index.css +1 -1
  20. package/dist/{cssMode-C393xnf9.js → cssMode-Cms6MtyR.js} +1 -1
  21. package/dist/{freemarker2-BNEPoHWG.js → freemarker2-3FE3rIRb.js} +1 -1
  22. package/dist/{handlebars-BqcY0A8U.js → handlebars-DeT_KQct.js} +1 -1
  23. package/dist/{html-a0Iz2OCW.js → html-W6MJJ6Cd.js} +1 -1
  24. package/dist/{htmlMode-D1GxvUgp.js → htmlMode-X1lmmOke.js} +1 -1
  25. package/dist/{index-DPLJRt7w.js → index-BAPwGfmH.js} +16764 -16706
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +539 -532
  28. package/dist/{javascript-BBDBPrOm.js → javascript-DBHHMxuE.js} +1 -1
  29. package/dist/{jsonMode-CBqfrghp.js → jsonMode-R_Ioy9kM.js} +1 -1
  30. package/dist/{liquid-Dd7NnPti.js → liquid-CgBcKItj.js} +1 -1
  31. package/dist/{mdx-COqxWug4.js → mdx-5zADcGgC.js} +1 -1
  32. package/dist/{python-DPdWwSUC.js → python-Ct8AOOli.js} +1 -1
  33. package/dist/{razor-1FkPNDHf.js → razor-DBKs2NDr.js} +1 -1
  34. package/dist/{tsMode-DqGRLrqE.js → tsMode-2mDlxLKe.js} +1 -1
  35. package/dist/{typescript-D2Mysr3G.js → typescript-_jgELbQ9.js} +1 -1
  36. package/dist/{xml-CNLng4S3.js → xml-Da6smlqJ.js} +1 -1
  37. package/dist/{yaml-C7FvUynj.js → yaml-BNTzHcuk.js} +1 -1
  38. package/package.json +2 -1
@@ -12,4 +12,4 @@ export declare const abortPreviousRequests: <T>(callback: () => Promise<T>, abor
12
12
  /**
13
13
  * Returns true if the error is due to a aborted request
14
14
  */
15
- export declare const getIsRequestAborted: (error: any) => any;
15
+ export declare const getIsRequestAborted: (error: any) => boolean;
@@ -46,6 +46,7 @@ export declare const URLS: {
46
46
  GLOBAL_CONFIG_DEPLOYMENT_CHARTS_LIST: string;
47
47
  NETWORK_STATUS_INTERFACE: string;
48
48
  CONFIG_DRIFT: string;
49
+ RESOURCE_BROWSER: string;
49
50
  };
50
51
  export declare const ROUTES: {
51
52
  APP: string;
@@ -92,6 +93,7 @@ export declare const ROUTES: {
92
93
  DEPLOYMENT_CHARTS_LIST: string;
93
94
  USER_LIST_MIN: string;
94
95
  CONFIG_DATA: string;
96
+ K8S_RESOURCE_LIST: string;
95
97
  };
96
98
  export declare enum KEY_VALUE {
97
99
  KEY = "key",
@@ -1,7 +1,8 @@
1
1
  import { HTMLAttributes, ReactNode, RefObject } from 'react';
2
2
  export declare enum DraggablePositionVariant {
3
3
  PARENT_BOTTOM_CENTER = "PARENT_BOTTOM_CENTER",
4
- SCREEN_BOTTOM_CENTER = "SCREEN_BOTTOM_CENTER"
4
+ SCREEN_BOTTOM_CENTER = "SCREEN_BOTTOM_CENTER",
5
+ SCREEN_BOTTOM_RIGHT = "SCREEN_BOTTOM_RIGHT"
5
6
  }
6
7
  export interface DraggableWrapperProps {
7
8
  children: ReactNode;
@@ -121,4 +121,9 @@ export declare function mapByKey<T = Map<any, any>>(arr: any[], id: string): T;
121
121
  export declare function asyncWrap(promise: any): any[];
122
122
  export declare const prefixZeroIfSingleDigit: (value?: number) => string | number;
123
123
  export declare const throttle: <T extends (...args: unknown[]) => unknown>(func: T, delay?: number) => ((...args: Parameters<T>) => void);
124
+ export declare const getSanitizedIframe: (iframeString: string) => string;
125
+ /**
126
+ * This method adds default attributes to iframe - title, loading ="lazy", width="100%", height="100%"
127
+ */
128
+ export declare const getIframeWithDefaultAttributes: (iframeString: string, defaultName?: string) => string;
124
129
  export {};
@@ -1,2 +1,3 @@
1
+ import { default as RJSF } from '@rjsf/core';
1
2
  import { FormProps } from './types';
2
- export declare const RJSFForm: (props: FormProps) => JSX.Element;
3
+ export declare const RJSFForm: import('react').ForwardRefExoticComponent<Pick<FormProps, "children" | "className" | "id" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "onError" | "action" | "disabled" | "name" | "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>>>;
@@ -856,4 +856,13 @@ export interface EnvironmentHelmResult {
856
856
  allowedDeploymentTypes?: DeploymentAppTypes[];
857
857
  }
858
858
  export type EnvironmentListHelmResponse = ResponseType<EnvironmentListHelmResult[]>;
859
+ export interface WidgetEventDetails {
860
+ message: string;
861
+ namespace: string;
862
+ object: string;
863
+ source: string;
864
+ count: number;
865
+ age: string;
866
+ lastSeen: string;
867
+ }
859
868
  export {};
@@ -1,4 +1,5 @@
1
1
  import { NodeType, Nodes } from '../../Shared/types';
2
+ import { RefObject } from 'react';
2
3
  export interface GVKType {
3
4
  Group: string;
4
5
  Version: string;
@@ -18,3 +19,49 @@ export interface K8SObjectBaseType {
18
19
  name: string;
19
20
  isExpanded: boolean;
20
21
  }
22
+ interface K8sRequestResourceIdentifierType {
23
+ groupVersionKind: GVKType;
24
+ namespace?: string;
25
+ name?: string;
26
+ }
27
+ interface ResourceListPayloadK8sRequestType {
28
+ resourceIdentifier: K8sRequestResourceIdentifierType;
29
+ patch?: string;
30
+ forceDelete?: boolean;
31
+ }
32
+ export interface K8sResourceListPayloadType {
33
+ clusterId: number;
34
+ filter?: string;
35
+ k8sRequest: ResourceListPayloadK8sRequestType;
36
+ }
37
+ export type K8sResourceDetailDataType = {
38
+ [key: string]: string | number | object;
39
+ };
40
+ export interface K8sResourceDetailType {
41
+ headers: string[];
42
+ data: K8sResourceDetailDataType[];
43
+ }
44
+ export interface BulkSelectionActionWidgetProps {
45
+ count: number;
46
+ handleOpenBulkDeleteModal: () => void;
47
+ handleClearBulkSelection: () => void;
48
+ handleOpenRestartWorkloadModal: () => void;
49
+ parentRef: RefObject<HTMLDivElement>;
50
+ showBulkRestartOption: boolean;
51
+ }
52
+ export interface BulkOperation {
53
+ name: string;
54
+ operation: (signal: AbortSignal, data?: unknown) => Promise<void>;
55
+ }
56
+ export type BulkOperationModalProps = {
57
+ operationType: 'restart' | 'delete';
58
+ clusterName: string;
59
+ operations: NonNullable<BulkOperation[]>;
60
+ handleModalClose: () => void;
61
+ resourceKind: string;
62
+ handleReloadDataAfterBulkOperation?: () => void;
63
+ hideResultsDrawer?: boolean;
64
+ shouldAllowForceOperation?: true;
65
+ };
66
+ export type BulkOperationModalState = BulkOperationModalProps['operationType'] | 'closed';
67
+ export {};
@@ -1,2 +1,4 @@
1
1
  export * from './ResourceBrowser.Types';
2
2
  export * from './Helper';
3
+ export * from './types';
4
+ export * from './service';
@@ -0,0 +1,3 @@
1
+ import { ResponseType } from '../../Common/Types';
2
+ import { K8sResourceDetailType, K8sResourceListPayloadType } from './ResourceBrowser.Types';
3
+ export declare const getK8sResourceList: (resourceListPayload: K8sResourceListPayloadType, signal?: AbortSignal) => Promise<ResponseType<K8sResourceDetailType>>;
@@ -0,0 +1,10 @@
1
+ export declare enum ClusterFiltersType {
2
+ ALL_CLUSTERS = "all",
3
+ HEALTHY = "healthy",
4
+ UNHEALTHY = "unhealthy"
5
+ }
6
+ export declare enum ClusterStatusType {
7
+ HEALTHY = "healthy",
8
+ UNHEALTHY = "unhealthy",
9
+ CONNECTION_FAILED = "connection failed"
10
+ }
@@ -6,5 +6,5 @@ import { ApiQueuingWithBatchResponseItem } from '../types';
6
6
  * @param shouldRejectOnError If set to true, the promise will reject if any of the function calls rejects, i.e, acts like Promise.all else Promise.allSettled . Defaults to false.
7
7
  * @returns A promise that resolves to a array of objects containing the status and value of the batch execution.
8
8
  */
9
- declare const ApiQueuingWithBatch: <T>(functionCalls: any, httpProtocol: string, shouldRejectOnError?: boolean, batchSize?: number) => Promise<ApiQueuingWithBatchResponseItem<T>[]>;
9
+ declare const ApiQueuingWithBatch: <T>(functionCalls: any, shouldRejectOnError?: boolean, batchSize?: number) => Promise<ApiQueuingWithBatchResponseItem<T>[]>;
10
10
  export default ApiQueuingWithBatch;
@@ -24,6 +24,7 @@ export interface UseBulkSelectionReturnType<T> extends GetBulkSelectionCheckboxV
24
24
  handleBulkSelection: ({ action, data }: HandleBulkSelectionType<T>) => void;
25
25
  isBulkSelectionApplied: boolean;
26
26
  getSelectedIdentifiersCount: () => number;
27
+ setIdentifiers: React.Dispatch<React.SetStateAction<T>>;
27
28
  }
28
29
  export interface BulkSelectionProps {
29
30
  showPagination: boolean;
@@ -44,14 +45,16 @@ export declare enum SelectAllDialogStatus {
44
45
  }
45
46
  export type BulkSelectionIdentifiersType<T> = Record<string | number, T>;
46
47
  export interface UseBulkSelectionProps<T> {
47
- /**
48
- * Response from API, assuming structure to be array of objects with key and values
49
- * This will the given ids on current page
50
- */
51
- identifiers: T;
52
48
  /**
53
49
  * Act as buffer between select all across pages and select all on page state
54
50
  */
55
51
  getSelectAllDialogStatus: () => SelectAllDialogStatus;
52
+ /**
53
+ * Response from API, assuming structure to be array of objects with key and values
54
+ * This will the given ids on current page.
55
+ *
56
+ * NOTE!: Please wrap this value with a useMemo since it goes into useEffect dependency
57
+ */
58
+ identifiers?: T;
56
59
  children?: React.ReactNode;
57
60
  }
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { TippyProps } from '@tippyjs/react';
3
+ import { NavLinkProps } from 'react-router-dom';
3
4
  interface ButtonTab {
4
5
  /**
5
6
  * Is tab active ( for button tab )
@@ -24,7 +25,7 @@ interface NavLinkTab {
24
25
  }
25
26
  export type TabOptions = 'button' | 'navLink';
26
27
  type ConditionalTabType<TabType extends TabOptions> = TabType extends 'button' ? ButtonTab : NavLinkTab;
27
- export type CollapsibleListItem<TabType extends TabOptions> = ConditionalTabType<TabType> & {
28
+ export type CollapsibleListItem<TabType extends TabOptions> = Pick<NavLinkProps, 'isActive'> & ConditionalTabType<TabType> & {
28
29
  /**
29
30
  * The title of the list item.
30
31
  */
@@ -1,4 +1,5 @@
1
- import { DetailViewDataType, ImageScan, SecurityModalStateType, TablePropsType, InfoCardPropsType, EmptyStateType, ApiResponseResultType, OpenDetailViewButtonProps } from '../types';
1
+ import { DetailViewDataType, ImageScan, SecurityModalStateType, TablePropsType, StatusType, InfoCardPropsType, EmptyStateType, ApiResponseResultType, OpenDetailViewButtonProps } from '../types';
2
+ export declare const getProgressingStateForStatus: (status: StatusType["status"]) => JSX.Element;
2
3
  export declare const getImageScanTableData: (data: ImageScan, subCategory: SecurityModalStateType["subCategory"], setDetailViewData: OpenDetailViewButtonProps["setDetailViewData"], hidePolicy: boolean) => TablePropsType;
3
4
  export declare const getImageScanInfoCardData: (data: ImageScan, subCategory: SecurityModalStateType["subCategory"]) => InfoCardPropsType;
4
5
  export declare const getImageScanEmptyState: (data: ApiResponseResultType, subCategory: SecurityModalStateType["subCategory"], detailViewData: DetailViewDataType) => EmptyStateType;
@@ -1,3 +1,4 @@
1
1
  export { getTableData } from './Table';
2
2
  export { getInfoCardData } from './InfoCard';
3
3
  export { SIDEBAR_DATA } from './Sidebar';
4
+ export { getProgressingStateForStatus } from './ImageScan';
@@ -1,6 +1,6 @@
1
1
  export { default as SecurityModal } from './SecurityModal';
2
2
  export { getSecurityScanSeveritiesCount, getTotalVulnerabilityCount, parseGetResourceScanDetailsResponse, parseExecutionDetailResponse, } from './utils';
3
3
  export type { AppDetailsPayload, ExecutionDetailsPayload, ApiResponseResultType, SidebarPropsType, SidebarDataChildType, SidebarDataType, GetResourceScanDetailsPayloadType, GetResourceScanDetailsResponseType, } from './types';
4
- export { SIDEBAR_DATA } from './config';
4
+ export { SIDEBAR_DATA, getProgressingStateForStatus } from './config';
5
5
  export { CATEGORY_LABELS } from './constants';
6
6
  export { getExecutionDetails } from './service';
@@ -1,3 +1,4 @@
1
+ import { Dayjs } from 'dayjs';
1
2
  import { OptionType, CommonNodeAttr, ResponseType, UserApprovalConfigType, VulnerabilityType, DeploymentAppTypes, ServerErrors, SortingParams } from '../Common';
2
3
  import { KeyValueListType } from './Components';
3
4
  import { EnvironmentTypeEnum, PatchOperationType } from './constants';
@@ -84,7 +85,9 @@ export declare enum Nodes {
84
85
  PodDisruptionBudget = "PodDisruptionBudget",
85
86
  Event = "Event",
86
87
  Namespace = "Namespace",
87
- Overview = "Overview"
88
+ Overview = "Overview",
89
+ MonitoringDashboard = "MonitoringDashboard",
90
+ UpgradeCluster = "UpgradeCluster"
88
91
  }
89
92
  export type NodeType = keyof typeof Nodes;
90
93
  export interface Node {
@@ -583,6 +586,7 @@ export declare enum ConfigurationType {
583
586
  export interface BaseURLParams {
584
587
  appId: string;
585
588
  envId: string;
589
+ clusterId: string;
586
590
  }
587
591
  export interface ConfigKeysWithLockType {
588
592
  config: string[];
@@ -629,4 +633,36 @@ export interface CustomRoleAndMeta {
629
633
  possibleRolesMetaForCluster: MetaPossibleRoles;
630
634
  possibleRolesMetaForJob: MetaPossibleRoles;
631
635
  }
636
+ interface CommonTabArgsType {
637
+ name: string;
638
+ kind?: string;
639
+ url: string;
640
+ isSelected: boolean;
641
+ title?: string;
642
+ isDeleted?: boolean;
643
+ position: number;
644
+ iconPath?: string;
645
+ dynamicTitle?: string;
646
+ showNameOnSelect?: boolean;
647
+ /**
648
+ * @default false
649
+ */
650
+ hideName?: boolean;
651
+ isAlive?: boolean;
652
+ lastSyncMoment?: Dayjs;
653
+ componentKey?: string;
654
+ tippyConfig?: {
655
+ title: string;
656
+ descriptions: {
657
+ info: string;
658
+ value: string;
659
+ }[];
660
+ };
661
+ }
662
+ export interface InitTabType extends CommonTabArgsType {
663
+ idPrefix: string;
664
+ }
665
+ export interface DynamicTabType extends CommonTabArgsType {
666
+ id: string;
667
+ }
632
668
  export {};
@@ -45,3 +45,4 @@ export declare const validateSemanticVersioning: (version: string) => Validation
45
45
  export declare const validateDisplayName: (name: string) => ValidationResponseType;
46
46
  export declare const validateJSON: (json: string) => ValidationResponseType;
47
47
  export declare const validateDateAndTime: (date: Date) => ValidationResponseType;
48
+ export declare const validateIframe: (input: string) => ValidationResponseType;