@devtron-labs/devtron-fe-common-lib 0.0.61-beta-6 → 0.0.61-beta-8

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 (95) 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/Helper.d.ts +1 -4
  4. package/dist/Common/Hooks/index.d.ts +1 -0
  5. package/dist/Common/Hooks/useUrlFilters/constants.d.ts +8 -0
  6. package/dist/Common/Hooks/useUrlFilters/index.d.ts +2 -0
  7. package/dist/Common/Hooks/useUrlFilters/types.d.ts +19 -0
  8. package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +20 -0
  9. package/dist/Common/SortableTableHeaderCell/SortableTableHeaderCell.d.ts +18 -0
  10. package/dist/Common/SortableTableHeaderCell/index.d.ts +2 -0
  11. package/dist/Common/SortableTableHeaderCell/types.d.ts +25 -0
  12. package/dist/Common/Types.d.ts +13 -1
  13. package/dist/Common/index.d.ts +1 -0
  14. package/dist/Pages/GlobalConfigurations/Authorization/constants.d.ts +15 -0
  15. package/dist/Pages/GlobalConfigurations/Authorization/index.d.ts +1 -0
  16. package/dist/Pages/GlobalConfigurations/index.d.ts +1 -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 +385 -1186
  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 +24 -31
  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 +16 -5
  49. package/src/Shared/Components/BulkSelection/types.tsx +2 -0
  50. package/src/Shared/Components/index.ts +0 -2
  51. package/src/Shared/index.ts +0 -2
  52. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.d.ts +0 -4
  53. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.d.ts +0 -4
  54. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.d.ts +0 -7
  55. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.d.ts +0 -4
  56. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.d.ts +0 -4
  57. package/dist/Pages/GlobalConfigurations/BuildInfra/Descriptor.d.ts +0 -4
  58. package/dist/Pages/GlobalConfigurations/BuildInfra/Footer.d.ts +0 -4
  59. package/dist/Pages/GlobalConfigurations/BuildInfra/constants.d.ts +0 -50
  60. package/dist/Pages/GlobalConfigurations/BuildInfra/index.d.ts +0 -7
  61. package/dist/Pages/GlobalConfigurations/BuildInfra/services.d.ts +0 -6
  62. package/dist/Pages/GlobalConfigurations/BuildInfra/types.d.ts +0 -286
  63. package/dist/Pages/GlobalConfigurations/BuildInfra/utils.d.ts +0 -12
  64. package/dist/Shared/Components/APIResponseHandler/APIResponseHandler.d.ts +0 -4
  65. package/dist/Shared/Components/APIResponseHandler/constants.d.ts +0 -4
  66. package/dist/Shared/Components/APIResponseHandler/index.d.ts +0 -2
  67. package/dist/Shared/Components/APIResponseHandler/types.d.ts +0 -37
  68. package/dist/Shared/Components/ReactSelect/index.d.ts +0 -1
  69. package/dist/Shared/Components/ReactSelect/utils.d.ts +0 -12
  70. package/dist/Shared/Helpers.d.ts +0 -16
  71. package/dist/Shared/validations.d.ts +0 -8
  72. package/src/Assets/Icon/ic-cpu.svg +0 -4
  73. package/src/Assets/Icon/ic-memory.svg +0 -3
  74. package/src/Assets/Icon/ic-timer.svg +0 -3
  75. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.tsx +0 -128
  76. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.tsx +0 -44
  77. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.tsx +0 -106
  78. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.tsx +0 -55
  79. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.tsx +0 -32
  80. package/src/Pages/GlobalConfigurations/BuildInfra/Descriptor.tsx +0 -45
  81. package/src/Pages/GlobalConfigurations/BuildInfra/Footer.tsx +0 -56
  82. package/src/Pages/GlobalConfigurations/BuildInfra/Readme.md +0 -4
  83. package/src/Pages/GlobalConfigurations/BuildInfra/constants.tsx +0 -139
  84. package/src/Pages/GlobalConfigurations/BuildInfra/index.ts +0 -7
  85. package/src/Pages/GlobalConfigurations/BuildInfra/services.tsx +0 -167
  86. package/src/Pages/GlobalConfigurations/BuildInfra/types.tsx +0 -339
  87. package/src/Pages/GlobalConfigurations/BuildInfra/utils.tsx +0 -507
  88. package/src/Shared/Components/APIResponseHandler/APIResponseHandler.tsx +0 -41
  89. package/src/Shared/Components/APIResponseHandler/constants.tsx +0 -5
  90. package/src/Shared/Components/APIResponseHandler/index.ts +0 -2
  91. package/src/Shared/Components/APIResponseHandler/types.tsx +0 -39
  92. package/src/Shared/Components/ReactSelect/index.ts +0 -1
  93. package/src/Shared/Components/ReactSelect/utils.tsx +0 -97
  94. package/src/Shared/Helpers.tsx +0 -29
  95. package/src/Shared/validations.tsx +0 -130
@@ -1,29 +0,0 @@
1
- interface HighlightSearchTextProps {
2
- /**
3
- * The text to be highlighted
4
- */
5
- searchText: string
6
- /**
7
- * The whole text string
8
- */
9
- text: string
10
- /**
11
- * The classes to be applied to the highlighted text
12
- */
13
- highlightClasses?: string
14
- }
15
-
16
- // Disabling default export since this is a helper function and we would have to export a lot of functions in future.
17
- // eslint-disable-next-line import/prefer-default-export
18
- export const highlightSearchText = ({ searchText, text, highlightClasses }: HighlightSearchTextProps): string => {
19
- if (!searchText) {
20
- return text
21
- }
22
-
23
- try {
24
- const regex = new RegExp(searchText, 'gi')
25
- return text.replace(regex, (match) => `<span class="${highlightClasses}">${match}</span>`)
26
- } catch (error) {
27
- return text
28
- }
29
- }
@@ -1,130 +0,0 @@
1
- export interface ValidationResponseType {
2
- isValid: boolean
3
- message?: string
4
- }
5
-
6
- const MESSAGES = {
7
- PROVIDE_A_NUMBER: 'Please provide a number',
8
- LOWERCASE_ALPHANUMERIC: 'Only lowercase alphanumeric characters, -, _ or . allowed',
9
- CAN_NOT_START_END_WITH_SEPARATORS: 'Cannot start/end with -, _ or .',
10
- getMinMaxCharMessage: (min: number, max: number) => `Minimum ${min} and maximum ${max} characters allowed`,
11
- getMaxCharMessage: (max: number) => `Maximum ${max} characters are allowed`,
12
- VALID_POSITIVE_NUMBER: 'This field should be a valid positive number',
13
- VALID_POSITIVE_INTEGER: 'This field should be a valid positive integer',
14
- MAX_SAFE_INTEGER: `Maximum allowed value is ${Number.MAX_SAFE_INTEGER}`,
15
- }
16
-
17
- const MAX_DESCRIPTION_LENGTH = 300
18
-
19
- export const validateName = (name: string): ValidationResponseType => {
20
- if (!/^.{3,50}$/.test(name)) {
21
- return {
22
- isValid: false,
23
- message: MESSAGES.getMinMaxCharMessage(3, 50),
24
- }
25
- }
26
-
27
- if (!/^[a-z0-9-._]+$/.test(name)) {
28
- return {
29
- isValid: false,
30
- message: MESSAGES.LOWERCASE_ALPHANUMERIC,
31
- }
32
- }
33
-
34
- if (!/^(?![-._]).*[^-._]$/.test(name)) {
35
- return {
36
- isValid: false,
37
- message: MESSAGES.CAN_NOT_START_END_WITH_SEPARATORS,
38
- }
39
- }
40
-
41
- return {
42
- isValid: true,
43
- }
44
- }
45
-
46
- export const validateDescription = (description: string): ValidationResponseType => {
47
- if (description?.length > MAX_DESCRIPTION_LENGTH) {
48
- return {
49
- isValid: false,
50
- message: MESSAGES.getMaxCharMessage(MAX_DESCRIPTION_LENGTH),
51
- }
52
- }
53
-
54
- return {
55
- isValid: true,
56
- }
57
- }
58
-
59
- export const validateRequiredPositiveNumber = (value: string | number): ValidationResponseType => {
60
- if (!value) {
61
- return {
62
- isValid: false,
63
- message: MESSAGES.PROVIDE_A_NUMBER,
64
- }
65
- }
66
-
67
- // TODO: Look if regex is available for this, since 0002 is not a valid number
68
- if (!/^\d+(\.\d+)?$/.test(value.toString())) {
69
- return {
70
- isValid: false,
71
- message: MESSAGES.VALID_POSITIVE_NUMBER,
72
- }
73
- }
74
-
75
- const numericValue = Number(value)
76
-
77
- if (numericValue > Number.MAX_SAFE_INTEGER) {
78
- return {
79
- isValid: false,
80
- message: MESSAGES.MAX_SAFE_INTEGER,
81
- }
82
- }
83
-
84
- if (numericValue <= 0) {
85
- return {
86
- isValid: false,
87
- message: MESSAGES.VALID_POSITIVE_NUMBER,
88
- }
89
- }
90
-
91
- return {
92
- isValid: true,
93
- }
94
- }
95
-
96
- export const validateRequiredPositiveInteger = (value: string | number): ValidationResponseType => {
97
- if (!value) {
98
- return {
99
- isValid: false,
100
- message: MESSAGES.PROVIDE_A_NUMBER,
101
- }
102
- }
103
-
104
- if (!/^\d+$/.test(value.toString())) {
105
- return {
106
- isValid: false,
107
- message: MESSAGES.VALID_POSITIVE_INTEGER,
108
- }
109
- }
110
-
111
- const numericValue = Number(value)
112
-
113
- if (numericValue > Number.MAX_SAFE_INTEGER) {
114
- return {
115
- isValid: false,
116
- message: MESSAGES.MAX_SAFE_INTEGER,
117
- }
118
- }
119
-
120
- if (numericValue <= 0) {
121
- return {
122
- isValid: false,
123
- message: MESSAGES.VALID_POSITIVE_INTEGER,
124
- }
125
- }
126
-
127
- return {
128
- isValid: true,
129
- }
130
- }