@devtron-labs/devtron-fe-common-lib 0.0.61-beta-10 → 0.0.62-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 (96) hide show
  1. package/dist/Common/Constants.d.ts +14 -1
  2. package/dist/Common/DraggableWrapper/types.d.ts +4 -1
  3. package/dist/Common/Hooks/index.d.ts +1 -0
  4. package/dist/Common/Hooks/useUrlFilters/constants.d.ts +8 -0
  5. package/dist/Common/Hooks/useUrlFilters/index.d.ts +2 -0
  6. package/dist/Common/Hooks/useUrlFilters/types.d.ts +19 -0
  7. package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +20 -0
  8. package/dist/Common/SortableTableHeaderCell/SortableTableHeaderCell.d.ts +18 -0
  9. package/dist/Common/SortableTableHeaderCell/index.d.ts +2 -0
  10. package/dist/Common/SortableTableHeaderCell/types.d.ts +25 -0
  11. package/dist/Common/Types.d.ts +13 -1
  12. package/dist/Common/index.d.ts +1 -0
  13. package/dist/Pages/GlobalConfigurations/Authorization/constants.d.ts +15 -0
  14. package/dist/Pages/GlobalConfigurations/Authorization/index.d.ts +1 -0
  15. package/dist/Pages/GlobalConfigurations/index.d.ts +1 -1
  16. package/dist/Shared/Components/BulkSelection/constants.d.ts +0 -1
  17. package/dist/Shared/Components/BulkSelection/types.d.ts +2 -0
  18. package/dist/Shared/Components/index.d.ts +0 -2
  19. package/dist/Shared/index.d.ts +0 -2
  20. package/dist/index.js +371 -1161
  21. package/package.json +1 -1
  22. package/src/Assets/Icon/ic-arrow-up-down.svg +3 -0
  23. package/src/Assets/Icon/ic-sort-arrow-down.svg +3 -0
  24. package/src/Common/BreadCrumb/Types.ts +1 -0
  25. package/src/Common/Checkbox.tsx +0 -1
  26. package/src/Common/Constants.ts +18 -3
  27. package/src/Common/CustomInput/CustomInput.tsx +1 -2
  28. package/src/Common/DraggableWrapper/DraggableWrapper.tsx +1 -3
  29. package/src/Common/DraggableWrapper/types.ts +4 -1
  30. package/src/Common/Helper.tsx +8 -1
  31. package/src/Common/Hooks/index.ts +1 -0
  32. package/src/Common/Hooks/useUrlFilters/constants.ts +9 -0
  33. package/src/Common/Hooks/useUrlFilters/index.ts +2 -0
  34. package/src/Common/Hooks/useUrlFilters/types.ts +21 -0
  35. package/src/Common/Hooks/useUrlFilters/useUrlFilters.ts +121 -0
  36. package/src/Common/RJSF/utils.ts +0 -2
  37. package/src/Common/SearchBar/searchBar.scss +1 -1
  38. package/src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx +44 -0
  39. package/src/Common/SortableTableHeaderCell/index.ts +2 -0
  40. package/src/Common/SortableTableHeaderCell/types.ts +26 -0
  41. package/src/Common/Types.ts +13 -1
  42. package/src/Common/index.ts +1 -0
  43. package/src/Pages/GlobalConfigurations/Authorization/constants.ts +16 -0
  44. package/src/Pages/GlobalConfigurations/Authorization/index.ts +1 -0
  45. package/src/Pages/GlobalConfigurations/index.ts +1 -1
  46. package/src/Shared/Components/BulkSelection/BulkSelection.tsx +2 -2
  47. package/src/Shared/Components/BulkSelection/BulkSelectionDropdownItems.tsx +1 -3
  48. package/src/Shared/Components/BulkSelection/BulkSelectionProvider.tsx +17 -17
  49. package/src/Shared/Components/BulkSelection/constants.tsx +0 -1
  50. package/src/Shared/Components/BulkSelection/types.tsx +2 -0
  51. package/src/Shared/Components/index.ts +0 -2
  52. package/src/Shared/index.ts +0 -2
  53. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.d.ts +0 -4
  54. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.d.ts +0 -4
  55. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.d.ts +0 -7
  56. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.d.ts +0 -4
  57. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.d.ts +0 -4
  58. package/dist/Pages/GlobalConfigurations/BuildInfra/Descriptor.d.ts +0 -4
  59. package/dist/Pages/GlobalConfigurations/BuildInfra/Footer.d.ts +0 -4
  60. package/dist/Pages/GlobalConfigurations/BuildInfra/constants.d.ts +0 -50
  61. package/dist/Pages/GlobalConfigurations/BuildInfra/index.d.ts +0 -7
  62. package/dist/Pages/GlobalConfigurations/BuildInfra/services.d.ts +0 -6
  63. package/dist/Pages/GlobalConfigurations/BuildInfra/types.d.ts +0 -286
  64. package/dist/Pages/GlobalConfigurations/BuildInfra/utils.d.ts +0 -12
  65. package/dist/Shared/Components/APIResponseHandler/APIResponseHandler.d.ts +0 -4
  66. package/dist/Shared/Components/APIResponseHandler/constants.d.ts +0 -4
  67. package/dist/Shared/Components/APIResponseHandler/index.d.ts +0 -2
  68. package/dist/Shared/Components/APIResponseHandler/types.d.ts +0 -37
  69. package/dist/Shared/Components/ReactSelect/index.d.ts +0 -1
  70. package/dist/Shared/Components/ReactSelect/utils.d.ts +0 -12
  71. package/dist/Shared/Helpers.d.ts +0 -16
  72. package/dist/Shared/validations.d.ts +0 -8
  73. package/src/Assets/Icon/ic-cpu.svg +0 -4
  74. package/src/Assets/Icon/ic-memory.svg +0 -3
  75. package/src/Assets/Icon/ic-timer.svg +0 -3
  76. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.tsx +0 -128
  77. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.tsx +0 -44
  78. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.tsx +0 -106
  79. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.tsx +0 -55
  80. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.tsx +0 -32
  81. package/src/Pages/GlobalConfigurations/BuildInfra/Descriptor.tsx +0 -45
  82. package/src/Pages/GlobalConfigurations/BuildInfra/Footer.tsx +0 -56
  83. package/src/Pages/GlobalConfigurations/BuildInfra/Readme.md +0 -4
  84. package/src/Pages/GlobalConfigurations/BuildInfra/constants.tsx +0 -139
  85. package/src/Pages/GlobalConfigurations/BuildInfra/index.ts +0 -7
  86. package/src/Pages/GlobalConfigurations/BuildInfra/services.tsx +0 -167
  87. package/src/Pages/GlobalConfigurations/BuildInfra/types.tsx +0 -339
  88. package/src/Pages/GlobalConfigurations/BuildInfra/utils.tsx +0 -507
  89. package/src/Shared/Components/APIResponseHandler/APIResponseHandler.tsx +0 -41
  90. package/src/Shared/Components/APIResponseHandler/constants.tsx +0 -5
  91. package/src/Shared/Components/APIResponseHandler/index.ts +0 -2
  92. package/src/Shared/Components/APIResponseHandler/types.tsx +0 -39
  93. package/src/Shared/Components/ReactSelect/index.ts +0 -1
  94. package/src/Shared/Components/ReactSelect/utils.tsx +0 -97
  95. package/src/Shared/Helpers.tsx +0 -29
  96. package/src/Shared/validations.tsx +0 -130
@@ -21,7 +21,6 @@ export declare const ROUTES: {
21
21
  IMAGE_TAGGING: string;
22
22
  CD_MATERIAL_GET: string;
23
23
  DEPLOYMENT_TEMPLATE_LIST: string;
24
- INFRA_CONFIG_PROFILE: string;
25
24
  };
26
25
  export declare enum KEY_VALUE {
27
26
  KEY = "key",
@@ -74,3 +73,17 @@ export declare const SELECTED_APPROVAL_TAB_STATE: {
74
73
  APPROVAL: string;
75
74
  PENDING: string;
76
75
  };
76
+ export declare enum SortingOrder {
77
+ /**
78
+ * Ascending order
79
+ */
80
+ ASC = "ASC",
81
+ /**
82
+ * Descending order
83
+ */
84
+ DESC = "DESC"
85
+ }
86
+ /**
87
+ * Base page size for pagination
88
+ */
89
+ export declare const DEFAULT_BASE_PAGE_SIZE = 20;
@@ -5,7 +5,10 @@ export declare enum DraggablePositionVariant {
5
5
  }
6
6
  export interface DraggableWrapperProps {
7
7
  children: ReactNode;
8
- zIndex?: number;
8
+ /**
9
+ * Support for passing the direct value or calc functions as well
10
+ */
11
+ zIndex?: number | string;
9
12
  positionVariant?: DraggablePositionVariant;
10
13
  /**
11
14
  * dragSelector (class - (append with .), id, etc) will be used to identify the grabbable button that will grab the div to drag
@@ -1,3 +1,4 @@
1
1
  export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin';
2
2
  export { useClickOutside } from './UseClickOutside/UseClickOutside';
3
3
  export { useWindowSize } from './UseWindowSize/UseWindowSize';
4
+ export * from './useUrlFilters';
@@ -0,0 +1,8 @@
1
+ export declare const DEFAULT_PAGE_NUMBER = 1;
2
+ export declare const URL_FILTER_KEYS: {
3
+ readonly PAGE_SIZE: "pageSize";
4
+ readonly PAGE_NUMBER: "pageNumber";
5
+ readonly SEARCH_KEY: "searchKey";
6
+ readonly SORT_BY: "sortBy";
7
+ readonly SORT_ORDER: "sortOrder";
8
+ };
@@ -0,0 +1,2 @@
1
+ export { default as useUrlFilters } from './useUrlFilters';
2
+ export type { UseUrlFiltersProps, UseUrlFiltersReturnType } from './types';
@@ -0,0 +1,19 @@
1
+ import { SortingOrder } from '../../Constants';
2
+ export interface UseUrlFiltersProps<T> {
3
+ /**
4
+ * The key on which the sorting should be applied
5
+ */
6
+ initialSortKey?: T;
7
+ }
8
+ export interface UseUrlFiltersReturnType<T> {
9
+ pageSize: number;
10
+ changePage: (pageNumber: number) => void;
11
+ changePageSize: (pageSize: number) => void;
12
+ searchKey: string;
13
+ handleSearch: (searchKey: string) => void;
14
+ offset: number;
15
+ sortBy: T;
16
+ sortOrder: SortingOrder;
17
+ handleSorting: (sortBy: T) => void;
18
+ clearFilters: () => void;
19
+ }
@@ -0,0 +1,20 @@
1
+ import { UseUrlFiltersProps, UseUrlFiltersReturnType } from './types';
2
+ /**
3
+ * Generic hook for implementing URL based filters.
4
+ * eg: pagination, search, sort.
5
+ *
6
+ * The exposed handlers can be consumed directly without the need for explicit state management
7
+ *
8
+ * @example Default Usage:
9
+ * ```tsx
10
+ * const { pageSize, changePage, ...rest } = useUrlFilters()
11
+ * ```
12
+ *
13
+ * @example Usage with custom type for sort keys and initial sort key:
14
+ * ```tsx
15
+ * const { sortBy, sortOrder } = useUrlFilters<'email' | 'name'>({ initialSortKey: 'email' })
16
+ * ```
17
+ *
18
+ */
19
+ declare const useUrlFilters: <T = string>({ initialSortKey }?: UseUrlFiltersProps<T>) => UseUrlFiltersReturnType<T>;
20
+ export default useUrlFilters;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { SortableTableHeaderCellProps } from './types';
3
+ /**
4
+ * Reusable component for the table header cell with support for sorting icons
5
+ *
6
+ * @example Usage
7
+ * ```tsx
8
+ * <SortableTableHeaderCell
9
+ * isSorted={currentSortedCell === 'cell'}
10
+ * triggerSorting={() => {}}
11
+ * sortOrder={SortingOrder.ASC}
12
+ * title="Header Cell"
13
+ * disabled={isDisabled}
14
+ * />
15
+ * ```
16
+ */
17
+ declare const SortableTableHeaderCell: ({ isSorted, triggerSorting, sortOrder, title, disabled, }: SortableTableHeaderCellProps) => JSX.Element;
18
+ export default SortableTableHeaderCell;
@@ -0,0 +1,2 @@
1
+ export { default as SortableTableHeaderCell } from './SortableTableHeaderCell';
2
+ export type { SortableTableHeaderCellProps } from './types';
@@ -0,0 +1,25 @@
1
+ import { SortingOrder } from '../Constants';
2
+ export interface SortableTableHeaderCellProps {
3
+ /**
4
+ * If true, the cell is sorted
5
+ */
6
+ isSorted: boolean;
7
+ /**
8
+ * Callback for handling the sorting of the cell
9
+ */
10
+ triggerSorting: () => void;
11
+ /**
12
+ * Current sort order
13
+ *
14
+ * Note: On click, the sort order should be updated as required
15
+ */
16
+ sortOrder: SortingOrder;
17
+ /**
18
+ * Label for the cell
19
+ */
20
+ title: string;
21
+ /**
22
+ * If true, the cell is disabled
23
+ */
24
+ disabled: boolean;
25
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode, CSSProperties } from 'react';
2
2
  import { Placement } from 'tippy.js';
3
3
  import { ImageComment, ReleaseTag } from './ImageTags.Types';
4
- import { DockerConfigOverrideType, TaskErrorObj } from '.';
4
+ import { DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.';
5
5
  /**
6
6
  * Generic response type object with support for overriding the result type
7
7
  *
@@ -689,4 +689,16 @@ export interface EdgeNodeType {
689
689
  export interface EdgeEndNodeType extends EdgeNodeType {
690
690
  userApprovalConfig?: UserApprovalConfigType;
691
691
  }
692
+ /**
693
+ * Search params for sorting configuration
694
+ *
695
+ * Note: Either both sortOrder and sortBy are required or none
696
+ */
697
+ export type SortingParams<T = string> = {
698
+ sortOrder: SortingOrder;
699
+ sortBy: T;
700
+ } | {
701
+ sortOrder?: never;
702
+ sortBy?: never;
703
+ };
692
704
  export {};
@@ -27,6 +27,7 @@ export * from './Checkbox';
27
27
  export { default as EmptyState } from './EmptyState/EmptyState';
28
28
  export { default as GenericEmptyState } from './EmptyState/GenericEmptyState';
29
29
  export * from './SearchBar';
30
+ export * from './SortableTableHeaderCell';
30
31
  export { default as Toggle } from './Toggle/Toggle';
31
32
  export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable';
32
33
  export { default as StyledRadioGroup } from './RadioGroup/RadioGroup';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * User Status received from the API
3
+ */
4
+ export declare enum UserStatusDto {
5
+ active = "active",
6
+ inactive = "inactive"
7
+ }
8
+ /**
9
+ * User status for the frontend
10
+ */
11
+ export declare enum UserStatus {
12
+ active = "active",
13
+ inactive = "inactive",
14
+ temporary = "temporaryAccess"
15
+ }
@@ -0,0 +1 @@
1
+ export * from './constants';
@@ -1 +1 @@
1
- export * from './BuildInfra';
1
+ export * from './Authorization';
@@ -7,4 +7,3 @@ export declare const BulkSelectionOptionsLabels: {
7
7
  export declare const SELECT_ALL_ACROSS_PAGES_LOCATOR: "*";
8
8
  export declare const getInvalidActionMessage: (action: string) => string;
9
9
  export declare const BULK_SELECTION_CONTEXT_ERROR = "useBulkSelection must be used within BulkSelectionContext";
10
- export declare const CLEAR_SELECTIONS_WARNING = "Selections on other pages are cleared";
@@ -23,6 +23,8 @@ export interface GetBulkSelectionCheckboxValuesType {
23
23
  export interface UseBulkSelectionReturnType<T> extends GetBulkSelectionCheckboxValuesType {
24
24
  selectedIdentifiers: T;
25
25
  handleBulkSelection: ({ action, data }: HandleBulkSelectionType<T>) => void;
26
+ isBulkSelectionApplied: boolean;
27
+ getSelectedIdentifiersCount: () => number;
26
28
  }
27
29
  export interface BulkSelectionProps {
28
30
  showPagination: boolean;
@@ -1,3 +1 @@
1
- export * from './APIResponseHandler';
2
- export * from './ReactSelect';
3
1
  export * from './BulkSelection';
@@ -1,3 +1 @@
1
1
  export * from './Components';
2
- export * from './validations';
3
- export * from './Helpers';