@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,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import i18n from 'ui-i18n';
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import Link from '@mui/material/Link';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
7
|
+
import {DashboardView as DashboardViewConfig, ReltioGridLayoutItem} from '@reltio/mdm-sdk';
|
|
8
|
+
import {ViewStatus, DashboardView} from '../../types';
|
|
9
|
+
import DashboardConfigItem from '../DashboardConfigItem/DashboardConfigItem';
|
|
10
|
+
import {useStyles} from './styles';
|
|
11
|
+
|
|
12
|
+
const DOC_PORTAL_URL = 'https://docs.reltio.com/hub/addremovecharts.html';
|
|
13
|
+
|
|
14
|
+
type Props = {
|
|
15
|
+
views: DashboardView[];
|
|
16
|
+
layout: ReltioGridLayoutItem[];
|
|
17
|
+
onRemove: (id: string) => void;
|
|
18
|
+
onAdd: (id: string) => void;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const DashboardLayoutPanel = ({views, layout, onRemove, onAdd, onClose}: Props) => {
|
|
23
|
+
const styles = useStyles();
|
|
24
|
+
const isViewAdded = (config: DashboardViewConfig) => layout.some((layoutItem) => layoutItem.id === config.id);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={styles.root}>
|
|
28
|
+
<div className={styles.header}>
|
|
29
|
+
<IconButton className={styles.closeButton} onClick={onClose} size="large">
|
|
30
|
+
<CloseIcon />
|
|
31
|
+
</IconButton>
|
|
32
|
+
<Typography className={styles.headerTitle} variant="h6">
|
|
33
|
+
{i18n.text('Add / remove charts')}
|
|
34
|
+
</Typography>
|
|
35
|
+
</div>
|
|
36
|
+
<Typography className={styles.description} variant="body2">
|
|
37
|
+
{i18n.text('Select the charts you want to add to your dashboard. To create or edit chart, visit the')}{' '}
|
|
38
|
+
<Link href={DOC_PORTAL_URL} target="_blank" underline="hover">
|
|
39
|
+
{i18n.text('Documentation Portal')}
|
|
40
|
+
</Link>{' '}
|
|
41
|
+
{i18n.text('for more information')}
|
|
42
|
+
</Typography>
|
|
43
|
+
<div className={styles.items}>
|
|
44
|
+
{views.map(({config, status}) => {
|
|
45
|
+
return (
|
|
46
|
+
<DashboardConfigItem
|
|
47
|
+
key={config.id}
|
|
48
|
+
view={config}
|
|
49
|
+
isAdded={isViewAdded(config)}
|
|
50
|
+
isNew={status === ViewStatus.NEW}
|
|
51
|
+
onRemove={onRemove}
|
|
52
|
+
onAdd={onAdd}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {mount} from 'enzyme';
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import Link from '@mui/material/Link';
|
|
6
|
+
import {DashboardLayoutPanel} from '../DashboardLayoutPanel';
|
|
7
|
+
import {ViewStatus} from '../../../types';
|
|
8
|
+
import DashboardConfigItem from '../../DashboardConfigItem/DashboardConfigItem';
|
|
9
|
+
|
|
10
|
+
describe('DashboardLayoutPanel tests', () => {
|
|
11
|
+
const views = [
|
|
12
|
+
{config: {id: 'view1', title: 'title1', component: 'Component'}, status: ViewStatus.PERSISTED},
|
|
13
|
+
{config: {id: 'view2', title: 'title2', component: 'Component'}, status: ViewStatus.NEW}
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const defaultProps = {
|
|
17
|
+
views,
|
|
18
|
+
layout: [{id: 'view1', height: 1, x: 0, y: 0, width: 1}],
|
|
19
|
+
onRemove: jest.fn(),
|
|
20
|
+
onAdd: jest.fn(),
|
|
21
|
+
onClose: jest.fn()
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const viewsState = [
|
|
25
|
+
{isAdded: true, isNew: false},
|
|
26
|
+
{isAdded: false, isNew: true}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
it('should render DashboardLayoutPanel', () => {
|
|
30
|
+
const wrapper = mount(<DashboardLayoutPanel {...defaultProps} />);
|
|
31
|
+
|
|
32
|
+
const header = wrapper.find('.header');
|
|
33
|
+
const link = wrapper.find(Link);
|
|
34
|
+
const items = wrapper.find(DashboardConfigItem);
|
|
35
|
+
|
|
36
|
+
expect(header.find(IconButton)).toHaveLength(1);
|
|
37
|
+
expect(header.find(IconButton).prop('onClick')).toBe(defaultProps.onClose);
|
|
38
|
+
|
|
39
|
+
expect(header.find(Typography).text()).toBe('Add / remove charts');
|
|
40
|
+
expect(wrapper.find('.description').find(Typography).at(0).text()).toBe(
|
|
41
|
+
'Select the charts you want to add to your dashboard. \
|
|
42
|
+
To create or edit chart, visit the Documentation Portal for more information'
|
|
43
|
+
);
|
|
44
|
+
expect(link.prop('href')).toBe('https://docs.reltio.com/hub/addremovecharts.html');
|
|
45
|
+
expect(link.text()).toBe('Documentation Portal');
|
|
46
|
+
|
|
47
|
+
expect(items).toHaveLength(2);
|
|
48
|
+
items.forEach((item, i) => {
|
|
49
|
+
expect(item.props()).toMatchObject({
|
|
50
|
+
view: views[i].config,
|
|
51
|
+
onRemove: defaultProps.onRemove,
|
|
52
|
+
onAdd: defaultProps.onAdd,
|
|
53
|
+
isAdded: viewsState[i].isAdded,
|
|
54
|
+
isNew: viewsState[i].isNew
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
export const useStyles = makeStyles({
|
|
4
|
+
root: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
height: '100%',
|
|
8
|
+
overflow: 'hidden'
|
|
9
|
+
},
|
|
10
|
+
header: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
borderBottom: 'solid 1px rgba(0, 0, 0, 0.12)'
|
|
14
|
+
},
|
|
15
|
+
closeButton: {
|
|
16
|
+
height: 36,
|
|
17
|
+
width: 36,
|
|
18
|
+
marginLeft: '15px'
|
|
19
|
+
},
|
|
20
|
+
headerTitle: {
|
|
21
|
+
lineHeight: '18px',
|
|
22
|
+
fontSize: '18px',
|
|
23
|
+
fontWeight: 500,
|
|
24
|
+
color: 'rgba(0,0,0, 0.87)',
|
|
25
|
+
letterSpacing: 'normal',
|
|
26
|
+
padding: '16px'
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
color: 'rgba(0,0,0,0.54)',
|
|
30
|
+
fontWeight: 400,
|
|
31
|
+
fontSize: '12px',
|
|
32
|
+
lineHeight: '16px',
|
|
33
|
+
padding: '10px 10px 5px 10px'
|
|
34
|
+
},
|
|
35
|
+
items: {
|
|
36
|
+
display: 'grid',
|
|
37
|
+
gridTemplateColumns: '1fr 1fr',
|
|
38
|
+
width: '450px',
|
|
39
|
+
gap: '20px',
|
|
40
|
+
padding: '20px',
|
|
41
|
+
overflowY: 'auto'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
3
|
+
import {useStyles} from './styles';
|
|
4
|
+
|
|
5
|
+
const DashboardLinearLoader = () => {
|
|
6
|
+
const styles = useStyles();
|
|
7
|
+
return <LinearProgress color="primary" className={styles.loader} data-reltio-id="dashboard-item-loader" />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default DashboardLinearLoader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow} from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
5
|
+
import DashboardLinearLoader from '../DashboardLinearLoader';
|
|
6
|
+
|
|
7
|
+
describe('DashboardLinearLoader', () => {
|
|
8
|
+
it('should render DashboardLinearLoader', () => {
|
|
9
|
+
const wrapper = shallow(<DashboardLinearLoader />);
|
|
10
|
+
expect(wrapper.find(LinearProgress)).toHaveLength(1);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import i18n from 'ui-i18n';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import NoDataIcon from './icons/noData.svg';
|
|
5
|
+
import {useStyles} from './styles';
|
|
6
|
+
|
|
7
|
+
type DashboardNoDataProps = {
|
|
8
|
+
height?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const DashboardNoData = ({height}: DashboardNoDataProps) => {
|
|
12
|
+
const styles = useStyles({height});
|
|
13
|
+
return (
|
|
14
|
+
<div className={styles.noDataContainer}>
|
|
15
|
+
<NoDataIcon className={styles.icon} />
|
|
16
|
+
<Typography>{i18n.text('No Data')}</Typography>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default DashboardNoData;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow} from 'enzyme';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
|
|
5
|
+
import DashboardNoData from '../DashboardNoData';
|
|
6
|
+
import NoDataIcon from '../icons/noData.svg';
|
|
7
|
+
|
|
8
|
+
describe('DashboardNoData tests', () => {
|
|
9
|
+
it('should render DashboardNoData', () => {
|
|
10
|
+
const wrapper = shallow(<DashboardNoData />);
|
|
11
|
+
expect(wrapper.find('.noDataContainer').length).toBe(1);
|
|
12
|
+
expect(wrapper.find(NoDataIcon).length).toBe(1);
|
|
13
|
+
expect(wrapper.find(Typography).text()).toBe('No Data');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<svg width="148" height="148" viewBox="0 0 148 148" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<mask id="nodata__mask0" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="148" height="148">
|
|
3
|
+
<path d="M74 148C114.869 148 148 114.869 148 74C148 33.1309 114.869 0 74 0C33.1309 0 0 33.1309 0 74C0 114.869 33.1309 148 74 148Z" fill="white"/>
|
|
4
|
+
</mask>
|
|
5
|
+
<g mask="url(#nodata__mask0)">
|
|
6
|
+
<path d="M74 148C114.869 148 148 114.869 148 74C148 33.1309 114.869 0 74 0C33.1309 0 0 33.1309 0 74C0 114.869 33.1309 148 74 148Z" fill="#0072CE" fill-opacity="0.1"/>
|
|
7
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.20312H148V148H0V5.20312Z" fill="url(#nodata__paint0_linear)"/>
|
|
8
|
+
<g opacity="0.9">
|
|
9
|
+
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M25.186 26.0156H157.082V128.041H25.186V26.0156Z" fill="white" fill-opacity="0.8"/>
|
|
10
|
+
<path opacity="0.9" fill-rule="evenodd" clip-rule="evenodd" d="M16.7656 26.0214C16.7656 23.4639 18.8332 21.3906 21.3887 21.3906H150.795C153.348 21.3906 155.418 23.458 155.418 26.0214V114.128C155.418 116.686 153.351 118.759 150.795 118.759H21.3887C18.8355 118.759 16.7656 116.692 16.7656 114.128V26.0214Z" fill="white"/>
|
|
11
|
+
</g>
|
|
12
|
+
<path opacity="0.5" d="M141.553 50.9491C142.829 50.9491 143.864 49.9112 143.864 48.6308C143.864 47.3504 142.829 46.3125 141.553 46.3125C140.277 46.3125 139.242 47.3504 139.242 48.6308C139.242 49.9112 140.277 50.9491 141.553 50.9491Z" fill="#6DBCFF"/>
|
|
13
|
+
<path opacity="0.5" d="M133.465 50.9491C134.741 50.9491 135.776 49.9112 135.776 48.6308C135.776 47.3504 134.741 46.3125 133.465 46.3125C132.188 46.3125 131.154 47.3504 131.154 48.6308C131.154 49.9112 132.188 50.9491 133.465 50.9491Z" fill="#6DBCFF"/>
|
|
14
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.8082 46.3125C36.8393 46.3125 39.2965 48.7697 39.2965 51.8008V51.8361C39.2965 54.8672 36.8393 57.3244 33.8082 57.3244C30.777 57.3244 28.3198 54.8672 28.3198 51.8361V51.8008C28.3198 48.7697 30.777 46.3125 33.8082 46.3125Z" fill="#E3EBF4"/>
|
|
15
|
+
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M47.1022 46.1904H84.156C85.2763 46.1904 86.1845 47.0986 86.1845 48.2189C86.1845 49.3393 85.2763 50.2474 84.156 50.2474H47.1022C45.9819 50.2474 45.0737 49.3393 45.0737 48.2189C45.0737 47.0986 45.9819 46.1904 47.1022 46.1904Z" fill="#B1AABD"/>
|
|
16
|
+
<path opacity="0.43" fill-rule="evenodd" clip-rule="evenodd" d="M46.5227 53.7246H113.529C114.329 53.7246 114.978 54.3733 114.978 55.1735C114.978 55.9738 114.329 56.6225 113.529 56.6225H46.5227C45.7224 56.6225 45.0737 55.9738 45.0737 55.1735C45.0737 54.3733 45.7224 53.7246 46.5227 53.7246Z" fill="#B1AABD"/>
|
|
17
|
+
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M45.9431 58.9414H67.5628C68.0429 58.9414 68.4321 59.3306 68.4321 59.8108C68.4321 60.2909 68.0429 60.6801 67.5628 60.6801H45.9431C45.463 60.6801 45.0737 60.2909 45.0737 59.8108C45.0737 59.3306 45.463 58.9414 45.9431 58.9414Z" fill="#B1AABD"/>
|
|
18
|
+
<path opacity="0.5" d="M71.3497 30.6641H31.5075C29.747 30.6641 28.3198 32.0912 28.3198 33.8517C28.3198 35.6122 29.747 37.0394 31.5075 37.0394H71.3497C73.1102 37.0394 74.5374 35.6122 74.5374 33.8517C74.5374 32.0912 73.1102 30.6641 71.3497 30.6641Z" fill="#645F6D"/>
|
|
19
|
+
<path opacity="0.5" d="M141.553 72.9725C142.829 72.9725 143.864 71.9346 143.864 70.6542C143.864 69.3739 142.829 68.3359 141.553 68.3359C140.277 68.3359 139.242 69.3739 139.242 70.6542C139.242 71.9346 140.277 72.9725 141.553 72.9725Z" fill="#6DBCFF"/>
|
|
20
|
+
<path opacity="0.5" d="M133.465 72.9725C134.741 72.9725 135.776 71.9346 135.776 70.6542C135.776 69.3739 134.741 68.3359 133.465 68.3359C132.188 68.3359 131.154 69.3739 131.154 70.6542C131.154 71.9346 132.188 72.9725 133.465 72.9725Z" fill="#6DBCFF"/>
|
|
21
|
+
<path d="M39.2965 73.8243C39.2965 70.7931 36.8393 68.3359 33.8082 68.3359C30.777 68.3359 28.3198 70.7931 28.3198 73.8243V73.8595C28.3198 76.8906 30.777 79.3478 33.8082 79.3478C36.8393 79.3478 39.2965 76.8906 39.2965 73.8595V73.8243Z" fill="#E3EBF4"/>
|
|
22
|
+
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M47.1022 68.2139H90.9959C92.1162 68.2139 93.0244 69.1221 93.0244 70.2424C93.0244 71.3627 92.1162 72.2709 90.9959 72.2709H47.1022C45.9819 72.2709 45.0737 71.3627 45.0737 70.2424C45.0737 69.1221 45.9819 68.2139 47.1022 68.2139Z" fill="#B1AABD"/>
|
|
23
|
+
<path opacity="0.43" fill-rule="evenodd" clip-rule="evenodd" d="M46.5227 75.748H121.039C121.839 75.748 122.488 76.3968 122.488 77.197C122.488 77.9972 121.839 78.6459 121.039 78.6459H46.5227C45.7224 78.6459 45.0737 77.9972 45.0737 77.197C45.0737 76.3968 45.7224 75.748 46.5227 75.748Z" fill="#B1AABD"/>
|
|
24
|
+
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M45.9431 80.9648H106.02C106.5 80.9648 106.89 81.3541 106.89 81.8342C106.89 82.3143 106.5 82.7036 106.02 82.7036H45.9431C45.463 82.7036 45.0737 82.3143 45.0737 81.8342C45.0737 81.3541 45.463 80.9648 45.9431 80.9648Z" fill="#B1AABD"/>
|
|
25
|
+
<path opacity="0.5" d="M141.553 94.996C142.829 94.996 143.864 93.958 143.864 92.6777C143.864 91.3973 142.829 90.3594 141.553 90.3594C140.277 90.3594 139.242 91.3973 139.242 92.6777C139.242 93.958 140.277 94.996 141.553 94.996Z" fill="#6DBCFF"/>
|
|
26
|
+
<path opacity="0.5" d="M133.465 94.996C134.741 94.996 135.776 93.958 135.776 92.6777C135.776 91.3973 134.741 90.3594 133.465 90.3594C132.188 90.3594 131.154 91.3973 131.154 92.6777C131.154 93.958 132.188 94.996 133.465 94.996Z" fill="#6DBCFF"/>
|
|
27
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.8082 90.3594C36.8393 90.3594 39.2965 92.8166 39.2965 95.8477V95.8829C39.2965 98.9141 36.8393 101.371 33.8082 101.371C30.777 101.371 28.3198 98.9141 28.3198 95.8829V95.8477C28.3198 92.8166 30.777 90.3594 33.8082 90.3594Z" fill="#E3EBF4"/>
|
|
28
|
+
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M47.1022 90.2373H106.017C107.137 90.2373 108.045 91.1455 108.045 92.2658C108.045 93.3861 107.137 94.2943 106.017 94.2943H47.1022C45.9819 94.2943 45.0737 93.3861 45.0737 92.2658C45.0737 91.1455 45.9819 90.2373 47.1022 90.2373Z" fill="#B1AABD"/>
|
|
29
|
+
<path opacity="0.43" fill-rule="evenodd" clip-rule="evenodd" d="M46.5227 97.7715H95.6195C96.4198 97.7715 97.0685 98.4202 97.0685 99.2204C97.0685 100.021 96.4198 100.669 95.6195 100.669H46.5227C45.7224 100.669 45.0737 100.021 45.0737 99.2204C45.0737 98.4202 45.7224 97.7715 46.5227 97.7715Z" fill="#B1AABD"/>
|
|
30
|
+
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M45.9431 102.988H67.5628C68.0429 102.988 68.4321 103.378 68.4321 103.858C68.4321 104.338 68.0429 104.727 67.5628 104.727H45.9431C45.463 104.727 45.0737 104.338 45.0737 103.858C45.0737 103.378 45.463 102.988 45.9431 102.988Z" fill="#B1AABD"/>
|
|
31
|
+
<path opacity="0.1" fill-rule="evenodd" clip-rule="evenodd" d="M102.927 64.7495L147.463 141.889L88.474 175.946L43.9376 98.8067L44.3434 98.5723C48.4036 107.835 56.4168 115.284 66.8054 118.188C84.9076 123.247 103.367 112.589 108.037 94.3826C110.716 83.934 108.272 73.2698 102.28 65.1223L102.927 64.7495Z" fill="url(#nodata__paint1_linear)"/>
|
|
32
|
+
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M56.3516 103.62C66.7371 114.231 83.5754 114.231 93.9609 103.62C104.346 93.0084 104.346 75.8041 93.9609 65.1928C83.5754 54.5816 66.7371 54.5816 56.3516 65.1928C45.9661 75.8041 45.9661 93.0084 56.3516 103.62Z" fill="url(#nodata__paint2_linear)"/>
|
|
33
|
+
<g filter="url(#nodata__filter0_d)">
|
|
34
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M74.981 49.7188C94.0417 49.7188 109.493 65.1811 109.493 84.2549C109.493 93.0338 106.22 101.048 100.828 107.141L130.431 136.764C128.629 138.72 126.677 140.537 124.594 142.194L94.8894 112.469C89.2642 116.451 82.3957 118.791 74.981 118.791C55.9204 118.791 40.4688 103.329 40.4688 84.2549C40.4688 65.1811 55.9204 49.7188 74.981 49.7188ZM74.981 59.984C61.5859 59.984 50.7269 70.8505 50.7269 84.2549C50.7269 97.6594 61.5859 108.526 74.981 108.526C88.3762 108.526 99.2352 97.6594 99.2352 84.2549C99.2352 70.8505 88.3762 59.984 74.981 59.984Z" fill="#B5C8C9"/>
|
|
35
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M52.9029 110.801C45.3046 104.466 40.4688 94.9255 40.4688 84.2549C40.4688 65.1811 55.9204 49.7188 74.981 49.7188C85.6442 49.7188 95.1779 54.558 101.509 62.1615L95.8465 67.8276C90.9852 61.653 83.4458 57.6886 74.981 57.6886C60.319 57.6886 48.4331 69.5828 48.4331 84.2549C48.4331 92.7255 52.3947 100.27 58.565 105.135L52.9029 110.801Z" fill="white" fill-opacity="0.4"/>
|
|
36
|
+
</g>
|
|
37
|
+
<g style="mix-blend-mode:soft-light" opacity="0.4">
|
|
38
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M56.3516 103.62C66.7371 114.231 83.5754 114.231 93.9609 103.62C104.346 93.0084 104.346 75.8041 93.9609 65.1928C83.5754 54.5816 66.7371 54.5816 56.3516 65.1928C45.9661 75.8041 45.9661 93.0084 56.3516 103.62Z" fill="#D9F5FF"/>
|
|
39
|
+
</g>
|
|
40
|
+
<g style="mix-blend-mode:overlay">
|
|
41
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M71.621 91.7688C71.621 89.4975 71.8777 87.7045 72.3911 86.3899C72.9045 85.0753 73.7368 83.9358 74.888 82.9712C76.0392 82.0067 76.9143 81.1238 77.5133 80.3226C78.1122 79.5214 78.4117 78.6386 78.4117 77.674C78.4117 75.3249 77.4005 74.1503 75.3781 74.1503C74.4446 74.1503 73.6901 74.4926 73.1145 75.1771C72.5389 75.8616 72.2355 76.7872 72.2044 77.954H64.3169C64.348 74.8426 65.3281 72.4196 67.2572 70.6849C69.1863 68.9503 71.8932 68.083 75.3781 68.083C78.8473 68.083 81.5348 68.8842 83.4406 70.4866C85.3463 72.089 86.2992 74.3681 86.2992 77.324C86.2992 78.6152 86.0425 79.7898 85.5291 80.8477C85.0157 81.9056 84.1912 82.9868 83.0555 84.0913L80.3719 86.5883C79.6096 87.3195 79.0807 88.0701 78.7851 88.8402C78.4895 89.6103 78.3261 90.5865 78.295 91.7688H71.621ZM70.6642 98.8629C70.6642 97.7117 71.0804 96.7666 71.9127 96.0276C72.745 95.2886 73.7834 94.9191 75.028 94.9191C76.2726 94.9191 77.311 95.2886 78.1433 96.0276C78.9757 96.7666 79.3918 97.7117 79.3918 98.8629C79.3918 100.014 78.9757 100.959 78.1433 101.698C77.311 102.437 76.2726 102.807 75.028 102.807C73.7834 102.807 72.745 102.437 71.9127 101.698C71.0804 100.959 70.6642 100.014 70.6642 98.8629Z" fill="black" fill-opacity="0.87"/>
|
|
42
|
+
</g>
|
|
43
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M71.621 91.7688C71.621 89.4975 71.8777 87.7045 72.3911 86.3899C72.9045 85.0753 73.7368 83.9358 74.888 82.9712C76.0392 82.0067 76.9143 81.1238 77.5133 80.3226C78.1122 79.5214 78.4117 78.6386 78.4117 77.674C78.4117 75.3249 77.4005 74.1503 75.3781 74.1503C74.4446 74.1503 73.6901 74.4926 73.1145 75.1771C72.5389 75.8616 72.2355 76.7872 72.2044 77.954H64.3169C64.348 74.8426 65.3281 72.4196 67.2572 70.6849C69.1863 68.9503 71.8932 68.083 75.3781 68.083C78.8473 68.083 81.5348 68.8842 83.4406 70.4866C85.3463 72.089 86.2992 74.3681 86.2992 77.324C86.2992 78.6152 86.0425 79.7898 85.5291 80.8477C85.0157 81.9056 84.1912 82.9868 83.0555 84.0913L80.3719 86.5883C79.6096 87.3195 79.0807 88.0701 78.7851 88.8402C78.4895 89.6103 78.3261 90.5865 78.295 91.7688H71.621ZM70.6642 98.8629C70.6642 97.7117 71.0804 96.7666 71.9127 96.0276C72.745 95.2886 73.7834 94.9191 75.028 94.9191C76.2726 94.9191 77.311 95.2886 78.1433 96.0276C78.9757 96.7666 79.3918 97.7117 79.3918 98.8629C79.3918 100.014 78.9757 100.959 78.1433 101.698C77.311 102.437 76.2726 102.807 75.028 102.807C73.7834 102.807 72.745 102.437 71.9127 101.698C71.0804 100.959 70.6642 100.014 70.6642 98.8629Z" fill="#3C74B4" fill-opacity="0.38"/>
|
|
44
|
+
</g>
|
|
45
|
+
<defs>
|
|
46
|
+
<filter id="nodata__filter0_d" x="36.4688" y="47.7188" width="97.9619" height="100.475" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
47
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
48
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
|
49
|
+
<feOffset dy="2"/>
|
|
50
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
51
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>
|
|
52
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
|
53
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
|
54
|
+
</filter>
|
|
55
|
+
<linearGradient id="nodata__paint0_linear" x1="74" y1="5.20312" x2="74" y2="148" gradientUnits="userSpaceOnUse">
|
|
56
|
+
<stop stop-color="#FAFAFA" stop-opacity="0"/>
|
|
57
|
+
<stop offset="1" stop-color="#F4F4F4"/>
|
|
58
|
+
</linearGradient>
|
|
59
|
+
<linearGradient id="nodata__paint1_linear" x1="123.612" y1="142.028" x2="76.7287" y2="122.717" gradientUnits="userSpaceOnUse">
|
|
60
|
+
<stop stop-opacity="0"/>
|
|
61
|
+
<stop offset="1"/>
|
|
62
|
+
</linearGradient>
|
|
63
|
+
<linearGradient id="nodata__paint2_linear" x1="75.1562" y1="57.2344" x2="75.1562" y2="111.578" gradientUnits="userSpaceOnUse">
|
|
64
|
+
<stop stop-color="#EEFBFF"/>
|
|
65
|
+
<stop offset="1" stop-color="#0072CE"/>
|
|
66
|
+
</linearGradient>
|
|
67
|
+
</defs>
|
|
68
|
+
</svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
type NoDataContainer = {
|
|
4
|
+
height?: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const useStyles = makeStyles(() => ({
|
|
8
|
+
noDataContainer: ({height}: NoDataContainer) => ({
|
|
9
|
+
height: height ? `${height}px` : 'auto',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
color: 'rgba(0, 0, 0, 0.54)'
|
|
15
|
+
}),
|
|
16
|
+
icon: {
|
|
17
|
+
height: '88px',
|
|
18
|
+
width: '88px',
|
|
19
|
+
marginBottom: '20px'
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import i18n from 'ui-i18n';
|
|
3
|
+
import Button from '@mui/material/Button';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
6
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
7
|
+
import {DropDownMenuButton, MultilineMenuItem, SmallIconButton} from '@reltio/components';
|
|
8
|
+
|
|
9
|
+
import {useStyles} from './styles';
|
|
10
|
+
|
|
11
|
+
type MultilineMenuItemProps = React.ComponentProps<typeof MultilineMenuItem>;
|
|
12
|
+
type Props = {
|
|
13
|
+
title: string;
|
|
14
|
+
onToggleConfig: () => void;
|
|
15
|
+
menuItems: MultilineMenuItemProps['item'][];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const DashboardPerspectiveHeader = ({title, onToggleConfig, menuItems}: Props) => {
|
|
19
|
+
const styles = useStyles();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={styles.header}>
|
|
23
|
+
<Typography className={styles.headerText} variant="body2">
|
|
24
|
+
{i18n.text(title)}
|
|
25
|
+
</Typography>
|
|
26
|
+
<Button className={styles.toggleButton} onClick={onToggleConfig} startIcon={<AddIcon />}>
|
|
27
|
+
{i18n.text('Add / remove charts')}
|
|
28
|
+
</Button>
|
|
29
|
+
<DropDownMenuButton
|
|
30
|
+
menuId="dashboard-header-menu"
|
|
31
|
+
buttonComponent={SmallIconButton}
|
|
32
|
+
buttonProps={{
|
|
33
|
+
icon: MoreVertIcon,
|
|
34
|
+
size: 'L',
|
|
35
|
+
'data-reltio-id': 'reltio-dashboard-header-menu',
|
|
36
|
+
className: styles.menuButton
|
|
37
|
+
}}
|
|
38
|
+
menuItems={menuItems}
|
|
39
|
+
MenuItemRenderer={MultilineMenuItem}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
package/src/components/DashboardPerspectiveHeader/__tests__/DashboardPerspectiveHeader.specs.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {render, screen} from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import {DashboardPerspectiveHeader} from '../DashboardPerspectiveHeader';
|
|
5
|
+
|
|
6
|
+
describe('DashboardPerspectiveHeader tests', () => {
|
|
7
|
+
const menuItems = [
|
|
8
|
+
{primary: 'Option 1', secondary: 'description 1', onClick: jest.fn()},
|
|
9
|
+
{primary: 'Option 2', secondary: 'description 2', onClick: jest.fn()}
|
|
10
|
+
];
|
|
11
|
+
const props = {title: 'Title', menuItems, onToggleConfig: jest.fn()};
|
|
12
|
+
|
|
13
|
+
const setUp = () => {
|
|
14
|
+
const user = userEvent.setup();
|
|
15
|
+
return {user, ...render(<DashboardPerspectiveHeader {...props} />)};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
it('should render DashboardPerspectiveHeader with default title', () => {
|
|
19
|
+
setUp();
|
|
20
|
+
expect(screen.getByText(props.title)).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByRole('button', {name: 'Add / remove charts'})).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByTestId('reltio-dashboard-header-menu')).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should call onToggleConfig after click on Add / remove charts button', async () => {
|
|
26
|
+
const {user} = setUp();
|
|
27
|
+
await user.click(screen.getByRole('button', {name: 'Add / remove charts'}));
|
|
28
|
+
expect(props.onToggleConfig).toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should render correct header menu', async () => {
|
|
32
|
+
const {user} = setUp();
|
|
33
|
+
for (const {primary, secondary, onClick} of menuItems) {
|
|
34
|
+
await user.click(screen.getByTestId('reltio-dashboard-header-menu'));
|
|
35
|
+
expect(screen.getByText(primary)).toBeInTheDocument();
|
|
36
|
+
expect(screen.getByText(secondary)).toBeInTheDocument();
|
|
37
|
+
await user.click(screen.getByText(primary));
|
|
38
|
+
expect(onClick).toHaveBeenCalled();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles((theme) => ({
|
|
4
|
+
header: {
|
|
5
|
+
height: '50px',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
padding: '0 20px',
|
|
9
|
+
flexShrink: 0,
|
|
10
|
+
borderBottom: 'solid 1px rgba(0, 0, 0, 0.12)'
|
|
11
|
+
},
|
|
12
|
+
headerText: {
|
|
13
|
+
fontSize: '18px',
|
|
14
|
+
marginRight: 'auto'
|
|
15
|
+
},
|
|
16
|
+
toggleButton: {
|
|
17
|
+
color: theme.palette.primary.main
|
|
18
|
+
},
|
|
19
|
+
menuButton: {
|
|
20
|
+
marginLeft: 8
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export {useStyles};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, {useState, ReactNode, MouseEvent} from 'react';
|
|
2
|
+
import Menu from '@mui/material/Menu';
|
|
3
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
6
|
+
import IconButton from '@mui/material/IconButton';
|
|
7
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
8
|
+
import {useStyles} from './styles';
|
|
9
|
+
|
|
10
|
+
interface MenuItem {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
icon: ReactNode;
|
|
14
|
+
active: boolean;
|
|
15
|
+
action: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type DashboardPopupMenuProps = {
|
|
19
|
+
items: MenuItem[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const DashboardPopupMenu = ({items}: DashboardPopupMenuProps) => {
|
|
23
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
24
|
+
const isMenuOpen = Boolean(anchorEl);
|
|
25
|
+
const styles = useStyles();
|
|
26
|
+
|
|
27
|
+
const handleMenuClick = (e: MouseEvent<HTMLButtonElement>) => setAnchorEl(e.currentTarget);
|
|
28
|
+
|
|
29
|
+
const handleMenuClose = () => setAnchorEl(null);
|
|
30
|
+
|
|
31
|
+
const handleItemClick = (action: () => void) => () => {
|
|
32
|
+
handleMenuClose();
|
|
33
|
+
action();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<IconButton
|
|
39
|
+
className={styles.openIcon}
|
|
40
|
+
aria-controls="menu"
|
|
41
|
+
aria-haspopup="true"
|
|
42
|
+
onClick={handleMenuClick}
|
|
43
|
+
size="large"
|
|
44
|
+
>
|
|
45
|
+
<MoreVertIcon />
|
|
46
|
+
</IconButton>
|
|
47
|
+
<Menu
|
|
48
|
+
id="menu"
|
|
49
|
+
anchorEl={anchorEl}
|
|
50
|
+
open={isMenuOpen}
|
|
51
|
+
onClose={handleMenuClose}
|
|
52
|
+
transitionDuration={0}
|
|
53
|
+
anchorOrigin={{
|
|
54
|
+
vertical: 'bottom',
|
|
55
|
+
horizontal: 'right'
|
|
56
|
+
}}
|
|
57
|
+
transformOrigin={{
|
|
58
|
+
vertical: 'top',
|
|
59
|
+
horizontal: 'right'
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{items
|
|
63
|
+
.filter((item) => item.active)
|
|
64
|
+
.map(({id, icon, title, action}) => (
|
|
65
|
+
<MenuItem key={id} onClick={handleItemClick(action)} className={styles.menuItem}>
|
|
66
|
+
<ListItemIcon className={styles.itemIcon}>{icon}</ListItemIcon>
|
|
67
|
+
<Typography className={styles.itemTitle}>{title}</Typography>
|
|
68
|
+
</MenuItem>
|
|
69
|
+
))}
|
|
70
|
+
</Menu>
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default DashboardPopupMenu;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow} from 'enzyme';
|
|
3
|
+
import DashboardPopupMenu from '../DashboardPopupMenu';
|
|
4
|
+
import {Add, Clear, Remove} from '@mui/icons-material';
|
|
5
|
+
import {IconButton, ListItemIcon, Menu, MenuItem, Typography} from '@mui/material';
|
|
6
|
+
|
|
7
|
+
describe('DashboardPopupMenu', () => {
|
|
8
|
+
const items = [
|
|
9
|
+
{
|
|
10
|
+
id: 'first',
|
|
11
|
+
title: 'First',
|
|
12
|
+
icon: <Add />,
|
|
13
|
+
active: true,
|
|
14
|
+
action: jest.fn()
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'second',
|
|
18
|
+
title: 'Second',
|
|
19
|
+
icon: <Clear />,
|
|
20
|
+
active: true,
|
|
21
|
+
action: jest.fn()
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'third',
|
|
25
|
+
title: 'Third',
|
|
26
|
+
icon: <Remove />,
|
|
27
|
+
active: false,
|
|
28
|
+
action: jest.fn()
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
it('should render Dashboard popup menu', () => {
|
|
32
|
+
const wrapper = shallow(<DashboardPopupMenu items={items} />);
|
|
33
|
+
expect(wrapper.find(IconButton).length).toBe(1);
|
|
34
|
+
expect(wrapper.find(Menu).length).toBe(1);
|
|
35
|
+
expect(wrapper.find(MenuItem).length).toBe(2);
|
|
36
|
+
expect(wrapper.find(ListItemIcon).length).toBe(2);
|
|
37
|
+
const typography = wrapper.find(Typography);
|
|
38
|
+
expect(typography.length).toBe(2);
|
|
39
|
+
wrapper.find(IconButton).simulate('click', {currentTarget: {}});
|
|
40
|
+
expect(wrapper.find(Menu).prop('open')).toBe(true);
|
|
41
|
+
items.forEach((item, i) => {
|
|
42
|
+
if (item.active) {
|
|
43
|
+
expect(typography.at(i).text()).toBe(item.title);
|
|
44
|
+
wrapper.find(MenuItem).at(i).simulate('click');
|
|
45
|
+
expect(item.action).toBeCalledTimes(1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
wrapper.find(Menu).prop('onClose')({}, 'escapeKeyDown');
|
|
49
|
+
expect(wrapper.find(Menu).prop('open')).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
export const useStyles = makeStyles(() => ({
|
|
4
|
+
itemTitle: {
|
|
5
|
+
fontSize: '13px'
|
|
6
|
+
},
|
|
7
|
+
itemIcon: {
|
|
8
|
+
minWidth: '49px'
|
|
9
|
+
},
|
|
10
|
+
menuItem: {
|
|
11
|
+
padding: '12px 16px',
|
|
12
|
+
minWidth: '177px'
|
|
13
|
+
},
|
|
14
|
+
openIcon: {
|
|
15
|
+
padding: '4px',
|
|
16
|
+
borderRadius: '2px',
|
|
17
|
+
marginTop: '-6px',
|
|
18
|
+
marginRight: '-10px'
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {BasicTable} from '@reltio/components';
|
|
3
|
+
import HeadCellRenderer from './cell-renderers/HeadCellRenderer';
|
|
4
|
+
import EntityLabelRenderer from './cell-renderers/EntityLabelRenderer';
|
|
5
|
+
import {EntityData} from '../../types/EntityData';
|
|
6
|
+
import i18n from 'ui-i18n';
|
|
7
|
+
|
|
8
|
+
import {useStyles} from './styles';
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
basicTableRef?: React.MutableRefObject<any> | null;
|
|
14
|
+
data: EntityData[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const EntityTable = ({height, width, basicTableRef, data}: Props) => {
|
|
18
|
+
const styles = useStyles({width, height});
|
|
19
|
+
const headData = [
|
|
20
|
+
{
|
|
21
|
+
id: 'label',
|
|
22
|
+
label: i18n.text('Entity'),
|
|
23
|
+
resizable: false,
|
|
24
|
+
headCellRenderer: HeadCellRenderer,
|
|
25
|
+
rowCellValueRenderer: EntityLabelRenderer,
|
|
26
|
+
initialWidth: width
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
const tableClasses = {
|
|
30
|
+
cellBorder: styles.cellBorder
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className={styles.tableContainer}>
|
|
35
|
+
<BasicTable
|
|
36
|
+
columnsData={headData}
|
|
37
|
+
rowsData={data}
|
|
38
|
+
headRowHeight={48}
|
|
39
|
+
getRowCellHeight={null}
|
|
40
|
+
classes={tableClasses}
|
|
41
|
+
defaultColumnWidth={100}
|
|
42
|
+
defaultColumnMinWidth={100}
|
|
43
|
+
ref={basicTableRef}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default EntityTable;
|