@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,90 @@
1
+ import React from 'react';
2
+ import {mount} from 'enzyme';
3
+ import * as reactRedux from 'react-redux';
4
+ import {
5
+ BasicTablePagination,
6
+ BasicView,
7
+ BasicViewContent,
8
+ BasicViewHeader,
9
+ RequestStates,
10
+ ReloadFacetProvider,
11
+ useReloadFacet
12
+ } from '@reltio/components';
13
+ import * as useFilteredEntitiesRequestHook from '../../../hooks/useFilteredEntitiesRequest';
14
+ import {DashboardPopupMenu, DashboardLayoutItemHeader} from '../../../components';
15
+ import FilteredEntitiesViewFacet from '../FilteredEntitiesViewFacet';
16
+ import {DashboardViewTypes} from '@reltio/mdm-sdk';
17
+ import EntityTable from '../../../components/EntityTable/EntityTable';
18
+
19
+ jest.mock('@reltio/components', () => ({
20
+ ...jest.requireActual<Record<string, unknown>>('@reltio/components'),
21
+ TableWithBars: () => null,
22
+ BasicTablePagination: () => null,
23
+ useReloadFacet: jest.fn()
24
+ }));
25
+
26
+ describe('FilteredEntitiesViewFacet tests', () => {
27
+ const props = {
28
+ config: {
29
+ id: 'id',
30
+ title: 'title',
31
+ component: DashboardViewTypes.FilteredEntitiesViewFacet,
32
+ options: {
33
+ countResults: true
34
+ }
35
+ },
36
+ onToggleFullscreen: jest.fn(),
37
+ isUpdated: false,
38
+ isFullscreen: false,
39
+ onRemove: jest.fn()
40
+ };
41
+ const data = [
42
+ {label: 'first', uri: 'savedSearch/1'},
43
+ {label: 'second', uri: 'savedSearch/2'}
44
+ ];
45
+ const dispatch = jest.fn();
46
+ const reload = jest.fn();
47
+
48
+ beforeEach(() => {
49
+ (useReloadFacet as jest.Mock).mockReturnValue({
50
+ state: RequestStates.LOADED,
51
+ reload
52
+ });
53
+ });
54
+ beforeAll(() => {
55
+ jest.spyOn(useFilteredEntitiesRequestHook, 'useFilteredEntitiesRequest').mockImplementation(() => ({
56
+ state: RequestStates.LOADED,
57
+ data,
58
+ reload,
59
+ total: 2
60
+ }));
61
+ jest.spyOn(reactRedux, 'useDispatch').mockReturnValue(dispatch);
62
+ });
63
+
64
+ afterEach(() => {
65
+ jest.clearAllMocks();
66
+ });
67
+
68
+ it('should render basic table with pagination', () => {
69
+ const wrapper = mount(
70
+ <ReloadFacetProvider>
71
+ <FilteredEntitiesViewFacet {...props} />
72
+ </ReloadFacetProvider>
73
+ );
74
+ expect(wrapper.find(DashboardLayoutItemHeader).props()).toMatchObject({
75
+ title: props.config.title,
76
+ onToggleFullscreen: props.onToggleFullscreen,
77
+ isUpdated: props.isUpdated,
78
+ isFullscreen: props.isFullscreen,
79
+ onRefresh: reload,
80
+ onRemove: props.onRemove
81
+ });
82
+ expect(wrapper.find(BasicView).length).toBe(1);
83
+ expect(wrapper.find(BasicViewHeader).length).toBe(1);
84
+ expect(wrapper.find(BasicViewHeader).prop('title')).toEqual(props.config.title);
85
+ expect(wrapper.find(DashboardPopupMenu).length).toBe(1);
86
+ expect(wrapper.find(BasicViewContent).length).toBe(1);
87
+ expect(wrapper.find(EntityTable).prop('data')).toEqual(data);
88
+ expect(wrapper.find(BasicTablePagination).prop('count')).toBe(2);
89
+ });
90
+ });
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import {mount} from 'enzyme';
3
+ import * as reactRedux from 'react-redux';
4
+ import {
5
+ BasicTablePagination,
6
+ BasicView,
7
+ BasicViewContent,
8
+ BasicViewHeader,
9
+ TableWithBars,
10
+ RequestStates,
11
+ ReloadFacetProvider
12
+ } from '@reltio/components';
13
+ import {ui} from '@reltio/mdm-module';
14
+ import * as useSavedSearchesRequestHook from '../../../hooks/useSavedSearchesRequest';
15
+ import {DashboardPopupMenu, DashboardLayoutItemHeader} from '../../../components';
16
+ import FilteredSavedSearchesFacet from '../FilteredSavedSearchesFacet';
17
+ import {DashboardViewTypes} from '@reltio/mdm-sdk';
18
+
19
+ jest.mock('@reltio/components', () => ({
20
+ ...jest.requireActual<Record<string, unknown>>('@reltio/components'),
21
+ TableWithBars: () => null,
22
+ BasicTablePagination: () => null
23
+ }));
24
+
25
+ describe('FilteredSavedSearchesFacet tests', () => {
26
+ const props = {
27
+ config: {
28
+ id: 'id',
29
+ title: 'title',
30
+ component: DashboardViewTypes.FilteredSavedSearchesFacet,
31
+ options: {
32
+ countResults: true
33
+ }
34
+ },
35
+ onToggleFullscreen: jest.fn(),
36
+ isUpdated: false,
37
+ isFullscreen: false,
38
+ onRemove: jest.fn()
39
+ };
40
+
41
+ const dispatch = jest.fn();
42
+ const reload = jest.fn();
43
+
44
+ beforeAll(() => {
45
+ jest.spyOn(useSavedSearchesRequestHook, 'useSavedSearchesRequest').mockImplementation(() => {
46
+ return {
47
+ state: RequestStates.LOADED,
48
+ data: [
49
+ {name: 'Crazy-mini', count: 0, uri: 'savedSearch/1', uiState: {someState: 1, version: '2.0'}},
50
+ {name: 'crazySS', count: 2, uri: 'savedSearch/2', uiState: {state: {someState: 2}}}
51
+ ],
52
+ reload,
53
+ total: 2
54
+ };
55
+ });
56
+ jest.spyOn(reactRedux, 'useDispatch').mockReturnValue(dispatch);
57
+ });
58
+
59
+ afterEach(() => {
60
+ jest.clearAllMocks();
61
+ });
62
+
63
+ it('should render basic table with pagination', () => {
64
+ const wrapper = mount(
65
+ <ReloadFacetProvider>
66
+ <FilteredSavedSearchesFacet {...props} />
67
+ </ReloadFacetProvider>
68
+ );
69
+ expect(wrapper.find(DashboardLayoutItemHeader).props()).toMatchObject({
70
+ title: props.config.title,
71
+ onToggleFullscreen: props.onToggleFullscreen,
72
+ isUpdated: props.isUpdated,
73
+ isFullscreen: props.isFullscreen,
74
+ onRefresh: reload,
75
+ onRemove: props.onRemove
76
+ });
77
+ expect(wrapper.find(BasicView).length).toBe(1);
78
+ expect(wrapper.find(BasicViewHeader).length).toBe(1);
79
+ expect(wrapper.find(BasicViewHeader).prop('title')).toEqual(props.config.title);
80
+ expect(wrapper.find(DashboardPopupMenu).length).toBe(1);
81
+ expect(wrapper.find(BasicViewContent).length).toBe(1);
82
+ expect(wrapper.find(TableWithBars).prop('data')).toEqual([
83
+ {label: 'Crazy-mini', value: 0, group: 'savedSearch/1'},
84
+ {label: 'crazySS', value: 2, group: 'savedSearch/2'}
85
+ ]);
86
+ expect(wrapper.find(TableWithBars).prop('options')).toEqual({headers: ['Name'], showValues: true});
87
+ expect(wrapper.find(BasicTablePagination).prop('count')).toBe(2);
88
+ });
89
+
90
+ it('should render table with correct options if config options are undefined', () => {
91
+ const configWithEmptyOptions = {
92
+ ...props.config,
93
+ options: undefined
94
+ };
95
+ const wrapper = mount(
96
+ <ReloadFacetProvider>
97
+ <FilteredSavedSearchesFacet {...props} config={configWithEmptyOptions} />
98
+ </ReloadFacetProvider>
99
+ );
100
+ expect(wrapper.find(TableWithBars).prop('options')).toEqual({headers: ['Name'], showValues: undefined});
101
+ });
102
+
103
+ it('should open search on new SS click correctly', () => {
104
+ const wrapper = mount(
105
+ <ReloadFacetProvider>
106
+ <FilteredSavedSearchesFacet {...props} />
107
+ </ReloadFacetProvider>
108
+ );
109
+ wrapper.find(TableWithBars).prop('onItemClick')('savedSearch/1');
110
+ expect(dispatch).toBeCalledWith(
111
+ ui.actions.openSearch({
112
+ someState: 1,
113
+ version: '2.0',
114
+ currentSavedSearchUri: 'savedSearch/1'
115
+ })
116
+ );
117
+ });
118
+
119
+ it('should open search on old SS click correctly', () => {
120
+ const wrapper = mount(
121
+ <ReloadFacetProvider>
122
+ <FilteredSavedSearchesFacet {...props} />
123
+ </ReloadFacetProvider>
124
+ );
125
+ wrapper.find(TableWithBars).prop('onItemClick')('savedSearch/2');
126
+ expect(dispatch).toBeCalledWith(
127
+ ui.actions.openSearch({
128
+ someState: 2,
129
+ curSavedSearchUri: 'savedSearch/2'
130
+ })
131
+ );
132
+ });
133
+ });
@@ -0,0 +1,8 @@
1
+ import {subtract} from 'ramda';
2
+
3
+ const ROWS_PER_PAGE_OPTIONS = [10, 25, 50, 100];
4
+ export const [DEFAULT_ROWS_PER_PAGE] = ROWS_PER_PAGE_OPTIONS;
5
+ export const getRowsPerPageOptions = (defaultRowsPerPage) =>
6
+ ROWS_PER_PAGE_OPTIONS.filter((option) => option !== defaultRowsPerPage)
7
+ .concat(defaultRowsPerPage)
8
+ .sort(subtract);
@@ -0,0 +1,7 @@
1
+ import {makeStyles} from '@mui/styles';
2
+
3
+ export const useStyles = makeStyles(() => ({
4
+ activityLogFilter: {
5
+ padding: '0 9px'
6
+ }
7
+ }));
@@ -0,0 +1,118 @@
1
+ import {DashboardPerspective} from '../src/';
2
+ import {ThemeProvider, StyledEngineProvider, createTheme} from '@mui/material/styles';
3
+ import {facetResponse, lookupsResponse, totalResponse} from './utils/responses';
4
+ import {setRequestProvider, theme} from '@reltio/mdm-sdk';
5
+ import {Provider} from 'react-redux';
6
+ import React from 'react';
7
+ import dashboardPerspectiveConfig from './utils/dashboardPerspectiveConfig';
8
+ import dashboardsViewConfig from './utils/dashboardsViewConfig';
9
+ import mdmStore from './utils/mdmStore';
10
+ import {storiesOf} from '@storybook/react';
11
+ import DashboardFacet from '../src/views/chartBased/DashboardFacet';
12
+
13
+ const muiTheme = createTheme(theme);
14
+
15
+ const request = () => Promise.resolve({});
16
+
17
+ setRequestProvider(request);
18
+
19
+ storiesOf('DashboardPerspective', module)
20
+ .add('Dashboard facet view', () => {
21
+ const request = (url) => {
22
+ let data;
23
+ if (url.includes('facet')) {
24
+ data = facetResponse;
25
+ } else if (url.includes('total')) {
26
+ data = totalResponse;
27
+ } else if (url.includes('resolveList')) {
28
+ data = lookupsResponse;
29
+ }
30
+ return Promise.resolve(data);
31
+ };
32
+ setRequestProvider(request);
33
+ return (
34
+ <Provider store={mdmStore}>
35
+ <StyledEngineProvider injectFirst>
36
+ <ThemeProvider theme={muiTheme}>
37
+ <div style={{width: 600, height: 400}}>
38
+ <DashboardFacet config={dashboardsViewConfig} />
39
+ </div>
40
+ </ThemeProvider>
41
+ </StyledEngineProvider>
42
+ </Provider>
43
+ );
44
+ })
45
+ .add('Dashboard perspective', () => {
46
+ const request = (url) => {
47
+ let data;
48
+ if (url.includes('facet')) {
49
+ data = facetResponse;
50
+ } else if (url.includes('total')) {
51
+ data = totalResponse;
52
+ } else if (url.includes('resolveList')) {
53
+ data = lookupsResponse;
54
+ }
55
+ return Promise.resolve(data);
56
+ };
57
+ setRequestProvider(request);
58
+ return (
59
+ <StyledEngineProvider injectFirst>
60
+ <ThemeProvider theme={muiTheme}>
61
+ <DashboardPerspective
62
+ config={dashboardPerspectiveConfig}
63
+ store={mdmStore}
64
+ saveState={() => {}}
65
+ getSavedState={(resolve) => resolve()}
66
+ onResize={() => {}}
67
+ />
68
+ </ThemeProvider>
69
+ </StyledEngineProvider>
70
+ );
71
+ })
72
+ .add('No data', () => {
73
+ const request = () => Promise.resolve([]);
74
+ setRequestProvider(request);
75
+ return (
76
+ <Provider store={mdmStore}>
77
+ <StyledEngineProvider injectFirst>
78
+ <ThemeProvider theme={muiTheme}>
79
+ <div style={{width: 600, height: 400}}>
80
+ <DashboardFacet config={dashboardsViewConfig} />
81
+ </div>
82
+ </ThemeProvider>
83
+ </StyledEngineProvider>
84
+ </Provider>
85
+ );
86
+ })
87
+ .add('Loading', () => {
88
+ const request = () => new Promise(() => {});
89
+ setRequestProvider(request);
90
+ return (
91
+ <StyledEngineProvider injectFirst>
92
+ <ThemeProvider theme={muiTheme}>
93
+ <DashboardPerspective
94
+ config={dashboardPerspectiveConfig}
95
+ store={mdmStore}
96
+ saveState={() => {}}
97
+ getSavedState={(resolve) => resolve()}
98
+ onResize={() => {}}
99
+ />
100
+ </ThemeProvider>
101
+ </StyledEngineProvider>
102
+ );
103
+ })
104
+ .add('Error', () => {
105
+ const request = () => Promise.reject('error');
106
+ setRequestProvider(request);
107
+ return (
108
+ <Provider store={mdmStore}>
109
+ <StyledEngineProvider injectFirst>
110
+ <ThemeProvider theme={muiTheme}>
111
+ <div style={{width: 600, height: 400}}>
112
+ <DashboardFacet config={dashboardsViewConfig} />
113
+ </div>
114
+ </ThemeProvider>
115
+ </StyledEngineProvider>
116
+ </Provider>
117
+ );
118
+ });
@@ -0,0 +1,78 @@
1
+ import DashboardViewConfig from './dashboardsViewConfig';
2
+
3
+ export default {
4
+ width: 1000,
5
+ views: [
6
+ {
7
+ id: 'MyDashboard',
8
+ component: 'DashboardFacet',
9
+ ...DashboardViewConfig
10
+ },
11
+ {
12
+ id: 'MyDashboard2',
13
+ component: 'DashboardFacet',
14
+ ...DashboardViewConfig,
15
+ chartType: 'pie'
16
+ },
17
+ {
18
+ id: 'MyDashboard3',
19
+ component: 'DashboardFacet',
20
+ ...DashboardViewConfig,
21
+ chartType: 'table'
22
+ },
23
+ {
24
+ id: 'MyDashboard4',
25
+ component: 'DashboardFacet',
26
+ ...DashboardViewConfig,
27
+ chartType: 'cloud'
28
+ },
29
+ {
30
+ id: 'CustomView',
31
+ component: 'CustomActionViewFacet',
32
+ title: 'Custom view',
33
+ url: 'http://localhost:6006/?path=/settings/about'
34
+ }
35
+ ],
36
+ layout: [
37
+ {
38
+ x: 0,
39
+ y: 0,
40
+ width: 2,
41
+ minHeight: 10,
42
+ height: 10,
43
+ id: 'MyDashboard'
44
+ },
45
+ {
46
+ x: 2,
47
+ y: 0,
48
+ width: 2,
49
+ minHeight: 10,
50
+ height: 10,
51
+ id: 'MyDashboard2'
52
+ },
53
+ {
54
+ x: 0,
55
+ y: 10,
56
+ width: 2,
57
+ minHeight: 5,
58
+ height: 10,
59
+ id: 'MyDashboard3'
60
+ },
61
+ {
62
+ x: 2,
63
+ y: 10,
64
+ width: 2,
65
+ minHeight: 5,
66
+ height: 10,
67
+ id: 'MyDashboard4'
68
+ },
69
+ {
70
+ x: 0,
71
+ y: 20,
72
+ width: 2,
73
+ minHeight: 5,
74
+ height: 10,
75
+ id: 'CustomView'
76
+ }
77
+ ]
78
+ };
@@ -0,0 +1,17 @@
1
+ export default {
2
+ attributeUri: 'configuration/entityTypes/HCP/attributes/CountryCode',
3
+ chartType: 'bar',
4
+ title: 'Country codes',
5
+ filters: [
6
+ {
7
+ filter: 'not equals',
8
+ fieldName: 'attributes.Country',
9
+ values: ['United States']
10
+ },
11
+ {
12
+ filter: 'not equals',
13
+ fieldName: 'attributes.Country',
14
+ values: ['US']
15
+ }
16
+ ]
17
+ };
@@ -0,0 +1,73 @@
1
+ import mdm from '@reltio/mdm-module';
2
+ import {createStore} from 'redux-dynamic-modules';
3
+
4
+ const tenant = 'mZ87U4Ofxrv6WnS';
5
+ const initialState = {
6
+ metadata: {
7
+ [tenant]: {
8
+ entityTypes: [
9
+ {
10
+ uri: 'configuration/entityTypes/HCP',
11
+ label: 'HCP',
12
+ attributes: [
13
+ {
14
+ label: 'String',
15
+ name: 'CountryCode',
16
+ description: '',
17
+ type: 'String',
18
+ hidden: false,
19
+ faceted: true,
20
+ attributeOrdering: {orderType: 'ASC', orderingStrategy: 'LUD'},
21
+ uri: 'configuration/entityTypes/HCP/attributes/CountryCode',
22
+ dependentLookupCode: 'COUNTRY_CD',
23
+ lookupCode: 'COUNTRY_CD',
24
+ access: ['DELETE', 'READ', 'CREATE', 'UPDATE']
25
+ }
26
+ ],
27
+ abstract: false,
28
+ businessCardAttributeURIs: []
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ tenant: {id: tenant},
34
+ profile: {
35
+ lookups: {},
36
+ modifiedEntities: {}
37
+ },
38
+ ui: {
39
+ numberFormat: {
40
+ thousandSeparator: ',',
41
+ decimalSeparator: '.',
42
+ prefix: '',
43
+ suffix: '',
44
+ decimalScale: null
45
+ },
46
+ attributePresentations: {},
47
+ paths: {
48
+ apiPath: 'https://tst-01.reltio.com/reltio',
49
+ imagePath: 'https://s3.amazonaws.com/reltio.images/api',
50
+ dtssPath: 'https://tst-01.reltio.com/dtss/',
51
+ workflowPath: 'https://tst-01-workflow.reltio.com/workflow-adapter',
52
+ workflowEnvironmentURL: 'https://tst-01.reltio.com',
53
+ uiPath: 'http://localhost:3000/ui/ms2/',
54
+ servicesPath: 'http://localhost:3000/services'
55
+ }
56
+ },
57
+ search: {
58
+ searchResults: [],
59
+ keyword: null,
60
+ searchOptions: {
61
+ searchByOv: false,
62
+ ovOnly: false
63
+ },
64
+ activityFilter: 'active',
65
+ globalFilter: {
66
+ query: "(containsWordStartingWith(attributes,'ttt')",
67
+ savedSearchesUris: ['savedSearches/7DlPB4Dt'],
68
+ isMuted: false
69
+ }
70
+ }
71
+ };
72
+
73
+ export default createStore({initialState}, mdm.getModule());
@@ -0,0 +1,10 @@
1
+ export const facetResponse = {'attributes.CountryCode': {US: 30, BQ: 11, BM: 1, DZ: 1}};
2
+
3
+ export const totalResponse = {total: 10};
4
+
5
+ export const lookupsResponse = [
6
+ {COUNTRY_CD: {US: {displayName: 'USA'}}},
7
+ {COUNTRY_CD: {BQ: {displayName: 'Bonaire, Sint Eustatius and Saba'}}},
8
+ {COUNTRY_CD: {BM: {displayName: 'Bermuda'}}},
9
+ {COUNTRY_CD: {DZ: {displayName: 'Algeria'}}}
10
+ ];
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "declaration": true,
6
+ "outDir": "public/types",
7
+ "rootDir": "src"
8
+ },
9
+ "include": ["src", "../../custom.d.ts"],
10
+ "exclude": [
11
+ "**/node_modules",
12
+ "**/__tests__"
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ const {merge} = require('webpack-merge');
2
+ const qxComponents = require('../../webpack.qx.components');
3
+
4
+ const devServerPort = 8890;
5
+
6
+ module.exports = merge(qxComponents, {
7
+ devServer: {
8
+ port: devServerPort
9
+ }
10
+ });