@devtron-labs/devtron-fe-common-lib 1.20.3-pre-2 → 1.20.3-pre-4

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.
@@ -1,4 +1,5 @@
1
- import { ReactNode, RefObject } from 'react';
1
+ import { RefObject } from 'react';
2
+ import { FiltersTypeEnum, TableViewWrapperProps } from '../../Shared/Components';
2
3
  import { Nodes, NodeType } from '../../Shared/types';
3
4
  export interface GVKType {
4
5
  Group: string;
@@ -136,8 +137,7 @@ export interface GVKOptionValueType {
136
137
  kind: string;
137
138
  apiVersion: string;
138
139
  }
139
- export interface ResourceRecommenderActionMenuProps {
140
- children: ReactNode;
140
+ export interface ResourceRecommenderActionMenuProps extends Pick<TableViewWrapperProps<K8sResourceDetailDataType, FiltersTypeEnum.URL>, 'filteredRows'> {
141
141
  lastScannedOn: string;
142
142
  }
143
143
  export {};
@@ -0,0 +1,3 @@
1
+ import { ExportToCsvProps } from './types';
2
+ declare const ExportToCsv: <HeaderItemType extends string>({ apiPromise, fileName, triggerElementConfig, disabled, modalConfig, headers, downloadRequestId, }: ExportToCsvProps<HeaderItemType>) => JSX.Element;
3
+ export default ExportToCsv;
@@ -0,0 +1,3 @@
1
+ import { ExportToCsvDialogProps } from './types';
2
+ declare const ExportToCsvDialog: ({ exportDataError, isLoading, initiateDownload, handleCancelRequest, }: ExportToCsvDialogProps) => JSX.Element;
3
+ export default ExportToCsvDialog;
@@ -0,0 +1,2 @@
1
+ export { default as ExportToCsv } from './ExportToCsv';
2
+ export * from './types';
@@ -0,0 +1,64 @@
1
+ import { ServerErrors } from '../../../Common/ServerError';
2
+ import { APIOptions } from '../../../Common/Types';
3
+ import { ButtonProps } from '../Button';
4
+ type TriggerElementConfigType = {
5
+ buttonProps: ButtonProps;
6
+ showOnlyIcon?: boolean;
7
+ customButton?: never;
8
+ isExternalTrigger?: false;
9
+ } | {
10
+ customButton: {
11
+ content: JSX.Element;
12
+ className: string;
13
+ };
14
+ buttonProps?: never;
15
+ showOnlyIcon?: false;
16
+ isExternalTrigger?: false;
17
+ } | {
18
+ isExternalTrigger: true;
19
+ showOnlyIcon?: false;
20
+ buttonProps?: never;
21
+ customButton?: never;
22
+ } | {
23
+ showOnlyIcon: true;
24
+ buttonProps?: never;
25
+ customButton?: never;
26
+ isExternalTrigger?: false;
27
+ };
28
+ export interface ExportToCsvProps<HeaderItemKeyType extends string> {
29
+ headers: {
30
+ label: string;
31
+ key: HeaderItemKeyType;
32
+ }[];
33
+ apiPromise: ({ signal, }: Pick<APIOptions, 'signal'>) => Promise<Record<HeaderItemKeyType, string | number | boolean>[]>;
34
+ fileName: string;
35
+ /**
36
+ * If nothing given will render a Button with "Export CSV" text
37
+ */
38
+ triggerElementConfig?: TriggerElementConfigType;
39
+ /**
40
+ * @default false
41
+ */
42
+ disabled?: boolean;
43
+ /**
44
+ * If not given would show default dialog
45
+ */
46
+ modalConfig?: {
47
+ hideDialog: false;
48
+ renderCustomModal?: (proceedWithDownload: (shouldProceed: boolean) => void) => JSX.Element;
49
+ } | {
50
+ hideDialog: true;
51
+ renderCustomModal?: never;
52
+ };
53
+ /**
54
+ * If given, would trigger export on when this changes and has some value
55
+ */
56
+ downloadRequestId?: string | number;
57
+ }
58
+ export interface ExportToCsvDialogProps {
59
+ isLoading: boolean;
60
+ exportDataError: ServerErrors;
61
+ initiateDownload: () => void;
62
+ handleCancelRequest: () => void;
63
+ }
64
+ export {};
@@ -10,6 +10,7 @@ export declare const iconMap: {
10
10
  'ic-app-template': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
11
11
  'ic-argocd-app': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
12
12
  'ic-arrow-clockwise': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
13
+ 'ic-arrow-line-down': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
13
14
  'ic-arrow-right': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
14
15
  'ic-arrow-square-out': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
15
16
  'ic-arrows-clockwise': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -1,7 +1,7 @@
1
1
  import { Dispatch, FunctionComponent, MouseEvent, PropsWithChildren, SetStateAction } from 'react';
2
2
  import { GenericFilterEmptyStateProps } from '../../../Common/EmptyState/types';
3
3
  import { UseStateFiltersProps, UseStateFiltersReturnType, UseUrlFiltersProps, UseUrlFiltersReturnType } from '../../../Common/Hooks';
4
- import { APIOptions, GenericEmptyStateType } from '../../../Common/index';
4
+ import { GenericEmptyStateType } from '../../../Common/index';
5
5
  import { PageSizeOption } from '../../../Common/Pagination/types';
6
6
  import { SortableTableHeaderCellProps, useResizableTableConfig } from '../../../Common/SortableTableHeaderCell';
7
7
  import { useBulkSelection, UseBulkSelectionProps } from '../BulkSelection';
@@ -177,7 +177,7 @@ export type InternalTableProps<RowData extends unknown, FilterVariant extends Fi
177
177
  } | {
178
178
  rows?: never;
179
179
  /** NOTE: Sorting on frontend is only handled if rows is provided instead of getRows */
180
- getRows: (props: GetRowsProps, abortControllerRef: APIOptions['abortControllerRef']) => Promise<{
180
+ getRows: (props: GetRowsProps, signal: AbortSignal) => Promise<{
181
181
  rows: RowsType<RowData>;
182
182
  totalRows: number;
183
183
  }>;
@@ -206,9 +206,11 @@ export interface GetFilteringPromiseProps<RowData extends unknown> {
206
206
  searchSortTimeoutRef: React.MutableRefObject<number>;
207
207
  callback: () => Promise<RowsType<RowData>> | RowsType<RowData>;
208
208
  }
209
- export interface TableContentProps<RowData extends unknown, FilterVariant extends FiltersTypeEnum, AdditionalProps extends Record<string, any>> extends Pick<InternalTableProps<RowData, FilterVariant, AdditionalProps>, 'filterData' | 'rows' | 'resizableConfig' | 'additionalProps' | 'visibleColumns' | 'stylesConfig' | 'loading' | 'bulkSelectionConfig' | 'bulkSelectionReturnValue' | 'handleClearBulkSelection' | 'handleToggleBulkSelectionOnRow' | 'paginationVariant' | 'RowActionsOnHoverComponent' | 'pageSizeOptions' | 'getRows'> {
209
+ export interface RowsResultType<RowData extends unknown> {
210
210
  filteredRows: RowsType<RowData>;
211
- areFilteredRowsLoading: boolean;
212
211
  totalRows: number;
213
212
  }
213
+ export interface TableContentProps<RowData extends unknown, FilterVariant extends FiltersTypeEnum, AdditionalProps extends Record<string, any>> extends Pick<InternalTableProps<RowData, FilterVariant, AdditionalProps>, 'filterData' | 'rows' | 'resizableConfig' | 'additionalProps' | 'visibleColumns' | 'stylesConfig' | 'loading' | 'bulkSelectionConfig' | 'bulkSelectionReturnValue' | 'handleClearBulkSelection' | 'handleToggleBulkSelectionOnRow' | 'paginationVariant' | 'RowActionsOnHoverComponent' | 'pageSizeOptions' | 'getRows'>, RowsResultType<RowData> {
214
+ areFilteredRowsLoading: boolean;
215
+ }
214
216
  export {};
@@ -37,6 +37,7 @@ export * from './EditImageFormField';
37
37
  export * from './EnvironmentSelector';
38
38
  export * from './Error';
39
39
  export * from './ExcludedImageNode';
40
+ export * from './ExportToCsv';
40
41
  export * from './FeatureDescription';
41
42
  export * from './FileUpload';
42
43
  export * from './FilterChips';
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
2
+ <path stroke="#3B444C" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 3.25V17.5m0 0-6.75-6.75M12 17.5l6.75-6.75m-15 9.75h16.5"/>
3
+ </svg>