@reltio/dashboard 1.4.1584 → 1.4.1586-mui5

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 (263) hide show
  1. package/.DS_Store +0 -0
  2. package/index.ts +12 -0
  3. package/package.json +42 -25
  4. package/public/bundle.js +205 -0
  5. package/public/bundle.js.LICENSE.txt +59 -0
  6. package/public/package.json +26 -0
  7. package/public/types/components/DashboardConfigItem/styles.d.ts +1 -0
  8. package/{types → public/types}/components/DashboardError/styles.d.ts +1 -1
  9. package/public/types/components/DashboardLayout/styles.d.ts +1 -0
  10. package/public/types/components/DashboardLayoutItem/styles.d.ts +1 -0
  11. package/public/types/components/DashboardLayoutPanel/styles.d.ts +1 -0
  12. package/public/types/components/DashboardLinearLoader/styles.d.ts +1 -0
  13. package/{types → public/types}/components/DashboardNoData/styles.d.ts +1 -1
  14. package/public/types/components/DashboardPerspectiveHeader/styles.d.ts +2 -0
  15. package/{types → public/types}/components/DashboardPopupMenu/DashboardPopupMenu.d.ts +1 -1
  16. package/public/types/components/DashboardPopupMenu/styles.d.ts +1 -0
  17. package/public/types/components/EntityTable/cell-renderers/styles.d.ts +1 -0
  18. package/{types → public/types}/components/EntityTable/styles.d.ts +1 -1
  19. package/public/types/components/LayoutItemContent/styles.d.ts +1 -0
  20. package/public/types/components/LayoutItemHeader/styles.d.ts +1 -0
  21. package/public/types/components/LayoutItemView/styles.d.ts +1 -0
  22. package/public/types/components/StatsChart/customized/styles.d.ts +1 -0
  23. package/public/types/components/WorkflowTaskItem/styles.d.ts +1 -0
  24. package/public/types/perspective/styles.d.ts +1 -0
  25. package/public/types/views/chartBased/styles.d.ts +1 -0
  26. package/public/types/views/custom/styles.d.ts +1 -0
  27. package/public/types/views/tableBased/styles.d.ts +1 -0
  28. package/scripts/build/index.js +21 -0
  29. package/src/HOCs/withPagination.tsx +39 -0
  30. package/src/components/DashboardConfigItem/DashboardConfigItem.tsx +101 -0
  31. package/src/components/DashboardConfigItem/__tests__/DashboardConfigItem.specs.tsx +81 -0
  32. package/src/components/DashboardConfigItem/icons/barChart.svg +12 -0
  33. package/src/components/DashboardConfigItem/icons/bubbleChart.svg +18 -0
  34. package/src/components/DashboardConfigItem/icons/customChart.svg +66 -0
  35. package/src/components/DashboardConfigItem/icons/donutChart.svg +33 -0
  36. package/src/components/DashboardConfigItem/icons/geomap.svg +23 -0
  37. package/src/components/DashboardConfigItem/icons/lineChart.svg +16 -0
  38. package/src/components/DashboardConfigItem/icons/pieChart.svg +27 -0
  39. package/src/components/DashboardConfigItem/icons/tableWithBars.svg +27 -0
  40. package/src/components/DashboardConfigItem/icons/treemap.svg +15 -0
  41. package/src/components/DashboardConfigItem/icons/wordCloud.svg +27 -0
  42. package/src/components/DashboardConfigItem/styles.ts +56 -0
  43. package/src/components/DashboardError/DashboardError.tsx +34 -0
  44. package/src/components/DashboardError/__tests__/DashboardError.test.js +34 -0
  45. package/src/components/DashboardError/icons/error.svg +113 -0
  46. package/src/components/DashboardError/styles.ts +30 -0
  47. package/src/components/DashboardLayout/DashboardLayout.tsx +59 -0
  48. package/src/components/DashboardLayout/__tests__/DashboardLayout.specs.tsx +56 -0
  49. package/src/components/DashboardLayout/styles.ts +30 -0
  50. package/src/components/DashboardLayoutItem/DashboardLayoutItem.tsx +59 -0
  51. package/src/components/DashboardLayoutItem/__tests__/DashboardLayoutItem.specs.tsx +145 -0
  52. package/src/components/DashboardLayoutItem/styles.ts +10 -0
  53. package/src/components/DashboardLayoutPanel/DashboardLayoutPanel.tsx +59 -0
  54. package/src/components/DashboardLayoutPanel/__tests__/DashboardLayoutPanel.specs.tsx +58 -0
  55. package/src/components/DashboardLayoutPanel/styles.ts +43 -0
  56. package/src/components/DashboardLinearLoader/DashboardLinearLoader.tsx +10 -0
  57. package/src/components/DashboardLinearLoader/__tests__/DashboardLinearLoader.test.js +12 -0
  58. package/src/components/DashboardLinearLoader/styles.ts +11 -0
  59. package/src/components/DashboardNoData/.DS_Store +0 -0
  60. package/src/components/DashboardNoData/DashboardNoData.tsx +21 -0
  61. package/src/components/DashboardNoData/__tests__/DashboardNoData.test.js +15 -0
  62. package/src/components/DashboardNoData/icons/noData.svg +68 -0
  63. package/src/components/DashboardNoData/styles.ts +21 -0
  64. package/src/components/DashboardPerspectiveHeader/DashboardPerspectiveHeader.tsx +43 -0
  65. package/src/components/DashboardPerspectiveHeader/__tests__/DashboardPerspectiveHeader.specs.tsx +41 -0
  66. package/src/components/DashboardPerspectiveHeader/styles.ts +24 -0
  67. package/src/components/DashboardPopupMenu/DashboardPopupMenu.tsx +75 -0
  68. package/src/components/DashboardPopupMenu/__tests__/DashboardPopupMenu.test.tsx +51 -0
  69. package/src/components/DashboardPopupMenu/styles.ts +20 -0
  70. package/src/components/EntityTable/EntityTable.tsx +49 -0
  71. package/src/components/EntityTable/__tests__/EntityTable.test.tsx +33 -0
  72. package/src/components/EntityTable/cell-renderers/EntityLabelRenderer.tsx +24 -0
  73. package/src/components/EntityTable/cell-renderers/HeadCellRenderer.tsx +34 -0
  74. package/src/components/EntityTable/cell-renderers/__tests__/EntityLabelRenderer.test.tsx +25 -0
  75. package/src/components/EntityTable/cell-renderers/styles.ts +46 -0
  76. package/src/components/EntityTable/styles.ts +19 -0
  77. package/src/components/LayoutItemContent/LayoutItemContent.tsx +63 -0
  78. package/src/components/LayoutItemContent/__tests__/LayoutItemContent.test.tsx +71 -0
  79. package/src/components/LayoutItemContent/styles.ts +36 -0
  80. package/src/components/LayoutItemHeader/LayoutItemHeader.tsx +86 -0
  81. package/src/components/LayoutItemHeader/__tests__/LayoutItemHeader.specs.tsx +48 -0
  82. package/src/components/LayoutItemHeader/styles.ts +44 -0
  83. package/src/components/LayoutItemView/LayoutItemView.tsx +24 -0
  84. package/src/components/LayoutItemView/styles.ts +11 -0
  85. package/src/components/StatsChart/StatsChart.tsx +77 -0
  86. package/src/components/StatsChart/__tests__/StatsChart.test.tsx +106 -0
  87. package/src/components/StatsChart/customized/CustomAxisTick.tsx +28 -0
  88. package/src/components/StatsChart/customized/CustomLegend.tsx +37 -0
  89. package/src/components/StatsChart/customized/CustomTooltip.tsx +41 -0
  90. package/src/components/StatsChart/customized/styles.ts +53 -0
  91. package/src/components/StatsChart/getStatsChartSettings.ts +65 -0
  92. package/src/components/WorkflowTaskItem/WorkflowTaskItem.tsx +67 -0
  93. package/src/components/WorkflowTaskItem/WorkflowTaskObject.tsx +54 -0
  94. package/src/components/WorkflowTaskItem/__tests__/WorkflowTaskItem.test.tsx +73 -0
  95. package/src/components/WorkflowTaskItem/__tests__/WorkflowTaskObject.test.tsx +95 -0
  96. package/src/components/WorkflowTaskItem/styles.ts +74 -0
  97. package/src/components/WorkflowTasksList/WorkflowTasksList.tsx +34 -0
  98. package/src/components/WorkflowTasksList/__tests__/WorkflowTasksList.test.tsx +98 -0
  99. package/src/components/index.ts +8 -0
  100. package/src/contexts/DashboardViewIdContext/index.ts +5 -0
  101. package/src/hooks/__tests__/useActivititesRequest.specs.tsx +106 -0
  102. package/src/hooks/__tests__/useEntityByTypeRequest.specs.tsx +280 -0
  103. package/src/hooks/__tests__/useFacetRequest.specs.tsx +437 -0
  104. package/src/hooks/__tests__/useFilteredEntitiesRequest.specs.tsx +103 -0
  105. package/src/hooks/__tests__/useSavedSearchesRequest.specs.tsx +201 -0
  106. package/src/hooks/__tests__/useStatsRequest.specs.tsx +212 -0
  107. package/src/hooks/__tests__/useWorkflowTasksRequest.specs.tsx +388 -0
  108. package/src/hooks/useActivitiesRequest.ts +50 -0
  109. package/src/hooks/useEntityByTypeRequest.ts +67 -0
  110. package/src/hooks/useFacetRequest.ts +117 -0
  111. package/src/hooks/useFilteredEntitiesRequest.ts +57 -0
  112. package/src/hooks/useSavedSearchesRequest.ts +82 -0
  113. package/src/hooks/useStatsRequest.ts +47 -0
  114. package/src/hooks/useWorkflowTasksRequest.ts +66 -0
  115. package/src/index.ts +25 -0
  116. package/src/perspective/DashboardPerspectiveView.tsx +132 -0
  117. package/src/perspective/__tests__/DashboardPerspectiveView.specs.tsx +276 -0
  118. package/src/perspective/__tests__/data/metadata.data.ts +33 -0
  119. package/src/perspective/__tests__/data/store.data.ts +15 -0
  120. package/src/perspective/__tests__/helpers.specs.ts +33 -0
  121. package/src/perspective/helpers.ts +19 -0
  122. package/src/perspective/index.tsx +65 -0
  123. package/src/perspective/styles.ts +16 -0
  124. package/src/services/__tests__/facets.specs.ts +42 -0
  125. package/src/services/__tests__/filters.specs.ts +60 -0
  126. package/src/services/__tests__/period.test.ts +33 -0
  127. package/src/services/__tests__/stats.test.ts +319 -0
  128. package/src/services/entityTypes.ts +66 -0
  129. package/src/services/facets.ts +178 -0
  130. package/src/services/filters.ts +87 -0
  131. package/src/services/period.ts +33 -0
  132. package/src/services/savedSearches.ts +20 -0
  133. package/src/services/stats.ts +191 -0
  134. package/src/services/workflowTasks.ts +116 -0
  135. package/src/types/ActivitiesViewFacetConfig.ts +5 -0
  136. package/src/types/CustomActionViewFacetConfig.ts +5 -0
  137. package/src/types/DashboardPerspectiveConfig.ts +18 -0
  138. package/src/types/DashboardSavedState.ts +7 -0
  139. package/src/types/EntityByTypeViewFacetConfig.ts +7 -0
  140. package/src/types/EntityData.ts +4 -0
  141. package/src/types/FilteredEntitiesFacetConfig.ts +6 -0
  142. package/src/types/FilteredSavedSearchesFacetConfig.ts +6 -0
  143. package/src/types/PeriodStep.ts +4 -0
  144. package/src/types/SavedSearchData.ts +6 -0
  145. package/src/types/SearchOptions.ts +10 -0
  146. package/src/types/StatsData.ts +14 -0
  147. package/src/types/WorkflowTasks.ts +26 -0
  148. package/src/types/index.ts +14 -0
  149. package/src/views/ViewsFactory.tsx +79 -0
  150. package/src/views/__tests__/ViewsFactory.specs.tsx +70 -0
  151. package/src/views/chartBased/DashboardFacet.tsx +71 -0
  152. package/src/views/chartBased/EntitiesByTypeViewFacet.tsx +60 -0
  153. package/src/views/chartBased/ProfileStatsFacet.tsx +54 -0
  154. package/src/views/chartBased/__tests__/DashboardFacet.specs.tsx +358 -0
  155. package/src/views/chartBased/__tests__/EntitiesByTypeViewFacet.specs.tsx +101 -0
  156. package/src/views/chartBased/__tests__/ProfileStatsFacet.specs.tsx +106 -0
  157. package/src/views/chartBased/styles.ts +13 -0
  158. package/src/views/custom/CustomActionViewFacet.tsx +36 -0
  159. package/src/views/custom/NotificationInboxFacet.tsx +86 -0
  160. package/src/views/custom/__tests__/CustomActionViewFacet.specs.tsx +35 -0
  161. package/src/views/custom/__tests__/NotificationInboxFacet.specs.tsx +144 -0
  162. package/src/views/custom/styles.ts +31 -0
  163. package/src/views/tableBased/ActivitiesViewFacet.tsx +79 -0
  164. package/src/views/tableBased/FilteredEntitiesViewFacet.tsx +67 -0
  165. package/src/views/tableBased/FilteredSavedSearchesFacet.tsx +85 -0
  166. package/src/views/tableBased/__tests__/ActivitiesViewFacet.specs.tsx +113 -0
  167. package/src/views/tableBased/__tests__/FIlteredEntitiesViewFacet.specs.tsx +90 -0
  168. package/src/views/tableBased/__tests__/FilteredSavedSearchesFacet.specs.tsx +133 -0
  169. package/src/views/tableBased/helpers.ts +8 -0
  170. package/src/views/tableBased/styles.ts +7 -0
  171. package/stories/Dashboards.stories.js +118 -0
  172. package/stories/utils/dashboardPerspectiveConfig.js +78 -0
  173. package/stories/utils/dashboardsViewConfig.js +17 -0
  174. package/stories/utils/mdmStore.js +73 -0
  175. package/stories/utils/responses.js +10 -0
  176. package/tsconfig.json +14 -0
  177. package/webpack.config.js +10 -0
  178. package/bundle.js +0 -2
  179. package/bundle.js.LICENSE.txt +0 -22
  180. package/types/components/DashboardConfigItem/styles.d.ts +0 -1
  181. package/types/components/DashboardLayout/styles.d.ts +0 -1
  182. package/types/components/DashboardLayoutItem/styles.d.ts +0 -1
  183. package/types/components/DashboardLayoutPanel/styles.d.ts +0 -1
  184. package/types/components/DashboardLinearLoader/styles.d.ts +0 -1
  185. package/types/components/DashboardPerspectiveHeader/styles.d.ts +0 -2
  186. package/types/components/DashboardPopupMenu/styles.d.ts +0 -1
  187. package/types/components/EntityTable/cell-renderers/styles.d.ts +0 -1
  188. package/types/components/LayoutItemContent/styles.d.ts +0 -1
  189. package/types/components/LayoutItemHeader/styles.d.ts +0 -1
  190. package/types/components/LayoutItemView/styles.d.ts +0 -1
  191. package/types/components/StatsChart/customized/styles.d.ts +0 -1
  192. package/types/components/WorkflowTaskItem/styles.d.ts +0 -1
  193. package/types/perspective/styles.d.ts +0 -1
  194. package/types/views/chartBased/styles.d.ts +0 -1
  195. package/types/views/custom/styles.d.ts +0 -1
  196. package/types/views/tableBased/styles.d.ts +0 -1
  197. /package/{types → public/types}/HOCs/withPagination.d.ts +0 -0
  198. /package/{types → public/types}/components/DashboardConfigItem/DashboardConfigItem.d.ts +0 -0
  199. /package/{types → public/types}/components/DashboardError/DashboardError.d.ts +0 -0
  200. /package/{types → public/types}/components/DashboardLayout/DashboardLayout.d.ts +0 -0
  201. /package/{types → public/types}/components/DashboardLayoutItem/DashboardLayoutItem.d.ts +0 -0
  202. /package/{types → public/types}/components/DashboardLayoutPanel/DashboardLayoutPanel.d.ts +0 -0
  203. /package/{types → public/types}/components/DashboardLinearLoader/DashboardLinearLoader.d.ts +0 -0
  204. /package/{types → public/types}/components/DashboardNoData/DashboardNoData.d.ts +0 -0
  205. /package/{types → public/types}/components/DashboardPerspectiveHeader/DashboardPerspectiveHeader.d.ts +0 -0
  206. /package/{types → public/types}/components/EntityTable/EntityTable.d.ts +0 -0
  207. /package/{types → public/types}/components/EntityTable/cell-renderers/EntityLabelRenderer.d.ts +0 -0
  208. /package/{types → public/types}/components/EntityTable/cell-renderers/HeadCellRenderer.d.ts +0 -0
  209. /package/{types → public/types}/components/LayoutItemContent/LayoutItemContent.d.ts +0 -0
  210. /package/{types → public/types}/components/LayoutItemHeader/LayoutItemHeader.d.ts +0 -0
  211. /package/{types → public/types}/components/LayoutItemView/LayoutItemView.d.ts +0 -0
  212. /package/{types → public/types}/components/StatsChart/StatsChart.d.ts +0 -0
  213. /package/{types → public/types}/components/StatsChart/customized/CustomAxisTick.d.ts +0 -0
  214. /package/{types → public/types}/components/StatsChart/customized/CustomLegend.d.ts +0 -0
  215. /package/{types → public/types}/components/StatsChart/customized/CustomTooltip.d.ts +0 -0
  216. /package/{types → public/types}/components/StatsChart/getStatsChartSettings.d.ts +0 -0
  217. /package/{types → public/types}/components/WorkflowTaskItem/WorkflowTaskItem.d.ts +0 -0
  218. /package/{types → public/types}/components/WorkflowTaskItem/WorkflowTaskObject.d.ts +0 -0
  219. /package/{types → public/types}/components/WorkflowTasksList/WorkflowTasksList.d.ts +0 -0
  220. /package/{types → public/types}/components/index.d.ts +0 -0
  221. /package/{types → public/types}/contexts/DashboardViewIdContext/index.d.ts +0 -0
  222. /package/{types → public/types}/hooks/useActivitiesRequest.d.ts +0 -0
  223. /package/{types → public/types}/hooks/useEntityByTypeRequest.d.ts +0 -0
  224. /package/{types → public/types}/hooks/useFacetRequest.d.ts +0 -0
  225. /package/{types → public/types}/hooks/useFilteredEntitiesRequest.d.ts +0 -0
  226. /package/{types → public/types}/hooks/useSavedSearchesRequest.d.ts +0 -0
  227. /package/{types → public/types}/hooks/useStatsRequest.d.ts +0 -0
  228. /package/{types → public/types}/hooks/useWorkflowTasksRequest.d.ts +0 -0
  229. /package/{types → public/types}/index.d.ts +0 -0
  230. /package/{types → public/types}/perspective/DashboardPerspectiveView.d.ts +0 -0
  231. /package/{types → public/types}/perspective/helpers.d.ts +0 -0
  232. /package/{types → public/types}/perspective/index.d.ts +0 -0
  233. /package/{types → public/types}/services/entityTypes.d.ts +0 -0
  234. /package/{types → public/types}/services/facets.d.ts +0 -0
  235. /package/{types → public/types}/services/filters.d.ts +0 -0
  236. /package/{types → public/types}/services/period.d.ts +0 -0
  237. /package/{types → public/types}/services/savedSearches.d.ts +0 -0
  238. /package/{types → public/types}/services/stats.d.ts +0 -0
  239. /package/{types → public/types}/services/workflowTasks.d.ts +0 -0
  240. /package/{types → public/types}/types/ActivitiesViewFacetConfig.d.ts +0 -0
  241. /package/{types → public/types}/types/CustomActionViewFacetConfig.d.ts +0 -0
  242. /package/{types → public/types}/types/DashboardPerspectiveConfig.d.ts +0 -0
  243. /package/{types → public/types}/types/DashboardSavedState.d.ts +0 -0
  244. /package/{types → public/types}/types/EntityByTypeViewFacetConfig.d.ts +0 -0
  245. /package/{types → public/types}/types/EntityData.d.ts +0 -0
  246. /package/{types → public/types}/types/FilteredEntitiesFacetConfig.d.ts +0 -0
  247. /package/{types → public/types}/types/FilteredSavedSearchesFacetConfig.d.ts +0 -0
  248. /package/{types → public/types}/types/PeriodStep.d.ts +0 -0
  249. /package/{types → public/types}/types/SavedSearchData.d.ts +0 -0
  250. /package/{types → public/types}/types/SearchOptions.d.ts +0 -0
  251. /package/{types → public/types}/types/StatsData.d.ts +0 -0
  252. /package/{types → public/types}/types/WorkflowTasks.d.ts +0 -0
  253. /package/{types → public/types}/types/index.d.ts +0 -0
  254. /package/{types → public/types}/views/ViewsFactory.d.ts +0 -0
  255. /package/{types → public/types}/views/chartBased/DashboardFacet.d.ts +0 -0
  256. /package/{types → public/types}/views/chartBased/EntitiesByTypeViewFacet.d.ts +0 -0
  257. /package/{types → public/types}/views/chartBased/ProfileStatsFacet.d.ts +0 -0
  258. /package/{types → public/types}/views/custom/CustomActionViewFacet.d.ts +0 -0
  259. /package/{types → public/types}/views/custom/NotificationInboxFacet.d.ts +0 -0
  260. /package/{types → public/types}/views/tableBased/ActivitiesViewFacet.d.ts +0 -0
  261. /package/{types → public/types}/views/tableBased/FilteredEntitiesViewFacet.d.ts +0 -0
  262. /package/{types → public/types}/views/tableBased/FilteredSavedSearchesFacet.d.ts +0 -0
  263. /package/{types → public/types}/views/tableBased/helpers.d.ts +0 -0
@@ -0,0 +1,74 @@
1
+ import {makeStyles} from '@mui/styles';
2
+
3
+ export const useStyles = makeStyles((theme) => ({
4
+ taskItem: {
5
+ flex: 1,
6
+ display: 'flex',
7
+ padding: '15px',
8
+ color: theme.palette.text.primary,
9
+ '&.Low': {
10
+ borderLeft: '#F7F7F7 solid 3px'
11
+ },
12
+ '&.Medium': {
13
+ borderLeft: '#F7DE03 solid 3px'
14
+ },
15
+ '&.High': {
16
+ borderLeft: '#FF9800 solid 3px'
17
+ },
18
+ '&.Urgent': {
19
+ borderLeft: '#F44336 solid 3px'
20
+ }
21
+ },
22
+ taskInfo: {
23
+ flex: 1,
24
+ padding: '0 15px',
25
+ overflow: 'hidden',
26
+ overflowWrap: 'anywhere'
27
+ },
28
+ taskTitle: {
29
+ lineHeight: '18px',
30
+ marginBottom: '6px'
31
+ },
32
+ taskDetail: {
33
+ lineHeight: '15px',
34
+ fontSize: '12px',
35
+ margin: '5px 0'
36
+ },
37
+ taskDetailTitle: {
38
+ color: theme.palette.text.secondary,
39
+ marginRight: '3px'
40
+ },
41
+ taskDueDate: {
42
+ flex: '0 0 110px',
43
+ fontSize: '13px',
44
+ lineHeight: '15px',
45
+ textAlign: 'right',
46
+ paddingTop: '6px'
47
+ },
48
+ flag: {
49
+ height: '14px',
50
+ width: '14px',
51
+ stroke: 'rgba(0,0,0,.54)',
52
+ fill: 'none',
53
+ verticalAlign: 'text-top',
54
+ marginRight: '5px'
55
+ },
56
+ overdue: {
57
+ '&$taskDueDate': {
58
+ color: '#f44336'
59
+ },
60
+ '& $flag': {
61
+ stroke: '#f44336',
62
+ fill: '#f44336'
63
+ }
64
+ },
65
+ entityLabel: {
66
+ color: theme.palette.primary.main,
67
+ textDecoration: 'none',
68
+ fontSize: '13px',
69
+ lineHeight: '15px'
70
+ },
71
+ hidden: {
72
+ visibility: 'hidden'
73
+ }
74
+ }));
@@ -0,0 +1,34 @@
1
+ import React, {useCallback} from 'react';
2
+ import {WorkflowTasksCategories, EnrichedWorkflowTaskData} from '../../types/WorkflowTasks';
3
+ import {AutoSizeList} from '@reltio/components';
4
+ import WorkflowTaskItem from '../WorkflowTaskItem/WorkflowTaskItem';
5
+ import Divider from '@mui/material/Divider';
6
+
7
+ type Props = {
8
+ width: number;
9
+ height: number;
10
+ tasksCategory: WorkflowTasksCategories;
11
+ tasks: EnrichedWorkflowTaskData[];
12
+ };
13
+
14
+ const WorkflowTasksList = ({width, height, tasksCategory, tasks}: Props) => {
15
+ const renderRow = useCallback(
16
+ ({data, index}: {data: EnrichedWorkflowTaskData[]; index: number}) => {
17
+ return (
18
+ <div>
19
+ <WorkflowTaskItem task={data[index]} showAssignee={tasksCategory !== WorkflowTasksCategories.MY} />
20
+ <Divider light={true} variant={'inset'} />
21
+ </div>
22
+ );
23
+ },
24
+ [tasksCategory]
25
+ );
26
+
27
+ return (
28
+ <AutoSizeList width={width} height={height} data={tasks} defaultItemSize={115}>
29
+ {renderRow}
30
+ </AutoSizeList>
31
+ );
32
+ };
33
+
34
+ export default WorkflowTasksList;
@@ -0,0 +1,98 @@
1
+ import React from 'react';
2
+ import {shallow} from 'enzyme';
3
+ import {EnrichedWorkflowTaskData, WorkflowTasksCategories} from '../../../types/WorkflowTasks';
4
+ import WorkflowTasksList from '../WorkflowTasksList';
5
+ import {AutoSizeList} from '@reltio/components';
6
+
7
+ describe('WorkflowTasksList tests', () => {
8
+ it('should render list of MY tasks correctly', () => {
9
+ const props = {
10
+ tasksCategory: WorkflowTasksCategories.MY,
11
+ tasks: [
12
+ {
13
+ assignee: 'polina.arsenteva',
14
+ objectURIs: ['entities/1fIVXrYH'],
15
+ createdBy: 'sairam.singireesu@reltio.com',
16
+ priorityClass: 'Medium',
17
+ createTime: 1621534310502,
18
+ dueDate: 1621707110507,
19
+ displayName: 'Delete Review',
20
+ processDefinitionDisplayName: 'Recommend for Delete',
21
+ objects: [
22
+ {
23
+ uri: 'entities/1fIVXrYH',
24
+ type: 'configuration/entityTypes/HCO',
25
+ label: 'Belize'
26
+ }
27
+ ]
28
+ }
29
+ ] as EnrichedWorkflowTaskData[],
30
+ width: 500,
31
+ height: 500
32
+ };
33
+ const wrapper = shallow(<WorkflowTasksList {...props} />);
34
+ expect(wrapper.find(AutoSizeList).props()).toMatchObject({
35
+ width: props.width,
36
+ height: props.height,
37
+ data: props.tasks
38
+ });
39
+ const autoSizeListChildren = wrapper.find(AutoSizeList).prop('children') as ({
40
+ data,
41
+ index
42
+ }: {
43
+ data: EnrichedWorkflowTaskData[];
44
+ index: number;
45
+ }) => JSX.Element;
46
+ const firstRow = shallow(autoSizeListChildren({data: props.tasks, index: 0}));
47
+ expect(firstRow.find('WorkflowTaskItem').props()).toEqual({
48
+ task: props.tasks[0],
49
+ showAssignee: false
50
+ });
51
+ });
52
+
53
+ it('should render list of TEAM tasks correctly', () => {
54
+ const props = {
55
+ tasksCategory: WorkflowTasksCategories.TEAM,
56
+ tasks: [
57
+ {
58
+ assignee: 'johnconnor1131',
59
+ objectURIs: ['changeRequests/7ZotlRoP', 'entities/1aAyKH7k'],
60
+ createdBy: 'sairam.singireesu@reltio.com',
61
+ priorityClass: 'Medium',
62
+ createTime: 1620897479535,
63
+ dueDate: 1621070279536,
64
+ displayName: 'DCR Review',
65
+ processDefinitionDisplayName: 'Data Change Request Review',
66
+ objects: [
67
+ {
68
+ uri: 'entities/1aAyKH7k',
69
+ type: 'configuration/entityTypes/HCO',
70
+ label: 'Bahrain'
71
+ }
72
+ ]
73
+ }
74
+ ] as EnrichedWorkflowTaskData[],
75
+ width: 500,
76
+ height: 500
77
+ };
78
+ const wrapper = shallow(<WorkflowTasksList {...props} />);
79
+ expect(wrapper.find(AutoSizeList).props()).toMatchObject({
80
+ width: props.width,
81
+ height: props.height,
82
+ data: props.tasks
83
+ });
84
+
85
+ const autoSizeListChildren = wrapper.find(AutoSizeList).prop('children') as ({
86
+ data,
87
+ index
88
+ }: {
89
+ data: EnrichedWorkflowTaskData[];
90
+ index: number;
91
+ }) => JSX.Element;
92
+ const firstRow = shallow(autoSizeListChildren({data: props.tasks, index: 0}));
93
+ expect(firstRow.find('WorkflowTaskItem').props()).toEqual({
94
+ task: props.tasks[0],
95
+ showAssignee: true
96
+ });
97
+ });
98
+ });
@@ -0,0 +1,8 @@
1
+ export {default as DashboardNoData} from './DashboardNoData/DashboardNoData';
2
+ export {default as DashboardLinearLoader} from './DashboardLinearLoader/DashboardLinearLoader';
3
+ export {default as DashboardError} from './DashboardError/DashboardError';
4
+ export {default as DashboardPopupMenu} from './DashboardPopupMenu/DashboardPopupMenu';
5
+ export {default as DashboardLayoutItemView} from './LayoutItemView/LayoutItemView';
6
+ export {default as DashboardLayoutItemHeader} from './LayoutItemHeader/LayoutItemHeader';
7
+ export {default as DashboardLayoutItemContent} from './LayoutItemContent/LayoutItemContent';
8
+ export {default as StatsChart} from './StatsChart/StatsChart';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+
3
+ export const DashboardViewIdContext = React.createContext(null);
4
+
5
+ DashboardViewIdContext.displayName = 'DashboardViewIdContext';
@@ -0,0 +1,106 @@
1
+ import React from 'react';
2
+ import {act} from 'react-dom/test-utils';
3
+ import {mount} from 'enzyme';
4
+ import moment from 'moment';
5
+ import * as mdmSdkModule from '@reltio/mdm-sdk';
6
+ import {useActivitiesRequest} from '../useActivitiesRequest';
7
+
8
+ jest.mock('@reltio/mdm-sdk', () => ({
9
+ ...jest.requireActual<Record<string, unknown>>('@reltio/mdm-sdk'),
10
+ getActivities: jest.fn(),
11
+ getActivitiesTotal: jest.fn()
12
+ }));
13
+
14
+ describe('useActivitiesRequest behavior', () => {
15
+ const getActivitiesSpy = jest.spyOn(mdmSdkModule, 'getActivities');
16
+ const getActivitiesTotalSpy = jest.spyOn(mdmSdkModule, 'getActivitiesTotal');
17
+
18
+ // eslint-disable-next-line react/prop-types
19
+ const TestComponent = ({filter}) => {
20
+ const {state, data, total, reload} = useActivitiesRequest({filter, offset: 0, max: 10});
21
+ return state ? <div data-test={{state, data, reload, total}} /> : null;
22
+ };
23
+ const getHooksValues = (component) => component.find('TestComponent').childAt(0).prop('data-test');
24
+
25
+ const activities = [
26
+ {
27
+ uri: 'activities/6a7f-1247-7db88358',
28
+ user: 'vyacheslav.kovyazin',
29
+ label: 'USER_SEARCH',
30
+ description:
31
+ '{"activity":{"query":"filter=((equals(type%2C\'configuration%2FentityTypes%2FREGISTRY\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FDoctesting\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FPeople\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FHCP\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FAZGlobalLOV\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FSalesDept\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FTrial1\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FMine\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FDetailLoadTracker\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FProcessTracker\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FLocation\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FHCA\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FMarketingDept\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FETLLOV\')%20or%20equals(type%2C\'configuration%2FentityTypes%2FOMG\'))%20and%20exists(attributes.Commenters))","uiState":{"view":{"searchResultsMode":"list","entityTypeTab":"configuration/entityTypes/HCP","sortField":null,"sortOrder":null,"tabs":{"configuration/entityTypes/REGISTRY":[{"id":"label","label":"Profile","size":250},{"id":"entityId","label":"Entity ID","size":366.5},{"id":"scores","label":"Scores","size":366.5}],"configuration/entityTypes/Doctesting":[{"id":"label","label":"Profile","size":250},{"id":"entityId","label":"Entity ID","size":370.5},{"id":"scores","label":"Scores","size":370.5}],"configuration/entityTypes/People":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/HCP":[{"id":"label","label":"Profile","size":250},{"id":"entityId","label":"Entity ID","size":366.5},{"id":"scores","label":"Scores","size":366.5}],"configuration/entityTypes/AZGlobalLOV":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/SalesDept":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/Trial1":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/Mine":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/DetailLoadTracker":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/ProcessTracker":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/Location":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/HCA":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/MarketingDept":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/ETLLOV":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}],"configuration/entityTypes/OMG":[{"id":"label","label":"Profile"},{"id":"entityId","label":"Entity ID"},{"id":"scores","label":"Scores"}]},"previewPanelMode":null},"facets":{},"advanced":[{"attributes":[{"data":{"fieldName":"attributes.Commenters"},"operator":"and","filter":"exists","id":"U547D8x2M5bIjwofm3s6n","values":[]}],"operator":"or","entityTypes":[],"id":"Di2JkM2JryMZpOzjiN-U_"}],"searchOptions":{"searchByOv":false,"ovOnly":false},"keyword":null,"map":null,"version":"2.0","readableQuery":"Commenter exists"}},"version":"2.0"}',
32
+ timestamp: 1622451175422,
33
+ items: [
34
+ {
35
+ id: '7G4iT0Rd',
36
+ user: 'vyacheslav.kovyazin',
37
+ method: 'POST',
38
+ url: '/reltio/api/alenat/activities',
39
+ clientType: 'Reltio UI',
40
+ timestamp: 1622451175422
41
+ }
42
+ ],
43
+ itemsTotal: 1
44
+ }
45
+ ];
46
+
47
+ let resolveActivities, resolveTotal;
48
+
49
+ beforeAll(() => {
50
+ getActivitiesSpy.mockImplementation(() => {
51
+ return new Promise((_resolve) => {
52
+ resolveActivities = () => _resolve(activities);
53
+ });
54
+ });
55
+ getActivitiesTotalSpy.mockImplementation(() => {
56
+ return new Promise((_resolve) => {
57
+ resolveTotal = () => _resolve({total: 10});
58
+ });
59
+ });
60
+ });
61
+
62
+ afterEach(() => {
63
+ jest.clearAllMocks();
64
+ });
65
+
66
+ it('should send request and be in the loading state, and be in loaded state once data is loaded', async () => {
67
+ const filter = {
68
+ users: [],
69
+ activities: [],
70
+ dateRange: {
71
+ type: 'between',
72
+ period: [new Date(1234), new Date(5678)]
73
+ }
74
+ };
75
+ const component = mount(<TestComponent filter={filter} />);
76
+ expect(getHooksValues(component).state).toBe('loading');
77
+ expect(getHooksValues(component).data).toEqual([]);
78
+ expect(getHooksValues(component).total).toEqual(0);
79
+
80
+ await act(async () => {
81
+ resolveActivities();
82
+ });
83
+ component.update();
84
+ expect(getHooksValues(component).state).toBe('loading');
85
+ expect(getHooksValues(component).data).toEqual([]);
86
+ expect(getHooksValues(component).total).toEqual(0);
87
+
88
+ await act(async () => {
89
+ resolveTotal();
90
+ });
91
+ component.update();
92
+ expect(getHooksValues(component).data).toEqual(activities);
93
+ expect(getHooksValues(component).total).toEqual(10);
94
+
95
+ const endDate = moment(filter.dateRange.period[1]).endOf('date').valueOf();
96
+
97
+ expect(getActivitiesSpy).toBeCalledWith({
98
+ filter: `(range(timestamp, 1234, ${endDate})) and (not equals(user, 'collaboration-service'))`,
99
+ offset: 0,
100
+ max: 10
101
+ });
102
+ expect(getActivitiesTotalSpy).toBeCalledWith({
103
+ filter: `(range(timestamp, 1234, ${endDate})) and (not equals(user, 'collaboration-service'))`
104
+ });
105
+ });
106
+ });
@@ -0,0 +1,280 @@
1
+ import {renderHook, act} from '@testing-library/react-hooks';
2
+ import * as mdmSdkModule from '@reltio/mdm-sdk';
3
+ import * as reactReduxImports from 'react-redux';
4
+ import {useEntityByTypeRequest} from '../useEntityByTypeRequest';
5
+
6
+ jest.mock('@reltio/mdm-sdk', () => ({
7
+ ...jest.requireActual<Record<string, unknown>>('@reltio/mdm-sdk'),
8
+ getFacets: jest.fn()
9
+ }));
10
+
11
+ const entityTypes = [
12
+ {
13
+ uri: 'configuration/entityTypes/ForRDM',
14
+ label: 'ForRDM',
15
+ dataTooltipPattern: '',
16
+ typeColor: '#A6DDF5',
17
+ typeIcon: 'images/base_type/house.png',
18
+ typeImage: 'images/defaultImage/no-loc.png',
19
+ typeGraphIcon: 'images/graphIcon/location-icon.png',
20
+ dataLabelPattern: '{Name} (Country: {Country} State: {State})'
21
+ },
22
+ {
23
+ uri: 'configuration/entityTypes/Company',
24
+ label: 'Компания',
25
+ description: 'Компания',
26
+ typeColor: '#80D557',
27
+ extendsTypeURI: 'configuration/entityTypes/Organization',
28
+ dataLabelPattern: '{Name}',
29
+ abstract: true
30
+ },
31
+ {
32
+ uri: 'configuration/entityTypes/IDN',
33
+ label: 'IDN',
34
+ dataTooltipPattern: '',
35
+ typeColor: '#AB88B1',
36
+ typeIcon: 'images/base_type/house.png',
37
+ typeImage: 'images/defaultImage/no-loc.png',
38
+ typeGraphIcon: 'images/graphIcon/location-icon.png',
39
+ extendsTypeURI: 'configuration/entityTypes/Organization',
40
+ dataLabelPattern: '{Name}',
41
+ secondaryLabelPattern: '{businessCardAttributes}',
42
+ abstract: true
43
+ },
44
+ {
45
+ uri: 'configuration/entityTypes/HCO',
46
+ label: 'Медицинская организация',
47
+ description: 'Поставщик медицинских услуг',
48
+ typeColor: '#80D557',
49
+ extendsTypeURI: 'configuration/entityTypes/Organization'
50
+ },
51
+ {
52
+ uri: 'configuration/entityTypes/AZGlobalLOV',
53
+ label: 'AZGlobalLOV',
54
+ description: 'AZGlobalLOV',
55
+ searchable: false,
56
+ typeColor: '#99CCFF',
57
+ typeIcon: 'images/base_type/org.png',
58
+ typeImage: 'images/defaultImage/no-org.png',
59
+ typeGraphIcon: 'images/graphIcon/organization-icon.png'
60
+ },
61
+ {
62
+ uri: 'configuration/entityTypes/OrganizationM',
63
+ label: 'OrganizationM',
64
+ description: 'OrganizationM entity type details',
65
+ typeColor: '#056B97',
66
+ typeIcon: 'images/base_type/org.png',
67
+ typeImage: 'images/defaultImage/no-org.png',
68
+ typeGraphIcon: 'images/graphIcon/dollor-icon-blue.png',
69
+ entitySmartLogic: 'OrganizationM',
70
+ extendsTypeURI: 'configuration/entityTypes/Party',
71
+ lifecycleActions: {
72
+ beforeSave: ['Reltio/DVFAction']
73
+ }
74
+ },
75
+ {
76
+ uri: 'configuration/entityTypes/Organization',
77
+ label: 'Организация',
78
+ description: 'Сведения о типе сущности организации',
79
+ typeColor: '#80D557',
80
+ typeIcon: 'images/base_type/org.png',
81
+ typeImage: 'images/defaultImage/no-org.png',
82
+ typeGraphIcon: 'images/graphIcon/organization-icon.png',
83
+ entitySmartLogic: 'Organization',
84
+ extendsTypeURI: 'configuration/entityTypes/Party'
85
+ },
86
+ {
87
+ uri: 'configuration/entityTypes/HCA',
88
+ label: 'HCA',
89
+ description: 'Health care Account',
90
+ typeColor: '#80D557',
91
+ extendsTypeURI: 'configuration/entityTypes/HCO',
92
+ cleanseConfig: {}
93
+ },
94
+ {
95
+ uri: 'configuration/entityTypes/GPO',
96
+ label: 'Организация, осуществляющая совместные закупки',
97
+ dataTooltipPattern: '',
98
+ typeColor: '#AB8800',
99
+ typeIcon: 'images/base_type/house.png',
100
+ typeImage: 'images/defaultImage/no-loc.png',
101
+ typeGraphIcon: 'images/graphIcon/location-icon.png',
102
+ extendsTypeURI: 'configuration/entityTypes/Organization'
103
+ },
104
+ {
105
+ uri: 'configuration/entityTypes/Party',
106
+ label: 'Сторона',
107
+ description: 'Сведения о типе сущности организации',
108
+ dataLabelPattern: '{Name}',
109
+ secondaryLabelPattern: '{businessCardAttributes}',
110
+ abstract: true,
111
+ businessCardAttributeURIs: ['configuration/entityTypes/Party/attributes/Address'],
112
+ imageAttributeURIs: ['configuration/entityTypes/Party/attributes/ImageLinks'],
113
+ access: ['READ']
114
+ }
115
+ ];
116
+
117
+ describe('useEntityByTypeRequest behavior', () => {
118
+ const store = {
119
+ search: {
120
+ searchOptions: {
121
+ searchByOv: true,
122
+ ovOnly: true
123
+ },
124
+ activityFilter: 'active',
125
+ globalFilter: {
126
+ query: 'globalQuery',
127
+ savedSearchesUris: [],
128
+ isMuted: false
129
+ }
130
+ },
131
+ tenant: {
132
+ id: 'tenant'
133
+ },
134
+ metadata: {
135
+ tenant: {
136
+ entityTypes
137
+ }
138
+ }
139
+ };
140
+ const facetResponse = {
141
+ type: {
142
+ ForRDM: 1,
143
+ HCA: 17,
144
+ HCO: 347,
145
+ Organization: 2,
146
+ OrganizationM: 880549
147
+ }
148
+ };
149
+ const defaultRequest = {
150
+ body: [
151
+ {
152
+ fieldName: 'type',
153
+ pageNo: 1,
154
+ pageSize: 10
155
+ }
156
+ ],
157
+ query: 'filter=globalQuery&activeness=active'
158
+ };
159
+
160
+ let resolveFacets;
161
+ let rejectFacets;
162
+ const getFacetsSpy = jest.spyOn(mdmSdkModule, 'getFacets');
163
+
164
+ beforeAll(() => {
165
+ jest.restoreAllMocks();
166
+ });
167
+ beforeEach(() => {
168
+ getFacetsSpy.mockReturnValue(
169
+ new Promise((resolve, reject) => {
170
+ resolveFacets = resolve;
171
+ rejectFacets = reject;
172
+ })
173
+ );
174
+ jest.spyOn(reactReduxImports, 'useSelector').mockImplementation((selector) => selector(store));
175
+ });
176
+ afterEach(() => {
177
+ jest.clearAllMocks();
178
+ });
179
+
180
+ it('should send request and be in the loading state, and be in loaded state once data is loaded', async () => {
181
+ const initialProps = {caption: 'Роли профиля', hideEmpty: true, inheritChildren: true};
182
+ const {result} = renderHook(useEntityByTypeRequest, {initialProps});
183
+
184
+ expect(result.current.state).toBe('loading');
185
+ expect(getFacetsSpy).toBeCalledWith(defaultRequest);
186
+ await act(async () => {
187
+ resolveFacets(facetResponse);
188
+ });
189
+
190
+ expect(result.current.state).toBe('loaded');
191
+ expect(result.current.data).toEqual([
192
+ {group: 'OrganizationM', label: 'OrganizationM', value: 880549, localizedValue: '880,549'},
193
+ {group: 'Organization', label: 'Организация', value: 366, localizedValue: '366'},
194
+ {group: 'ForRDM', label: 'ForRDM', value: 1, localizedValue: '1'}
195
+ ]);
196
+ });
197
+
198
+ it('should send request and be in the loading state, without inheritChildren', async () => {
199
+ const initialProps = {hideEmpty: true, inheritChildren: false};
200
+ const {result} = renderHook(useEntityByTypeRequest, {initialProps});
201
+
202
+ expect(result.current.state).toBe('loading');
203
+ expect(getFacetsSpy).toBeCalledWith(defaultRequest);
204
+ await act(async () => {
205
+ resolveFacets(facetResponse);
206
+ });
207
+
208
+ expect(result.current.state).toBe('loaded');
209
+ expect(result.current.data).toEqual([
210
+ {group: 'OrganizationM', label: 'OrganizationM', value: 880549, localizedValue: '880,549'},
211
+ {group: 'HCO', label: 'Медицинская организация', value: 347, localizedValue: '347'},
212
+ {group: 'HCA', label: 'HCA', value: 17, localizedValue: '17'},
213
+ {group: 'Organization', label: 'Организация', value: 2, localizedValue: '2'},
214
+ {group: 'ForRDM', label: 'ForRDM', value: 1, localizedValue: '1'}
215
+ ]);
216
+ });
217
+
218
+ it('should send request and be in the loading state, without hideEmpty', async () => {
219
+ const initialProps = {hideEmpty: false, inheritChildren: false};
220
+ const {result} = renderHook(useEntityByTypeRequest, {initialProps});
221
+
222
+ expect(result.current.state).toBe('loading');
223
+ expect(getFacetsSpy).toBeCalledWith(defaultRequest);
224
+ await act(async () => {
225
+ resolveFacets(facetResponse);
226
+ });
227
+
228
+ expect(result.current.state).toBe('loaded');
229
+ expect(result.current.data).toEqual([
230
+ {group: 'ForRDM', label: 'ForRDM', value: 1, localizedValue: '1'},
231
+ {group: 'HCO', label: 'Медицинская организация', value: 347, localizedValue: '347'},
232
+ {group: 'AZGlobalLOV', label: 'AZGlobalLOV', value: 0, localizedValue: '0'},
233
+ {group: 'OrganizationM', label: 'OrganizationM', value: 880549, localizedValue: '880,549'},
234
+ {group: 'Organization', label: 'Организация', value: 2, localizedValue: '2'},
235
+ {group: 'HCA', label: 'HCA', value: 17, localizedValue: '17'},
236
+ {group: 'GPO', label: 'Организация, осуществляющая совместные закупки', value: 0, localizedValue: '0'}
237
+ ]);
238
+ });
239
+
240
+ it('should return error state if loading is failed', async () => {
241
+ const initialProps = {hideEmpty: false, inheritChildren: false};
242
+ const {result} = renderHook(useEntityByTypeRequest, {initialProps});
243
+
244
+ expect(result.current.state).toBe('loading');
245
+ expect(getFacetsSpy).toBeCalledWith(defaultRequest);
246
+ await act(async () => {
247
+ rejectFacets();
248
+ });
249
+
250
+ expect(result.current.state).toBe('error');
251
+ });
252
+
253
+ it('should send request with options=searchByOv if showSearchByOv is true', async () => {
254
+ jest.spyOn(reactReduxImports, 'useSelector').mockImplementation((selector) =>
255
+ selector({
256
+ ...store,
257
+ ui: {
258
+ newConfig: {
259
+ properties: {
260
+ showSearchByOv: true
261
+ }
262
+ }
263
+ }
264
+ })
265
+ );
266
+ const initialProps = {hideEmpty: false, inheritChildren: false};
267
+ const {result} = renderHook(useEntityByTypeRequest, {initialProps});
268
+
269
+ expect(result.current.state).toBe('loading');
270
+ expect(getFacetsSpy).toBeCalledWith({
271
+ ...defaultRequest,
272
+ query: 'filter=globalQuery&options=searchByOv&activeness=active'
273
+ });
274
+ await act(async () => {
275
+ resolveFacets(facetResponse);
276
+ });
277
+
278
+ expect(result.current.state).toBe('loaded');
279
+ });
280
+ });