@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.
- package/.DS_Store +0 -0
- package/index.ts +12 -0
- package/package.json +42 -25
- package/public/bundle.js +205 -0
- package/public/bundle.js.LICENSE.txt +59 -0
- package/public/package.json +26 -0
- package/public/types/components/DashboardConfigItem/styles.d.ts +1 -0
- package/{types → public/types}/components/DashboardError/styles.d.ts +1 -1
- package/public/types/components/DashboardLayout/styles.d.ts +1 -0
- package/public/types/components/DashboardLayoutItem/styles.d.ts +1 -0
- package/public/types/components/DashboardLayoutPanel/styles.d.ts +1 -0
- package/public/types/components/DashboardLinearLoader/styles.d.ts +1 -0
- package/{types → public/types}/components/DashboardNoData/styles.d.ts +1 -1
- package/public/types/components/DashboardPerspectiveHeader/styles.d.ts +2 -0
- package/{types → public/types}/components/DashboardPopupMenu/DashboardPopupMenu.d.ts +1 -1
- package/public/types/components/DashboardPopupMenu/styles.d.ts +1 -0
- package/public/types/components/EntityTable/cell-renderers/styles.d.ts +1 -0
- package/{types → public/types}/components/EntityTable/styles.d.ts +1 -1
- package/public/types/components/LayoutItemContent/styles.d.ts +1 -0
- package/public/types/components/LayoutItemHeader/styles.d.ts +1 -0
- package/public/types/components/LayoutItemView/styles.d.ts +1 -0
- package/public/types/components/StatsChart/customized/styles.d.ts +1 -0
- package/public/types/components/WorkflowTaskItem/styles.d.ts +1 -0
- package/public/types/perspective/styles.d.ts +1 -0
- package/public/types/views/chartBased/styles.d.ts +1 -0
- package/public/types/views/custom/styles.d.ts +1 -0
- package/public/types/views/tableBased/styles.d.ts +1 -0
- package/scripts/build/index.js +21 -0
- package/src/HOCs/withPagination.tsx +39 -0
- package/src/components/DashboardConfigItem/DashboardConfigItem.tsx +101 -0
- package/src/components/DashboardConfigItem/__tests__/DashboardConfigItem.specs.tsx +81 -0
- package/src/components/DashboardConfigItem/icons/barChart.svg +12 -0
- package/src/components/DashboardConfigItem/icons/bubbleChart.svg +18 -0
- package/src/components/DashboardConfigItem/icons/customChart.svg +66 -0
- package/src/components/DashboardConfigItem/icons/donutChart.svg +33 -0
- package/src/components/DashboardConfigItem/icons/geomap.svg +23 -0
- package/src/components/DashboardConfigItem/icons/lineChart.svg +16 -0
- package/src/components/DashboardConfigItem/icons/pieChart.svg +27 -0
- package/src/components/DashboardConfigItem/icons/tableWithBars.svg +27 -0
- package/src/components/DashboardConfigItem/icons/treemap.svg +15 -0
- package/src/components/DashboardConfigItem/icons/wordCloud.svg +27 -0
- package/src/components/DashboardConfigItem/styles.ts +56 -0
- package/src/components/DashboardError/DashboardError.tsx +34 -0
- package/src/components/DashboardError/__tests__/DashboardError.test.js +34 -0
- package/src/components/DashboardError/icons/error.svg +113 -0
- package/src/components/DashboardError/styles.ts +30 -0
- package/src/components/DashboardLayout/DashboardLayout.tsx +59 -0
- package/src/components/DashboardLayout/__tests__/DashboardLayout.specs.tsx +56 -0
- package/src/components/DashboardLayout/styles.ts +30 -0
- package/src/components/DashboardLayoutItem/DashboardLayoutItem.tsx +59 -0
- package/src/components/DashboardLayoutItem/__tests__/DashboardLayoutItem.specs.tsx +145 -0
- package/src/components/DashboardLayoutItem/styles.ts +10 -0
- package/src/components/DashboardLayoutPanel/DashboardLayoutPanel.tsx +59 -0
- package/src/components/DashboardLayoutPanel/__tests__/DashboardLayoutPanel.specs.tsx +58 -0
- package/src/components/DashboardLayoutPanel/styles.ts +43 -0
- package/src/components/DashboardLinearLoader/DashboardLinearLoader.tsx +10 -0
- package/src/components/DashboardLinearLoader/__tests__/DashboardLinearLoader.test.js +12 -0
- package/src/components/DashboardLinearLoader/styles.ts +11 -0
- package/src/components/DashboardNoData/.DS_Store +0 -0
- package/src/components/DashboardNoData/DashboardNoData.tsx +21 -0
- package/src/components/DashboardNoData/__tests__/DashboardNoData.test.js +15 -0
- package/src/components/DashboardNoData/icons/noData.svg +68 -0
- package/src/components/DashboardNoData/styles.ts +21 -0
- package/src/components/DashboardPerspectiveHeader/DashboardPerspectiveHeader.tsx +43 -0
- package/src/components/DashboardPerspectiveHeader/__tests__/DashboardPerspectiveHeader.specs.tsx +41 -0
- package/src/components/DashboardPerspectiveHeader/styles.ts +24 -0
- package/src/components/DashboardPopupMenu/DashboardPopupMenu.tsx +75 -0
- package/src/components/DashboardPopupMenu/__tests__/DashboardPopupMenu.test.tsx +51 -0
- package/src/components/DashboardPopupMenu/styles.ts +20 -0
- package/src/components/EntityTable/EntityTable.tsx +49 -0
- package/src/components/EntityTable/__tests__/EntityTable.test.tsx +33 -0
- package/src/components/EntityTable/cell-renderers/EntityLabelRenderer.tsx +24 -0
- package/src/components/EntityTable/cell-renderers/HeadCellRenderer.tsx +34 -0
- package/src/components/EntityTable/cell-renderers/__tests__/EntityLabelRenderer.test.tsx +25 -0
- package/src/components/EntityTable/cell-renderers/styles.ts +46 -0
- package/src/components/EntityTable/styles.ts +19 -0
- package/src/components/LayoutItemContent/LayoutItemContent.tsx +63 -0
- package/src/components/LayoutItemContent/__tests__/LayoutItemContent.test.tsx +71 -0
- package/src/components/LayoutItemContent/styles.ts +36 -0
- package/src/components/LayoutItemHeader/LayoutItemHeader.tsx +86 -0
- package/src/components/LayoutItemHeader/__tests__/LayoutItemHeader.specs.tsx +48 -0
- package/src/components/LayoutItemHeader/styles.ts +44 -0
- package/src/components/LayoutItemView/LayoutItemView.tsx +24 -0
- package/src/components/LayoutItemView/styles.ts +11 -0
- package/src/components/StatsChart/StatsChart.tsx +77 -0
- package/src/components/StatsChart/__tests__/StatsChart.test.tsx +106 -0
- package/src/components/StatsChart/customized/CustomAxisTick.tsx +28 -0
- package/src/components/StatsChart/customized/CustomLegend.tsx +37 -0
- package/src/components/StatsChart/customized/CustomTooltip.tsx +41 -0
- package/src/components/StatsChart/customized/styles.ts +53 -0
- package/src/components/StatsChart/getStatsChartSettings.ts +65 -0
- package/src/components/WorkflowTaskItem/WorkflowTaskItem.tsx +67 -0
- package/src/components/WorkflowTaskItem/WorkflowTaskObject.tsx +54 -0
- package/src/components/WorkflowTaskItem/__tests__/WorkflowTaskItem.test.tsx +73 -0
- package/src/components/WorkflowTaskItem/__tests__/WorkflowTaskObject.test.tsx +95 -0
- package/src/components/WorkflowTaskItem/styles.ts +74 -0
- package/src/components/WorkflowTasksList/WorkflowTasksList.tsx +34 -0
- package/src/components/WorkflowTasksList/__tests__/WorkflowTasksList.test.tsx +98 -0
- package/src/components/index.ts +8 -0
- package/src/contexts/DashboardViewIdContext/index.ts +5 -0
- package/src/hooks/__tests__/useActivititesRequest.specs.tsx +106 -0
- package/src/hooks/__tests__/useEntityByTypeRequest.specs.tsx +280 -0
- package/src/hooks/__tests__/useFacetRequest.specs.tsx +437 -0
- package/src/hooks/__tests__/useFilteredEntitiesRequest.specs.tsx +103 -0
- package/src/hooks/__tests__/useSavedSearchesRequest.specs.tsx +201 -0
- package/src/hooks/__tests__/useStatsRequest.specs.tsx +212 -0
- package/src/hooks/__tests__/useWorkflowTasksRequest.specs.tsx +388 -0
- package/src/hooks/useActivitiesRequest.ts +50 -0
- package/src/hooks/useEntityByTypeRequest.ts +67 -0
- package/src/hooks/useFacetRequest.ts +117 -0
- package/src/hooks/useFilteredEntitiesRequest.ts +57 -0
- package/src/hooks/useSavedSearchesRequest.ts +82 -0
- package/src/hooks/useStatsRequest.ts +47 -0
- package/src/hooks/useWorkflowTasksRequest.ts +66 -0
- package/src/index.ts +25 -0
- package/src/perspective/DashboardPerspectiveView.tsx +132 -0
- package/src/perspective/__tests__/DashboardPerspectiveView.specs.tsx +276 -0
- package/src/perspective/__tests__/data/metadata.data.ts +33 -0
- package/src/perspective/__tests__/data/store.data.ts +15 -0
- package/src/perspective/__tests__/helpers.specs.ts +33 -0
- package/src/perspective/helpers.ts +19 -0
- package/src/perspective/index.tsx +65 -0
- package/src/perspective/styles.ts +16 -0
- package/src/services/__tests__/facets.specs.ts +42 -0
- package/src/services/__tests__/filters.specs.ts +60 -0
- package/src/services/__tests__/period.test.ts +33 -0
- package/src/services/__tests__/stats.test.ts +319 -0
- package/src/services/entityTypes.ts +66 -0
- package/src/services/facets.ts +178 -0
- package/src/services/filters.ts +87 -0
- package/src/services/period.ts +33 -0
- package/src/services/savedSearches.ts +20 -0
- package/src/services/stats.ts +191 -0
- package/src/services/workflowTasks.ts +116 -0
- package/src/types/ActivitiesViewFacetConfig.ts +5 -0
- package/src/types/CustomActionViewFacetConfig.ts +5 -0
- package/src/types/DashboardPerspectiveConfig.ts +18 -0
- package/src/types/DashboardSavedState.ts +7 -0
- package/src/types/EntityByTypeViewFacetConfig.ts +7 -0
- package/src/types/EntityData.ts +4 -0
- package/src/types/FilteredEntitiesFacetConfig.ts +6 -0
- package/src/types/FilteredSavedSearchesFacetConfig.ts +6 -0
- package/src/types/PeriodStep.ts +4 -0
- package/src/types/SavedSearchData.ts +6 -0
- package/src/types/SearchOptions.ts +10 -0
- package/src/types/StatsData.ts +14 -0
- package/src/types/WorkflowTasks.ts +26 -0
- package/src/types/index.ts +14 -0
- package/src/views/ViewsFactory.tsx +79 -0
- package/src/views/__tests__/ViewsFactory.specs.tsx +70 -0
- package/src/views/chartBased/DashboardFacet.tsx +71 -0
- package/src/views/chartBased/EntitiesByTypeViewFacet.tsx +60 -0
- package/src/views/chartBased/ProfileStatsFacet.tsx +54 -0
- package/src/views/chartBased/__tests__/DashboardFacet.specs.tsx +358 -0
- package/src/views/chartBased/__tests__/EntitiesByTypeViewFacet.specs.tsx +101 -0
- package/src/views/chartBased/__tests__/ProfileStatsFacet.specs.tsx +106 -0
- package/src/views/chartBased/styles.ts +13 -0
- package/src/views/custom/CustomActionViewFacet.tsx +36 -0
- package/src/views/custom/NotificationInboxFacet.tsx +86 -0
- package/src/views/custom/__tests__/CustomActionViewFacet.specs.tsx +35 -0
- package/src/views/custom/__tests__/NotificationInboxFacet.specs.tsx +144 -0
- package/src/views/custom/styles.ts +31 -0
- package/src/views/tableBased/ActivitiesViewFacet.tsx +79 -0
- package/src/views/tableBased/FilteredEntitiesViewFacet.tsx +67 -0
- package/src/views/tableBased/FilteredSavedSearchesFacet.tsx +85 -0
- package/src/views/tableBased/__tests__/ActivitiesViewFacet.specs.tsx +113 -0
- package/src/views/tableBased/__tests__/FIlteredEntitiesViewFacet.specs.tsx +90 -0
- package/src/views/tableBased/__tests__/FilteredSavedSearchesFacet.specs.tsx +133 -0
- package/src/views/tableBased/helpers.ts +8 -0
- package/src/views/tableBased/styles.ts +7 -0
- package/stories/Dashboards.stories.js +118 -0
- package/stories/utils/dashboardPerspectiveConfig.js +78 -0
- package/stories/utils/dashboardsViewConfig.js +17 -0
- package/stories/utils/mdmStore.js +73 -0
- package/stories/utils/responses.js +10 -0
- package/tsconfig.json +14 -0
- package/webpack.config.js +10 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -22
- package/types/components/DashboardConfigItem/styles.d.ts +0 -1
- package/types/components/DashboardLayout/styles.d.ts +0 -1
- package/types/components/DashboardLayoutItem/styles.d.ts +0 -1
- package/types/components/DashboardLayoutPanel/styles.d.ts +0 -1
- package/types/components/DashboardLinearLoader/styles.d.ts +0 -1
- package/types/components/DashboardPerspectiveHeader/styles.d.ts +0 -2
- package/types/components/DashboardPopupMenu/styles.d.ts +0 -1
- package/types/components/EntityTable/cell-renderers/styles.d.ts +0 -1
- package/types/components/LayoutItemContent/styles.d.ts +0 -1
- package/types/components/LayoutItemHeader/styles.d.ts +0 -1
- package/types/components/LayoutItemView/styles.d.ts +0 -1
- package/types/components/StatsChart/customized/styles.d.ts +0 -1
- package/types/components/WorkflowTaskItem/styles.d.ts +0 -1
- package/types/perspective/styles.d.ts +0 -1
- package/types/views/chartBased/styles.d.ts +0 -1
- package/types/views/custom/styles.d.ts +0 -1
- package/types/views/tableBased/styles.d.ts +0 -1
- /package/{types → public/types}/HOCs/withPagination.d.ts +0 -0
- /package/{types → public/types}/components/DashboardConfigItem/DashboardConfigItem.d.ts +0 -0
- /package/{types → public/types}/components/DashboardError/DashboardError.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLayout/DashboardLayout.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLayoutItem/DashboardLayoutItem.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLayoutPanel/DashboardLayoutPanel.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLinearLoader/DashboardLinearLoader.d.ts +0 -0
- /package/{types → public/types}/components/DashboardNoData/DashboardNoData.d.ts +0 -0
- /package/{types → public/types}/components/DashboardPerspectiveHeader/DashboardPerspectiveHeader.d.ts +0 -0
- /package/{types → public/types}/components/EntityTable/EntityTable.d.ts +0 -0
- /package/{types → public/types}/components/EntityTable/cell-renderers/EntityLabelRenderer.d.ts +0 -0
- /package/{types → public/types}/components/EntityTable/cell-renderers/HeadCellRenderer.d.ts +0 -0
- /package/{types → public/types}/components/LayoutItemContent/LayoutItemContent.d.ts +0 -0
- /package/{types → public/types}/components/LayoutItemHeader/LayoutItemHeader.d.ts +0 -0
- /package/{types → public/types}/components/LayoutItemView/LayoutItemView.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/StatsChart.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/customized/CustomAxisTick.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/customized/CustomLegend.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/customized/CustomTooltip.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/getStatsChartSettings.d.ts +0 -0
- /package/{types → public/types}/components/WorkflowTaskItem/WorkflowTaskItem.d.ts +0 -0
- /package/{types → public/types}/components/WorkflowTaskItem/WorkflowTaskObject.d.ts +0 -0
- /package/{types → public/types}/components/WorkflowTasksList/WorkflowTasksList.d.ts +0 -0
- /package/{types → public/types}/components/index.d.ts +0 -0
- /package/{types → public/types}/contexts/DashboardViewIdContext/index.d.ts +0 -0
- /package/{types → public/types}/hooks/useActivitiesRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useEntityByTypeRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useFacetRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useFilteredEntitiesRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useSavedSearchesRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useStatsRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useWorkflowTasksRequest.d.ts +0 -0
- /package/{types → public/types}/index.d.ts +0 -0
- /package/{types → public/types}/perspective/DashboardPerspectiveView.d.ts +0 -0
- /package/{types → public/types}/perspective/helpers.d.ts +0 -0
- /package/{types → public/types}/perspective/index.d.ts +0 -0
- /package/{types → public/types}/services/entityTypes.d.ts +0 -0
- /package/{types → public/types}/services/facets.d.ts +0 -0
- /package/{types → public/types}/services/filters.d.ts +0 -0
- /package/{types → public/types}/services/period.d.ts +0 -0
- /package/{types → public/types}/services/savedSearches.d.ts +0 -0
- /package/{types → public/types}/services/stats.d.ts +0 -0
- /package/{types → public/types}/services/workflowTasks.d.ts +0 -0
- /package/{types → public/types}/types/ActivitiesViewFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/CustomActionViewFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/DashboardPerspectiveConfig.d.ts +0 -0
- /package/{types → public/types}/types/DashboardSavedState.d.ts +0 -0
- /package/{types → public/types}/types/EntityByTypeViewFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/EntityData.d.ts +0 -0
- /package/{types → public/types}/types/FilteredEntitiesFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/FilteredSavedSearchesFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/PeriodStep.d.ts +0 -0
- /package/{types → public/types}/types/SavedSearchData.d.ts +0 -0
- /package/{types → public/types}/types/SearchOptions.d.ts +0 -0
- /package/{types → public/types}/types/StatsData.d.ts +0 -0
- /package/{types → public/types}/types/WorkflowTasks.d.ts +0 -0
- /package/{types → public/types}/types/index.d.ts +0 -0
- /package/{types → public/types}/views/ViewsFactory.d.ts +0 -0
- /package/{types → public/types}/views/chartBased/DashboardFacet.d.ts +0 -0
- /package/{types → public/types}/views/chartBased/EntitiesByTypeViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/chartBased/ProfileStatsFacet.d.ts +0 -0
- /package/{types → public/types}/views/custom/CustomActionViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/custom/NotificationInboxFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/ActivitiesViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/FilteredEntitiesViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/FilteredSavedSearchesFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/helpers.d.ts +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, {memo, useMemo, useState} from 'react';
|
|
2
|
+
import {WorkflowInboxFacetConfig} from '@reltio/mdm-sdk';
|
|
3
|
+
import LayoutItemView from '../../components/LayoutItemView/LayoutItemView';
|
|
4
|
+
import LayoutItemHeader from '../../components/LayoutItemHeader/LayoutItemHeader';
|
|
5
|
+
import LayoutItemContent from '../../components/LayoutItemContent/LayoutItemContent';
|
|
6
|
+
import WorkflowTasksList from '../../components/WorkflowTasksList/WorkflowTasksList';
|
|
7
|
+
import Select from '@mui/material/Select';
|
|
8
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
9
|
+
import {WorkflowTasksCategories} from '../../types/WorkflowTasks';
|
|
10
|
+
import {useWorkflowTasksRequest} from '../../hooks/useWorkflowTasksRequest';
|
|
11
|
+
import {pipe} from 'ramda';
|
|
12
|
+
import {BasicTablePagination, getValue, useReloadFacet} from '@reltio/components';
|
|
13
|
+
import i18n from 'ui-i18n';
|
|
14
|
+
|
|
15
|
+
import {useStyles} from './styles';
|
|
16
|
+
|
|
17
|
+
type Props = {
|
|
18
|
+
config: WorkflowInboxFacetConfig;
|
|
19
|
+
onToggleFullscreen: (id: string) => void;
|
|
20
|
+
isUpdated?: boolean;
|
|
21
|
+
isFullscreen: boolean;
|
|
22
|
+
onRemove?: (id: string) => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const NotificationInboxFacet = ({config, onToggleFullscreen, isUpdated, isFullscreen, onRemove}: Props) => {
|
|
26
|
+
const styles = useStyles();
|
|
27
|
+
|
|
28
|
+
const {id, title, pageSize} = config;
|
|
29
|
+
const [page, setPage] = useState(0);
|
|
30
|
+
const [rowsPerPage, setRowsPerPage] = useState(pageSize || 10);
|
|
31
|
+
const [tasksCategory, setTasksCategory] = useState<WorkflowTasksCategories>(WorkflowTasksCategories.MY);
|
|
32
|
+
|
|
33
|
+
const options = useMemo(
|
|
34
|
+
() => ({tasksCategory, max: rowsPerPage, offset: rowsPerPage * page}),
|
|
35
|
+
[rowsPerPage, page, tasksCategory]
|
|
36
|
+
);
|
|
37
|
+
const {state, data, total, reload} = useWorkflowTasksRequest(options);
|
|
38
|
+
|
|
39
|
+
useReloadFacet({state, reload});
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<LayoutItemView id={id}>
|
|
43
|
+
<LayoutItemHeader
|
|
44
|
+
title={title}
|
|
45
|
+
onToggleFullscreen={onToggleFullscreen}
|
|
46
|
+
isUpdated={isUpdated}
|
|
47
|
+
isFullscreen={isFullscreen}
|
|
48
|
+
onRemove={onRemove}
|
|
49
|
+
onRefresh={reload}
|
|
50
|
+
>
|
|
51
|
+
<Select
|
|
52
|
+
className={styles.tasksSelector}
|
|
53
|
+
classes={{
|
|
54
|
+
select: styles.tasksSelectorInput
|
|
55
|
+
}}
|
|
56
|
+
variant={'filled'}
|
|
57
|
+
value={tasksCategory}
|
|
58
|
+
onChange={pipe(getValue, setTasksCategory)}
|
|
59
|
+
>
|
|
60
|
+
<MenuItem value={WorkflowTasksCategories.MY}>{i18n.text('My tasks')}</MenuItem>
|
|
61
|
+
<MenuItem value={WorkflowTasksCategories.TEAM}>{i18n.text('Team tasks')}</MenuItem>
|
|
62
|
+
</Select>
|
|
63
|
+
</LayoutItemHeader>
|
|
64
|
+
<LayoutItemContent loadingState={state} onRefresh={reload} data={data}>
|
|
65
|
+
{({data, width, height}) => {
|
|
66
|
+
return (
|
|
67
|
+
<WorkflowTasksList width={width} height={height} tasksCategory={tasksCategory} tasks={data} />
|
|
68
|
+
);
|
|
69
|
+
}}
|
|
70
|
+
</LayoutItemContent>
|
|
71
|
+
{total > (pageSize || 10) && (
|
|
72
|
+
<div className={styles.pagination}>
|
|
73
|
+
<BasicTablePagination
|
|
74
|
+
count={total}
|
|
75
|
+
rowsPerPage={rowsPerPage}
|
|
76
|
+
page={page}
|
|
77
|
+
onChangePage={setPage}
|
|
78
|
+
onChangeRowsPerPage={setRowsPerPage}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
</LayoutItemView>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default memo(NotificationInboxFacet);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow} from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import {BasicViewContent} from '@reltio/components';
|
|
5
|
+
import {DashboardViewTypes} from '@reltio/mdm-sdk';
|
|
6
|
+
import CustomActionViewFacet from '../CustomActionViewFacet';
|
|
7
|
+
import {DashboardLayoutItemHeader} from '../../../components';
|
|
8
|
+
|
|
9
|
+
describe('CustomActionViewFacet tests', () => {
|
|
10
|
+
const props = {
|
|
11
|
+
config: {
|
|
12
|
+
id: 'id',
|
|
13
|
+
component: DashboardViewTypes.CustomActionViewFacet,
|
|
14
|
+
url: 'testUrl',
|
|
15
|
+
title: 'Custom'
|
|
16
|
+
},
|
|
17
|
+
onRemove: jest.fn(),
|
|
18
|
+
onToggleFullscreen: jest.fn(),
|
|
19
|
+
isUpdated: false,
|
|
20
|
+
isFullscreen: false
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
it('should render correct default state', () => {
|
|
24
|
+
const wrapper = shallow(<CustomActionViewFacet {...props} />);
|
|
25
|
+
expect(wrapper.find(DashboardLayoutItemHeader).props()).toEqual({
|
|
26
|
+
title: props.config.title,
|
|
27
|
+
onToggleFullscreen: props.onToggleFullscreen,
|
|
28
|
+
isUpdated: props.isUpdated,
|
|
29
|
+
isFullscreen: props.isFullscreen,
|
|
30
|
+
onRemove: props.onRemove
|
|
31
|
+
});
|
|
32
|
+
expect(wrapper.find(BasicViewContent).length).toBe(1);
|
|
33
|
+
expect(wrapper.find('iframe').prop('src')).toBe(props.config.url);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {act} from 'react-dom/test-utils';
|
|
3
|
+
import {mount} from 'enzyme';
|
|
4
|
+
|
|
5
|
+
import NotificationInboxFacet from '../NotificationInboxFacet';
|
|
6
|
+
import * as useWorkflowTasksRequest from '../../../hooks/useWorkflowTasksRequest';
|
|
7
|
+
import * as WorkflowTasksListImport from '../../../components/WorkflowTasksList/WorkflowTasksList';
|
|
8
|
+
import WorkflowTasksList from '../../../components/WorkflowTasksList/WorkflowTasksList';
|
|
9
|
+
import {BasicView, BasicViewContent, BasicViewHeader, EmptyStub, RequestStates} from '@reltio/components';
|
|
10
|
+
import {DashboardPopupMenu, DashboardLayoutItemHeader} from '../../../components';
|
|
11
|
+
import Select from '@mui/material/Select';
|
|
12
|
+
import * as ReltioComponents from '@reltio/components';
|
|
13
|
+
import {EnrichedWorkflowTaskData, WorkflowTasksCategories} from '../../../types/WorkflowTasks';
|
|
14
|
+
import {DashboardViewTypes} from '@reltio/mdm-sdk';
|
|
15
|
+
|
|
16
|
+
jest.mock('@reltio/components', () => ({
|
|
17
|
+
...(jest.requireActual('@reltio/components') as Record<string, unknown>),
|
|
18
|
+
useReloadAllFacets: jest.fn(),
|
|
19
|
+
BasicTablePagination: () => null
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
describe('NotificationInboxFacet tests', () => {
|
|
23
|
+
const props = {
|
|
24
|
+
config: {
|
|
25
|
+
id: 'id',
|
|
26
|
+
component: DashboardViewTypes.NotificationInboxFacet,
|
|
27
|
+
title: 'Notifications'
|
|
28
|
+
},
|
|
29
|
+
onRemove: jest.fn(),
|
|
30
|
+
onToggleFullscreen: jest.fn(),
|
|
31
|
+
isUpdated: false,
|
|
32
|
+
isFullscreen: false
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const tasksData = [
|
|
36
|
+
{
|
|
37
|
+
assignee: 'polina.arsenteva',
|
|
38
|
+
objectURIs: ['entities/1fIVXrYH'],
|
|
39
|
+
createdBy: 'sairam.singireesu@reltio.com',
|
|
40
|
+
priorityClass: 'Medium',
|
|
41
|
+
createTime: 1621534310502,
|
|
42
|
+
dueDate: 1621707110507,
|
|
43
|
+
displayName: 'Delete Review',
|
|
44
|
+
processDefinitionDisplayName: 'Recommend for Delete'
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
const reload = jest.fn();
|
|
48
|
+
|
|
49
|
+
beforeAll(() => {
|
|
50
|
+
jest.spyOn(ReltioComponents, 'useReloadFacet').mockImplementation(() => {});
|
|
51
|
+
jest.spyOn(useWorkflowTasksRequest, 'useWorkflowTasksRequest').mockImplementation(() => {
|
|
52
|
+
return {
|
|
53
|
+
state: RequestStates.LOADED,
|
|
54
|
+
data: tasksData as EnrichedWorkflowTaskData[],
|
|
55
|
+
total: 50,
|
|
56
|
+
reload
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
jest.spyOn(WorkflowTasksListImport, 'default').mockImplementation(EmptyStub);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should render correct default state', () => {
|
|
63
|
+
const wrapper = mount(<NotificationInboxFacet {...props} />);
|
|
64
|
+
expect(wrapper.find(DashboardLayoutItemHeader).props()).toMatchObject({
|
|
65
|
+
title: props.config.title,
|
|
66
|
+
onToggleFullscreen: props.onToggleFullscreen,
|
|
67
|
+
isUpdated: props.isUpdated,
|
|
68
|
+
isFullscreen: props.isFullscreen,
|
|
69
|
+
onRefresh: reload,
|
|
70
|
+
onRemove: props.onRemove
|
|
71
|
+
});
|
|
72
|
+
expect(wrapper.find(BasicView).length).toBe(1);
|
|
73
|
+
expect(wrapper.find(BasicViewHeader).length).toBe(1);
|
|
74
|
+
expect(wrapper.find(BasicViewHeader).prop('title')).toEqual(props.config.title);
|
|
75
|
+
expect(wrapper.find(DashboardPopupMenu).length).toBe(1);
|
|
76
|
+
expect(wrapper.find(BasicViewContent).length).toBe(1);
|
|
77
|
+
expect(wrapper.find(Select).prop('value')).toEqual(WorkflowTasksCategories.MY);
|
|
78
|
+
expect(wrapper.find(WorkflowTasksList).props()).toMatchObject({
|
|
79
|
+
tasksCategory: WorkflowTasksCategories.MY,
|
|
80
|
+
tasks: tasksData
|
|
81
|
+
});
|
|
82
|
+
expect(useWorkflowTasksRequest.useWorkflowTasksRequest).toBeCalledWith({
|
|
83
|
+
tasksCategory: WorkflowTasksCategories.MY,
|
|
84
|
+
max: 10,
|
|
85
|
+
offset: 0
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should apply changed category correctly', () => {
|
|
90
|
+
const wrapper = mount(<NotificationInboxFacet {...props} />);
|
|
91
|
+
act(() => {
|
|
92
|
+
const selectEvent = {target: {value: WorkflowTasksCategories.TEAM}} as React.ChangeEvent<{value: unknown}>;
|
|
93
|
+
const childSelect = {} as React.ReactNode;
|
|
94
|
+
wrapper.find(Select).prop('onChange')(selectEvent, childSelect);
|
|
95
|
+
});
|
|
96
|
+
wrapper.update();
|
|
97
|
+
expect(wrapper.find(Select).prop('value')).toEqual(WorkflowTasksCategories.TEAM);
|
|
98
|
+
expect(wrapper.find(WorkflowTasksList).prop('tasksCategory')).toBe(WorkflowTasksCategories.TEAM);
|
|
99
|
+
expect(useWorkflowTasksRequest.useWorkflowTasksRequest).toBeCalledWith({
|
|
100
|
+
tasksCategory: WorkflowTasksCategories.TEAM,
|
|
101
|
+
max: 10,
|
|
102
|
+
offset: 0
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should render basicTablePagination', () => {
|
|
107
|
+
const wrapper = mount(<NotificationInboxFacet {...props} config={{...props.config, pageSize: 15}} />);
|
|
108
|
+
const {BasicTablePagination} = ReltioComponents;
|
|
109
|
+
wrapper.update();
|
|
110
|
+
expect(wrapper.find(BasicTablePagination).prop('count')).toBe(50);
|
|
111
|
+
expect(wrapper.find(BasicTablePagination).prop('page')).toBe(0);
|
|
112
|
+
expect(wrapper.find(BasicTablePagination).prop('rowsPerPage')).toBe(15);
|
|
113
|
+
wrapper.find(BasicTablePagination).prop('onChangePage')(1);
|
|
114
|
+
wrapper.update();
|
|
115
|
+
expect(useWorkflowTasksRequest.useWorkflowTasksRequest).toBeCalledWith({
|
|
116
|
+
tasksCategory: WorkflowTasksCategories.MY,
|
|
117
|
+
max: 15,
|
|
118
|
+
offset: 15
|
|
119
|
+
});
|
|
120
|
+
expect(wrapper.find(BasicTablePagination).prop('page')).toBe(1);
|
|
121
|
+
wrapper.find(BasicTablePagination).prop('onChangePage')(0);
|
|
122
|
+
wrapper.update();
|
|
123
|
+
expect(useWorkflowTasksRequest.useWorkflowTasksRequest).toBeCalledWith({
|
|
124
|
+
tasksCategory: WorkflowTasksCategories.MY,
|
|
125
|
+
max: 15,
|
|
126
|
+
offset: 0
|
|
127
|
+
});
|
|
128
|
+
wrapper.find(BasicTablePagination).prop('onChangeRowsPerPage')(20);
|
|
129
|
+
wrapper.update();
|
|
130
|
+
expect(useWorkflowTasksRequest.useWorkflowTasksRequest).toBeCalledWith({
|
|
131
|
+
tasksCategory: WorkflowTasksCategories.MY,
|
|
132
|
+
max: 20,
|
|
133
|
+
offset: 0
|
|
134
|
+
});
|
|
135
|
+
expect(wrapper.find(BasicTablePagination).prop('rowsPerPage')).toBe(20);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should not render basicTablePagination if pageSize > total', () => {
|
|
139
|
+
const wrapper = mount(<NotificationInboxFacet {...props} config={{...props.config, pageSize: 100}} />);
|
|
140
|
+
const {BasicTablePagination} = ReltioComponents;
|
|
141
|
+
wrapper.update();
|
|
142
|
+
expect(wrapper.find(BasicTablePagination)).toHaveLength(0);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
export const useStyles = makeStyles(() => ({
|
|
4
|
+
viewContent: {
|
|
5
|
+
height: '100%',
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
padding: '0 16px 16px'
|
|
9
|
+
},
|
|
10
|
+
iframe: {
|
|
11
|
+
borderWidth: 0,
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%'
|
|
14
|
+
},
|
|
15
|
+
tasksSelector: {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
margin: '0 6px 0 0',
|
|
18
|
+
flexBasis: '220px',
|
|
19
|
+
flexShrink: 1
|
|
20
|
+
},
|
|
21
|
+
tasksSelectorInput: {
|
|
22
|
+
fontSize: '14px',
|
|
23
|
+
lineHeight: '16px',
|
|
24
|
+
padding: '12px 32px 10px 12px'
|
|
25
|
+
},
|
|
26
|
+
pagination: {
|
|
27
|
+
height: '52px',
|
|
28
|
+
flexGrow: 0,
|
|
29
|
+
flexShrink: 0
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, {memo, useCallback, useMemo, useState} from 'react';
|
|
2
|
+
import {DateRangeTypes} from '@reltio/mdm-sdk';
|
|
3
|
+
import {ActivitiesFilter, ActivityLog, ActivityLogFilter, useReloadFacet} from '@reltio/components';
|
|
4
|
+
import LayoutItemView from '../../components/LayoutItemView/LayoutItemView';
|
|
5
|
+
import LayoutItemHeader from '../../components/LayoutItemHeader/LayoutItemHeader';
|
|
6
|
+
import LayoutItemContent from '../../components/LayoutItemContent/LayoutItemContent';
|
|
7
|
+
import {ActivitiesViewFacetConfig} from '../../types/ActivitiesViewFacetConfig';
|
|
8
|
+
import {DEFAULT_ROWS_PER_PAGE, getRowsPerPageOptions} from './helpers';
|
|
9
|
+
import {useActivitiesRequest} from '../../hooks/useActivitiesRequest';
|
|
10
|
+
|
|
11
|
+
import {useStyles} from './styles';
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
config: ActivitiesViewFacetConfig;
|
|
15
|
+
onToggleFullscreen: (id: string) => void;
|
|
16
|
+
isUpdated?: boolean;
|
|
17
|
+
isFullscreen: boolean;
|
|
18
|
+
onRemove?: (id: string) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ActivitiesViewFacet = ({config, isUpdated, isFullscreen, onToggleFullscreen, onRemove}: Props) => {
|
|
22
|
+
const {id, title, exportTypes} = config;
|
|
23
|
+
const styles = useStyles();
|
|
24
|
+
|
|
25
|
+
const [page, setPage] = useState(0);
|
|
26
|
+
const [rowsPerPage, setRowsPerPage] = useState(DEFAULT_ROWS_PER_PAGE);
|
|
27
|
+
const rowsPerPageOptions = useMemo(() => getRowsPerPageOptions(DEFAULT_ROWS_PER_PAGE), []);
|
|
28
|
+
const [filter, setFilter] = useState<ActivitiesFilter>({
|
|
29
|
+
users: [],
|
|
30
|
+
activities: [],
|
|
31
|
+
dateRange: {
|
|
32
|
+
type: DateRangeTypes.WITHIN,
|
|
33
|
+
period: [4, 'months']
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const {state, data, total, reload} = useActivitiesRequest({filter, max: rowsPerPage, offset: page * rowsPerPage});
|
|
37
|
+
|
|
38
|
+
const handleFilterChange = useCallback((value: ActivitiesFilter) => {
|
|
39
|
+
setFilter(value);
|
|
40
|
+
setPage(0);
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
useReloadFacet({state, reload});
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<LayoutItemView id={id}>
|
|
47
|
+
<LayoutItemHeader
|
|
48
|
+
title={title}
|
|
49
|
+
onToggleFullscreen={onToggleFullscreen}
|
|
50
|
+
isUpdated={isUpdated}
|
|
51
|
+
isFullscreen={isFullscreen}
|
|
52
|
+
onRemove={onRemove}
|
|
53
|
+
onRefresh={reload}
|
|
54
|
+
/>
|
|
55
|
+
<div className={styles.activityLogFilter}>
|
|
56
|
+
<ActivityLogFilter value={filter} onChange={handleFilterChange} exportTypes={exportTypes} />
|
|
57
|
+
</div>
|
|
58
|
+
<LayoutItemContent loadingState={state} onRefresh={reload} data={data}>
|
|
59
|
+
{({data, width, height}) => {
|
|
60
|
+
return (
|
|
61
|
+
<ActivityLog
|
|
62
|
+
width={width}
|
|
63
|
+
height={height}
|
|
64
|
+
activities={data}
|
|
65
|
+
count={total}
|
|
66
|
+
page={page}
|
|
67
|
+
onChangePage={setPage}
|
|
68
|
+
rowsPerPage={rowsPerPage}
|
|
69
|
+
onChangeRowsPerPage={setRowsPerPage}
|
|
70
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}}
|
|
74
|
+
</LayoutItemContent>
|
|
75
|
+
</LayoutItemView>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default memo(ActivitiesViewFacet);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, {memo, useMemo, useState} from 'react';
|
|
2
|
+
import {useReloadFacet} from '@reltio/components';
|
|
3
|
+
import {FilteredEntitiesFacetConfig} from '../../types/FilteredEntitiesFacetConfig';
|
|
4
|
+
import {useFilteredEntitiesRequest} from '../../hooks/useFilteredEntitiesRequest';
|
|
5
|
+
import {getRowsPerPageOptions, DEFAULT_ROWS_PER_PAGE} from './helpers';
|
|
6
|
+
import LayoutItemView from '../../components/LayoutItemView/LayoutItemView';
|
|
7
|
+
import LayoutItemHeader from '../../components/LayoutItemHeader/LayoutItemHeader';
|
|
8
|
+
import LayoutItemContent from '../../components/LayoutItemContent/LayoutItemContent';
|
|
9
|
+
import {withPagination} from '../../HOCs/withPagination';
|
|
10
|
+
import EntityTable from '../../components/EntityTable/EntityTable';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
config: FilteredEntitiesFacetConfig;
|
|
14
|
+
onToggleFullscreen: (id: string) => void;
|
|
15
|
+
isUpdated?: boolean;
|
|
16
|
+
isFullscreen: boolean;
|
|
17
|
+
onRemove?: (id: string) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const TableWithPagination = withPagination(EntityTable);
|
|
21
|
+
|
|
22
|
+
const FilteredEntitiesViewFacet = ({config, onToggleFullscreen, isUpdated, isFullscreen, onRemove}: Props) => {
|
|
23
|
+
const {id, title, filters, max = DEFAULT_ROWS_PER_PAGE} = config;
|
|
24
|
+
const rowsPerPageOptions = useMemo(() => getRowsPerPageOptions(max), [max]);
|
|
25
|
+
const [rowsPerPage, setRowsPerPage] = useState(max);
|
|
26
|
+
const [page, setPage] = useState(0);
|
|
27
|
+
|
|
28
|
+
const {data, state, reload, total} = useFilteredEntitiesRequest({
|
|
29
|
+
filters,
|
|
30
|
+
max: rowsPerPage,
|
|
31
|
+
offset: rowsPerPage * page
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
useReloadFacet({state, reload});
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<LayoutItemView id={id}>
|
|
38
|
+
<LayoutItemHeader
|
|
39
|
+
title={title}
|
|
40
|
+
onToggleFullscreen={onToggleFullscreen}
|
|
41
|
+
isUpdated={isUpdated}
|
|
42
|
+
isFullscreen={isFullscreen}
|
|
43
|
+
onRefresh={reload}
|
|
44
|
+
onRemove={onRemove}
|
|
45
|
+
/>
|
|
46
|
+
<LayoutItemContent loadingState={state} onRefresh={reload} data={data}>
|
|
47
|
+
{({data, width, height}) => {
|
|
48
|
+
return (
|
|
49
|
+
<TableWithPagination
|
|
50
|
+
height={height}
|
|
51
|
+
onChangePage={setPage}
|
|
52
|
+
page={page}
|
|
53
|
+
rowsPerPage={rowsPerPage}
|
|
54
|
+
count={total}
|
|
55
|
+
onChangeRowsPerPage={setRowsPerPage}
|
|
56
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
57
|
+
width={width}
|
|
58
|
+
data={data}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}}
|
|
62
|
+
</LayoutItemContent>
|
|
63
|
+
</LayoutItemView>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default memo(FilteredEntitiesViewFacet);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, {memo, useCallback, useMemo, useState} from 'react';
|
|
2
|
+
import {useDispatch} from 'react-redux';
|
|
3
|
+
import {find, pipe, propEq} from 'ramda';
|
|
4
|
+
import i18n from 'ui-i18n';
|
|
5
|
+
import {TableWithBars, useReloadFacet} from '@reltio/components';
|
|
6
|
+
import {ui} from '@reltio/mdm-module';
|
|
7
|
+
import {FilteredSavedSearchesFacetConfig} from '../../types/FilteredSavedSearchesFacetConfig';
|
|
8
|
+
import {useSavedSearchesRequest} from '../../hooks/useSavedSearchesRequest';
|
|
9
|
+
import {DEFAULT_ROWS_PER_PAGE, getRowsPerPageOptions} from './helpers';
|
|
10
|
+
import LayoutItemView from '../../components/LayoutItemView/LayoutItemView';
|
|
11
|
+
import LayoutItemHeader from '../../components/LayoutItemHeader/LayoutItemHeader';
|
|
12
|
+
import LayoutItemContent from '../../components/LayoutItemContent/LayoutItemContent';
|
|
13
|
+
import {withPagination} from '../../HOCs/withPagination';
|
|
14
|
+
import {savedSearchDataToChartData, savedSearchDataToSearchState} from '../../services/savedSearches';
|
|
15
|
+
|
|
16
|
+
type Props = {
|
|
17
|
+
config: FilteredSavedSearchesFacetConfig;
|
|
18
|
+
onToggleFullscreen: (id: string) => void;
|
|
19
|
+
isUpdated?: boolean;
|
|
20
|
+
isFullscreen: boolean;
|
|
21
|
+
onRemove?: (id: string) => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const TableWithPagination = withPagination(TableWithBars);
|
|
25
|
+
|
|
26
|
+
const FilteredSavedSearchesFacet = ({config, onToggleFullscreen, isUpdated, isFullscreen, onRemove}: Props) => {
|
|
27
|
+
const {id, title, options, max = DEFAULT_ROWS_PER_PAGE} = config;
|
|
28
|
+
|
|
29
|
+
const rowsPerPageOptions = useMemo(() => getRowsPerPageOptions(max), [max]);
|
|
30
|
+
const [rowsPerPage, setRowsPerPage] = useState(max);
|
|
31
|
+
const [page, setPage] = useState(0);
|
|
32
|
+
const {data, state, reload, total} = useSavedSearchesRequest({
|
|
33
|
+
options,
|
|
34
|
+
max: rowsPerPage,
|
|
35
|
+
offset: rowsPerPage * page
|
|
36
|
+
});
|
|
37
|
+
const chartData = useMemo(() => savedSearchDataToChartData(data), [data]);
|
|
38
|
+
|
|
39
|
+
const dispatch = useDispatch();
|
|
40
|
+
const onSSClick = useCallback(
|
|
41
|
+
(uri: string) => {
|
|
42
|
+
pipe(find(propEq('uri', uri)), savedSearchDataToSearchState, ui.actions.openSearch, dispatch)(data);
|
|
43
|
+
},
|
|
44
|
+
[dispatch, data]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
useReloadFacet({state, reload});
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<LayoutItemView id={id}>
|
|
51
|
+
<LayoutItemHeader
|
|
52
|
+
title={title}
|
|
53
|
+
onToggleFullscreen={onToggleFullscreen}
|
|
54
|
+
isFullscreen={isFullscreen}
|
|
55
|
+
isUpdated={isUpdated}
|
|
56
|
+
onRefresh={reload}
|
|
57
|
+
onRemove={onRemove}
|
|
58
|
+
/>
|
|
59
|
+
<LayoutItemContent loadingState={state} onRefresh={reload} data={chartData}>
|
|
60
|
+
{({data, width, height}) => {
|
|
61
|
+
return (
|
|
62
|
+
<TableWithPagination
|
|
63
|
+
width={width}
|
|
64
|
+
height={height}
|
|
65
|
+
data={data}
|
|
66
|
+
count={total}
|
|
67
|
+
onChangePage={setPage}
|
|
68
|
+
page={page}
|
|
69
|
+
rowsPerPage={rowsPerPage}
|
|
70
|
+
onChangeRowsPerPage={setRowsPerPage}
|
|
71
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
72
|
+
options={{
|
|
73
|
+
headers: [i18n.text('Name')],
|
|
74
|
+
showValues: options?.countResults
|
|
75
|
+
}}
|
|
76
|
+
onItemClick={onSSClick}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}}
|
|
80
|
+
</LayoutItemContent>
|
|
81
|
+
</LayoutItemView>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default memo(FilteredSavedSearchesFacet);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {mount} from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import ActivitiesViewFacet from '../ActivitiesViewFacet';
|
|
5
|
+
import * as useActivitiesRequest from '../../../hooks/useActivitiesRequest';
|
|
6
|
+
import {
|
|
7
|
+
ActivityLog,
|
|
8
|
+
ActivityLogFilter,
|
|
9
|
+
BasicView,
|
|
10
|
+
BasicViewContent,
|
|
11
|
+
BasicViewHeader,
|
|
12
|
+
RequestStates
|
|
13
|
+
} from '@reltio/components';
|
|
14
|
+
import * as ReltioComponents from '@reltio/components';
|
|
15
|
+
import {DashboardPopupMenu, DashboardLayoutItemHeader} from '../../../components';
|
|
16
|
+
import {DEFAULT_ROWS_PER_PAGE} from '../helpers';
|
|
17
|
+
import {DashboardViewTypes, DateRangeTypes} from '@reltio/mdm-sdk';
|
|
18
|
+
|
|
19
|
+
jest.mock('@reltio/components', () => ({
|
|
20
|
+
...jest.requireActual<Record<string, unknown>>('@reltio/components'),
|
|
21
|
+
ActivityLog: () => null,
|
|
22
|
+
ActivityLogFilter: () => null
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
describe('ActivitiesViewFacet tests', () => {
|
|
26
|
+
const props = {
|
|
27
|
+
config: {
|
|
28
|
+
id: 'id',
|
|
29
|
+
component: DashboardViewTypes.ActivitiesViewFacet,
|
|
30
|
+
title: 'Activity log',
|
|
31
|
+
exportTypes: ['csv']
|
|
32
|
+
},
|
|
33
|
+
onRemove: jest.fn(),
|
|
34
|
+
onToggleFullscreen: jest.fn(),
|
|
35
|
+
isUpdated: false,
|
|
36
|
+
isFullscreen: false
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const activities = [
|
|
40
|
+
{
|
|
41
|
+
uri: 'activities/6a7f-1247-7db88358',
|
|
42
|
+
user: 'vyacheslav.kovyazin',
|
|
43
|
+
label: 'USER_SEARCH',
|
|
44
|
+
description:
|
|
45
|
+
'{"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"}',
|
|
46
|
+
timestamp: 1622451175422,
|
|
47
|
+
items: [
|
|
48
|
+
{
|
|
49
|
+
id: '7G4iT0Rd',
|
|
50
|
+
user: 'vyacheslav.kovyazin',
|
|
51
|
+
method: 'POST',
|
|
52
|
+
url: '/reltio/api/alenat/activities',
|
|
53
|
+
clientType: 'Reltio UI',
|
|
54
|
+
timestamp: 1622451175422
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
itemsTotal: 1
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
const reload = jest.fn();
|
|
61
|
+
|
|
62
|
+
beforeAll(() => {
|
|
63
|
+
jest.spyOn(ReltioComponents, 'useReloadFacet').mockImplementation(() => {});
|
|
64
|
+
jest.spyOn(useActivitiesRequest, 'useActivitiesRequest').mockImplementation(() => {
|
|
65
|
+
return {
|
|
66
|
+
state: RequestStates.LOADED,
|
|
67
|
+
data: activities,
|
|
68
|
+
total: 10,
|
|
69
|
+
reload
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should render correct default state', () => {
|
|
75
|
+
const wrapper = mount(<ActivitiesViewFacet {...props} />);
|
|
76
|
+
expect(wrapper.find(DashboardLayoutItemHeader).props()).toMatchObject({
|
|
77
|
+
title: props.config.title,
|
|
78
|
+
onToggleFullscreen: props.onToggleFullscreen,
|
|
79
|
+
isUpdated: props.isUpdated,
|
|
80
|
+
isFullscreen: props.isFullscreen,
|
|
81
|
+
onRefresh: reload,
|
|
82
|
+
onRemove: props.onRemove
|
|
83
|
+
});
|
|
84
|
+
expect(wrapper.find(BasicView).length).toBe(1);
|
|
85
|
+
expect(wrapper.find(BasicViewHeader).length).toBe(1);
|
|
86
|
+
expect(wrapper.find(BasicViewHeader).prop('title')).toEqual(props.config.title);
|
|
87
|
+
expect(wrapper.find(DashboardPopupMenu).length).toBe(1);
|
|
88
|
+
expect(wrapper.find(BasicViewContent).length).toBe(1);
|
|
89
|
+
const defaultFilter = {
|
|
90
|
+
users: [],
|
|
91
|
+
activities: [],
|
|
92
|
+
dateRange: {
|
|
93
|
+
type: DateRangeTypes.WITHIN,
|
|
94
|
+
period: [4, 'months']
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
expect(wrapper.find('.activityLogFilter').length).toBe(1);
|
|
98
|
+
expect(wrapper.find(ActivityLogFilter).length).toBe(1);
|
|
99
|
+
expect(wrapper.find(ActivityLogFilter).prop('value')).toEqual(defaultFilter);
|
|
100
|
+
expect(wrapper.find(ActivityLogFilter).prop('exportTypes')).toEqual(props.config.exportTypes);
|
|
101
|
+
expect(wrapper.find(ActivityLog).props()).toMatchObject({
|
|
102
|
+
activities,
|
|
103
|
+
count: 10,
|
|
104
|
+
page: 0,
|
|
105
|
+
rowsPerPage: DEFAULT_ROWS_PER_PAGE
|
|
106
|
+
});
|
|
107
|
+
expect(useActivitiesRequest.useActivitiesRequest).toBeCalledWith({
|
|
108
|
+
filter: defaultFilter,
|
|
109
|
+
offset: 0,
|
|
110
|
+
max: DEFAULT_ROWS_PER_PAGE
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|