@centreon/ui 23.10.30-MON-19324-dashboard-section-navigation.3 → 23.10.30
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/package.json +9 -12
- package/src/@assets/icons/downtime.icon.svg +1 -0
- package/src/Dashboard/DashboardLayout.stories.tsx +5 -3
- package/src/Dashboard/Layout.tsx +4 -4
- package/src/Dashboard/utils.ts +28 -28
- package/src/Graph/BasicComponents/Axes/UnitLabel.tsx +20 -0
- package/src/Graph/BasicComponents/Axes/index.tsx +88 -0
- package/src/Graph/BasicComponents/Axes/models.ts +26 -0
- package/src/Graph/BasicComponents/Axes/useAxisY.ts +100 -0
- package/src/Graph/BasicComponents/Grids/index.tsx +20 -0
- package/src/Graph/BasicComponents/Lines/RegularLines/index.tsx +91 -0
- package/src/Graph/BasicComponents/Lines/RegularLines/useRegularLines.ts +15 -0
- package/src/Graph/BasicComponents/Lines/StackedLines/index.tsx +76 -0
- package/src/Graph/BasicComponents/Lines/StackedLines/useStackedLines.ts +39 -0
- package/src/Graph/BasicComponents/Lines/Threshold/BasicThreshold.tsx +51 -0
- package/src/Graph/BasicComponents/Lines/Threshold/Circle.tsx +43 -0
- package/src/Graph/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +73 -0
- package/src/Graph/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +59 -0
- package/src/Graph/BasicComponents/Lines/Threshold/helpers/index.ts +69 -0
- package/src/Graph/BasicComponents/Lines/Threshold/index.tsx +138 -0
- package/src/Graph/BasicComponents/Lines/Threshold/models.ts +105 -0
- package/src/Graph/BasicComponents/Lines/Threshold/useCoordinateCircle.ts +46 -0
- package/src/Graph/BasicComponents/Lines/Threshold/useScaleThreshold.ts +171 -0
- package/src/Graph/BasicComponents/Lines/index.tsx +180 -0
- package/src/Graph/BasicComponents/Lines/models.ts +42 -0
- package/src/Graph/BasicComponents/LoadingProgress.tsx +46 -0
- package/src/Graph/BasicComponents/useFilterLines.ts +60 -0
- package/src/Graph/Graph.styles.ts +45 -0
- package/src/Graph/Graph.tsx +217 -0
- package/src/Graph/Header/index.tsx +65 -0
- package/src/Graph/Icons/Downtime.tsx +9 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/AnchorPoint.styles.ts +58 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/GuidingLines.tsx +45 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +66 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +76 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +70 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/index.tsx +20 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/models.ts +62 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/useTickGraph.ts +94 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +107 -0
- package/src/Graph/InteractiveComponents/Annotations/Annotation/Area.tsx +114 -0
- package/src/Graph/InteractiveComponents/Annotations/Annotation/Line.tsx +103 -0
- package/src/Graph/InteractiveComponents/Annotations/Annotation/index.tsx +81 -0
- package/src/Graph/InteractiveComponents/Annotations/Area/Downtime.tsx +27 -0
- package/src/Graph/InteractiveComponents/Annotations/EventAnnotations.tsx +61 -0
- package/src/Graph/InteractiveComponents/Annotations/Line/Acknowledgement.tsx +27 -0
- package/src/Graph/InteractiveComponents/Annotations/Line/Comments.tsx +25 -0
- package/src/Graph/InteractiveComponents/Annotations/annotationsAtoms.ts +183 -0
- package/src/Graph/InteractiveComponents/Annotations/index.tsx +49 -0
- package/src/Graph/InteractiveComponents/Annotations/models.ts +25 -0
- package/src/Graph/InteractiveComponents/Annotations/useAnnotation.ts +56 -0
- package/src/Graph/InteractiveComponents/Bar.tsx +21 -0
- package/src/Graph/InteractiveComponents/TimeShiftZones/TimeShiftIcon.tsx +62 -0
- package/src/Graph/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +74 -0
- package/src/Graph/InteractiveComponents/TimeShiftZones/index.tsx +85 -0
- package/src/Graph/InteractiveComponents/TimeShiftZones/models.ts +12 -0
- package/src/Graph/InteractiveComponents/TimeShiftZones/useTimeShiftZones.ts +72 -0
- package/src/Graph/InteractiveComponents/Tooltip/index.tsx +59 -0
- package/src/Graph/InteractiveComponents/Tooltip/models.ts +9 -0
- package/src/Graph/InteractiveComponents/Tooltip/useGraphTooltip.ts +67 -0
- package/src/Graph/InteractiveComponents/ZoomPreview/index.tsx +38 -0
- package/src/Graph/InteractiveComponents/ZoomPreview/models.ts +9 -0
- package/src/Graph/InteractiveComponents/ZoomPreview/useZoomPreview.ts +107 -0
- package/src/Graph/InteractiveComponents/ZoomPreview/zoomPreviewAtoms.ts +3 -0
- package/src/Graph/InteractiveComponents/index.tsx +168 -0
- package/src/Graph/InteractiveComponents/interactionWithGraphAtoms.ts +51 -0
- package/src/Graph/Legend/InteractiveValue.tsx +22 -0
- package/src/Graph/Legend/Legend.styles.ts +71 -0
- package/src/Graph/Legend/LegendContent.tsx +27 -0
- package/src/Graph/Legend/LegendHeader.tsx +45 -0
- package/src/Graph/Legend/Marker.tsx +43 -0
- package/src/Graph/Legend/index.tsx +166 -0
- package/src/Graph/Legend/models.ts +11 -0
- package/src/Graph/Legend/useInteractiveValues.ts +86 -0
- package/src/Graph/Legend/useLegend.ts +114 -0
- package/src/Graph/LoadingSkeleton.tsx +44 -0
- package/src/Graph/common/index.ts +35 -0
- package/src/Graph/graphAtoms.ts +6 -0
- package/src/Graph/helpers/doc.ts +560 -0
- package/src/Graph/helpers/index.ts +58 -0
- package/src/Graph/index.stories.tsx +372 -0
- package/src/Graph/index.tsx +90 -0
- package/src/Graph/mockedData/annotationData.json +326 -0
- package/src/Graph/mockedData/exclusionPeriodFirstPeriod.json +588 -0
- package/src/Graph/mockedData/exclusionPeriodSecondPeriod.json +588 -0
- package/src/Graph/mockedData/exclusionPeriodThirdPeriod.json +581 -0
- package/src/Graph/mockedData/lastDay.json +1326 -0
- package/src/Graph/mockedData/lastDayAreaStack.json +3106 -0
- package/src/Graph/mockedData/lastDayForward.json +1338 -0
- package/src/Graph/mockedData/lastDayThreshold.json +2352 -0
- package/src/Graph/mockedData/lastMonth.json +1674 -0
- package/src/Graph/mockedData/lastWeek.json +2202 -0
- package/src/Graph/mockedData/zoomPreview.json +742 -0
- package/src/Graph/models.ts +150 -0
- package/src/Graph/timeSeries/index.test.ts +506 -0
- package/src/Graph/timeSeries/index.ts +512 -0
- package/src/Graph/timeSeries/models.ts +120 -0
- package/src/Graph/translatedLabels.ts +9 -0
- package/src/Graph/useGraphData.ts +47 -0
- package/src/Graph/useGraphIntersection.ts +36 -0
- package/src/ThemeProvider/index.tsx +5 -6
- package/src/ThemeProvider/palettes.ts +215 -385
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +51 -0
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.tsx +95 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/ErrorText.tsx +14 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +163 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/index.tsx +76 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +61 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/usePickersStartEndDate.ts +82 -0
- package/src/TimePeriods/CustomTimePeriod/index.tsx +66 -0
- package/src/TimePeriods/DateTimePickerInput.tsx +49 -0
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +65 -0
- package/src/TimePeriods/SelectedTimePeriod.tsx +102 -0
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +510 -0
- package/src/TimePeriods/TimePeriods.styles.ts +22 -0
- package/src/TimePeriods/helpers/index.ts +26 -0
- package/src/TimePeriods/index.stories.tsx +98 -0
- package/src/TimePeriods/index.tsx +78 -0
- package/src/TimePeriods/mockedData.ts +12 -0
- package/src/TimePeriods/models.ts +97 -0
- package/src/TimePeriods/timePeriodsAtoms.ts +102 -0
- package/src/TimePeriods/translatedLabels.ts +9 -0
- package/src/TimePeriods/useSortTimePeriods.ts +31 -0
- package/src/TimePeriods/useTimePeriod.ts +49 -0
- package/src/api/TestQueryProvider.tsx +1 -2
- package/src/api/useFetchQuery/index.ts +7 -8
- package/src/api/useMutationQuery/index.ts +10 -11
- package/src/components/Button/Button.styles.ts +3 -17
- package/src/components/Button/Button.tsx +3 -6
- package/src/components/Button/Icon/IconButton.styles.ts +2 -9
- package/src/components/DataTable/DataTable.stories.tsx +0 -9
- package/src/components/DataTable/DataTable.styles.ts +0 -5
- package/src/components/DataTable/DataTable.tsx +6 -8
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +1 -4
- package/src/components/DataTable/Item/DataTableItem.styles.ts +2 -5
- package/src/components/DataTable/Item/DataTableItem.tsx +18 -36
- package/src/components/Header/Header.stories.tsx +27 -0
- package/src/components/Header/Header.styles.ts +27 -0
- package/src/components/Header/Header.tsx +23 -0
- package/src/components/Header/index.ts +1 -1
- package/src/components/Modal/index.ts +0 -2
- package/src/components/index.ts +0 -3
- package/src/index.ts +2 -0
- package/src/layout/TiledListingPage/TiledListingActions.tsx +15 -0
- package/src/layout/TiledListingPage/TiledListingContent.tsx +21 -0
- package/src/layout/TiledListingPage/TiledListingList.tsx +11 -0
- package/src/layout/TiledListingPage/TiledListingPage.styles.ts +16 -0
- package/src/layout/TiledListingPage/TiledListingPage.tsx +15 -0
- package/src/layout/TiledListingPage/index.ts +4 -0
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +102 -110
- package/src/utils/index.ts +1 -1
- package/src/utils/sanitizedHTML.ts +1 -1
- package/test/setupTests.js +0 -3
- package/src/base/tokens/README.md +0 -3
- package/src/base/tokens/source/$metadata.json +0 -5
- package/src/base/tokens/source/base.json +0 -142
- package/src/base/tokens/themes/base.tokens.d.ts +0 -38
- package/src/base/tokens/themes/base.tokens.json +0 -695
- package/src/base/tokens/themes/base.tokens.ts +0 -38
- package/src/base/tokens/themes/ui-dark.tokens.d.ts +0 -38
- package/src/base/tokens/themes/ui-dark.tokens.json +0 -695
- package/src/base/tokens/themes/ui-dark.tokens.ts +0 -38
- package/src/base/tokens/themes/ui-light.tokens.d.ts +0 -38
- package/src/base/tokens/themes/ui-light.tokens.json +0 -695
- package/src/base/tokens/themes/ui-light.tokens.ts +0 -38
- package/src/components/Header/PageHeader/PageHeader.stories.tsx +0 -88
- package/src/components/Header/PageHeader/PageHeader.styles.ts +0 -99
- package/src/components/Header/PageHeader/PageHeader.tsx +0 -15
- package/src/components/Header/PageHeader/PageHeaderActions.tsx +0 -17
- package/src/components/Header/PageHeader/PageHeaderMain.tsx +0 -15
- package/src/components/Header/PageHeader/PageHeaderMenu.tsx +0 -15
- package/src/components/Header/PageHeader/PageHeaderTitle.tsx +0 -47
- package/src/components/Header/PageHeader/index.ts +0 -12
- package/src/components/Layout/AreaIndicator.styles.ts +0 -33
- package/src/components/Layout/AreaIndicator.tsx +0 -35
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +0 -81
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +0 -40
- package/src/components/Layout/PageLayout/PageLayout.tsx +0 -21
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -15
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -24
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +0 -15
- package/src/components/Layout/PageLayout/index.ts +0 -10
- package/src/components/Layout/index.ts +0 -1
- package/src/components/Menu/Button/MenuButton.stories.tsx +0 -16
- package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
- package/src/components/Menu/Button/MenuButton.tsx +0 -59
- package/src/components/Menu/Button/index.ts +0 -1
- package/src/components/Menu/Menu.stories.tsx +0 -71
- package/src/components/Menu/Menu.styles.ts +0 -70
- package/src/components/Menu/Menu.tsx +0 -25
- package/src/components/Menu/MenuDivider.tsx +0 -13
- package/src/components/Menu/MenuItem.tsx +0 -36
- package/src/components/Menu/MenuItems.tsx +0 -35
- package/src/components/Menu/index.ts +0 -12
- package/src/components/Menu/useMenu.tsx +0 -79
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +0 -71
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +0 -5
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +0 -115
- package/src/components/Tooltip/TextOverflowTooltip/index.tsx +0 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -41
- package/src/components/Tooltip/Tooltip.styles.ts +0 -5
- package/src/components/Tooltip/Tooltip.tsx +0 -46
- package/src/components/Tooltip/index.ts +0 -1
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
- package/src/utils/useResizeObserver.ts +0 -6
|
@@ -16,11 +16,6 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
16
16
|
width: '100%'
|
|
17
17
|
},
|
|
18
18
|
display: 'flex'
|
|
19
|
-
},
|
|
20
|
-
dataTableScrollContainer: {
|
|
21
|
-
// FIXME the global -webkit-scrollbar styles are not optimal for this component in grid variant
|
|
22
|
-
height: '100%',
|
|
23
|
-
overflowY: 'auto'
|
|
24
19
|
}
|
|
25
20
|
}));
|
|
26
21
|
|
|
@@ -20,14 +20,12 @@ const DataTable = ({
|
|
|
20
20
|
const { classes } = useStyles();
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{children}
|
|
30
|
-
</div>
|
|
23
|
+
<div
|
|
24
|
+
className={classes.dataTable}
|
|
25
|
+
data-is-empty={isEmpty}
|
|
26
|
+
data-variant={variant}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
31
29
|
</div>
|
|
32
30
|
);
|
|
33
31
|
};
|
|
@@ -27,10 +27,7 @@ const DataTableEmptyState = ({
|
|
|
27
27
|
const { t } = useTranslation();
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<div
|
|
31
|
-
className={classes.dataTableEmptyState}
|
|
32
|
-
data-testid="data-table-empty-state"
|
|
33
|
-
>
|
|
30
|
+
<div className={classes.dataTableEmptyState}>
|
|
34
31
|
<MuiTypography variant="h2">{t(labels.title)}</MuiTypography>
|
|
35
32
|
<div className={classes.actions}>
|
|
36
33
|
<Button
|
|
@@ -10,13 +10,10 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
10
10
|
justifyContent: 'space-between'
|
|
11
11
|
},
|
|
12
12
|
'& .MuiCardActions-root': {
|
|
13
|
-
'& > span': {
|
|
14
|
-
display: 'flex',
|
|
15
|
-
gap: theme.spacing(1)
|
|
16
|
-
},
|
|
17
13
|
display: 'flex',
|
|
14
|
+
flexDirection: 'row-reverse',
|
|
15
|
+
gap: theme.spacing(1),
|
|
18
16
|
|
|
19
|
-
justifyContent: 'space-between',
|
|
20
17
|
opacity: 0
|
|
21
18
|
},
|
|
22
19
|
'&:hover .MuiCardActions-root': {
|
|
@@ -7,11 +7,7 @@ import {
|
|
|
7
7
|
CardContent as MuiCardContent,
|
|
8
8
|
Typography as MuiTypography
|
|
9
9
|
} from '@mui/material';
|
|
10
|
-
import {
|
|
11
|
-
Delete as DeleteIcon,
|
|
12
|
-
Settings as SettingsIcon,
|
|
13
|
-
Share as ShareIcon
|
|
14
|
-
} from '@mui/icons-material';
|
|
10
|
+
import { Delete as DeleteIcon, Edit as EditIcon } from '@mui/icons-material';
|
|
15
11
|
|
|
16
12
|
import { IconButton } from '../../Button';
|
|
17
13
|
|
|
@@ -24,7 +20,6 @@ export interface DataTableItemProps {
|
|
|
24
20
|
onClick?: () => void;
|
|
25
21
|
onDelete?: () => void;
|
|
26
22
|
onEdit?: () => void;
|
|
27
|
-
onEditAccessRights?: () => void;
|
|
28
23
|
title: string;
|
|
29
24
|
}
|
|
30
25
|
|
|
@@ -37,8 +32,7 @@ const DataTableItem = forwardRef(
|
|
|
37
32
|
hasActions = false,
|
|
38
33
|
onClick,
|
|
39
34
|
onEdit,
|
|
40
|
-
onDelete
|
|
41
|
-
onEditAccessRights
|
|
35
|
+
onDelete
|
|
42
36
|
}: DataTableItemProps,
|
|
43
37
|
ref
|
|
44
38
|
): ReactElement => {
|
|
@@ -63,34 +57,22 @@ const DataTableItem = forwardRef(
|
|
|
63
57
|
</ActionArea>
|
|
64
58
|
{hasActions && (
|
|
65
59
|
<MuiCardActions>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
variant="primary"
|
|
83
|
-
onClick={() => onEditAccessRights?.()}
|
|
84
|
-
/>
|
|
85
|
-
<IconButton
|
|
86
|
-
aria-label="edit"
|
|
87
|
-
data-testid="edit"
|
|
88
|
-
icon={<SettingsIcon />}
|
|
89
|
-
size="small"
|
|
90
|
-
variant="primary"
|
|
91
|
-
onClick={() => onEdit?.()}
|
|
92
|
-
/>
|
|
93
|
-
</span>
|
|
60
|
+
<IconButton
|
|
61
|
+
aria-label="edit"
|
|
62
|
+
data-testid="edit"
|
|
63
|
+
icon={<EditIcon />}
|
|
64
|
+
size="small"
|
|
65
|
+
variant="primary"
|
|
66
|
+
onClick={() => onEdit?.()}
|
|
67
|
+
/>
|
|
68
|
+
<IconButton
|
|
69
|
+
aria-label="delete"
|
|
70
|
+
data-testid="delete"
|
|
71
|
+
icon={<DeleteIcon />}
|
|
72
|
+
size="small"
|
|
73
|
+
variant="ghost"
|
|
74
|
+
onClick={() => onDelete?.()}
|
|
75
|
+
/>
|
|
94
76
|
</MuiCardActions>
|
|
95
77
|
)}
|
|
96
78
|
</MuiCard>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Settings as SettingsIcon } from '@mui/icons-material';
|
|
4
|
+
|
|
5
|
+
import { IconButton } from '../Button';
|
|
6
|
+
|
|
7
|
+
import { Header } from './Header';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Header> = {
|
|
10
|
+
component: Header
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof Header>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
title: 'Header'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const WithNav: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
nav: <IconButton icon={<SettingsIcon />} size="small" variant="ghost" />,
|
|
25
|
+
title: 'Header with nav'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles()((theme) => ({
|
|
4
|
+
header: {
|
|
5
|
+
alignItems: 'flex-start',
|
|
6
|
+
borderBottom: `1px solid ${theme.palette.primary.main}`,
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
h1: {
|
|
10
|
+
font: 'normal normal 600 24px/24px Roboto',
|
|
11
|
+
letterSpacing: '0.18px',
|
|
12
|
+
margin: theme.spacing(0, 0, 1.5, 0)
|
|
13
|
+
},
|
|
14
|
+
justifyContent: 'space-between',
|
|
15
|
+
marginBottom: theme.spacing(2.5),
|
|
16
|
+
|
|
17
|
+
nav: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
gap: theme.spacing(1),
|
|
20
|
+
justifyContent: 'flex-end'
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
padding: theme.spacing(0, 0, 1.5, 0)
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
export { useStyles };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Typography as MuiTypography } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
import { useStyles } from './Header.styles';
|
|
6
|
+
|
|
7
|
+
type HeaderProps = {
|
|
8
|
+
nav?: ReactNode;
|
|
9
|
+
title: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Header = ({ title, nav }: HeaderProps): ReactElement => {
|
|
13
|
+
const { classes } = useStyles();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<header className={classes.header}>
|
|
17
|
+
<MuiTypography variant="h1">{title}</MuiTypography>
|
|
18
|
+
{nav && <nav>{nav}</nav>}
|
|
19
|
+
</header>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { Header };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './Header';
|
package/src/components/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -140,6 +140,8 @@ export { default as ActionsList } from './ActionsList';
|
|
|
140
140
|
|
|
141
141
|
export type { ResponseError, CatchErrorProps } from './api/customFetch';
|
|
142
142
|
|
|
143
|
+
export * from './layout/TiledListingPage';
|
|
144
|
+
|
|
143
145
|
export * from './utils';
|
|
144
146
|
export { default as FluidTypography } from './Typography/FluidTypography';
|
|
145
147
|
export * from './Dashboard';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTiledListingActionsStyles } from './TiledListingPage.styles';
|
|
4
|
+
|
|
5
|
+
interface TiledListingActionsProps {
|
|
6
|
+
children: Array<ReactNode> | ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const TiledListingActions = ({
|
|
10
|
+
children
|
|
11
|
+
}: TiledListingActionsProps): JSX.Element => {
|
|
12
|
+
const { classes } = useTiledListingActionsStyles();
|
|
13
|
+
|
|
14
|
+
return <div className={classes.actions}>{children}</div>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import Responsive from '../../Responsive';
|
|
4
|
+
|
|
5
|
+
import { useTiledListingActionsStyles } from './TiledListingPage.styles';
|
|
6
|
+
|
|
7
|
+
interface TiledListingContentProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const TiledListingContent = ({
|
|
12
|
+
children
|
|
13
|
+
}: TiledListingContentProps): JSX.Element => {
|
|
14
|
+
const { classes } = useTiledListingActionsStyles();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Responsive>
|
|
18
|
+
<div className={classes.actions}>{children}</div>
|
|
19
|
+
</Responsive>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
export const useTiledListPageStyles = makeStyles()((theme) => ({
|
|
4
|
+
listPage: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
height: '100%',
|
|
8
|
+
padding: theme.spacing(1.5)
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
export const useTiledListingActionsStyles = makeStyles()((theme) => ({
|
|
13
|
+
actions: {
|
|
14
|
+
paddingBottom: theme.spacing(2.5)
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTiledListPageStyles } from './TiledListingPage.styles';
|
|
4
|
+
|
|
5
|
+
interface TiledListingPageProps {
|
|
6
|
+
children: Array<ReactNode>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const TiledListingPage = ({
|
|
10
|
+
children
|
|
11
|
+
}: TiledListingPageProps): JSX.Element => {
|
|
12
|
+
const { classes } = useTiledListPageStyles();
|
|
13
|
+
|
|
14
|
+
return <div className={classes.listPage}>{children}</div>;
|
|
15
|
+
};
|
|
@@ -11,11 +11,16 @@ import {
|
|
|
11
11
|
DashboardForm,
|
|
12
12
|
DashboardFormProps,
|
|
13
13
|
DataTable,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
PageLayout
|
|
14
|
+
Header,
|
|
15
|
+
Modal
|
|
17
16
|
} from '../../components';
|
|
18
17
|
import { Default as DashboardFormDefaultStory } from '../../components/Form/Dashboard/DashboardForm.stories';
|
|
18
|
+
import {
|
|
19
|
+
TiledListingActions,
|
|
20
|
+
TiledListingContent,
|
|
21
|
+
TiledListingList,
|
|
22
|
+
TiledListingPage
|
|
23
|
+
} from '../../layout/TiledListingPage';
|
|
19
24
|
|
|
20
25
|
const meta: Meta = {
|
|
21
26
|
args: {
|
|
@@ -59,10 +64,7 @@ const meta: Meta = {
|
|
|
59
64
|
},
|
|
60
65
|
title: 'Dashboards overview'
|
|
61
66
|
},
|
|
62
|
-
|
|
63
|
-
layout: 'fullscreen'
|
|
64
|
-
},
|
|
65
|
-
title: 'screens/Dashboards overview'
|
|
67
|
+
title: 'screens/Dashboards'
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
export default meta;
|
|
@@ -132,16 +134,10 @@ const DefaultView = (args): JSX.Element => {
|
|
|
132
134
|
};
|
|
133
135
|
|
|
134
136
|
return (
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<PageHeader.Title title={title} />
|
|
140
|
-
</PageHeader.Main>
|
|
141
|
-
</PageHeader>
|
|
142
|
-
</PageLayout.Header>
|
|
143
|
-
<PageLayout.Body>
|
|
144
|
-
<PageLayout.Actions>
|
|
137
|
+
<TiledListingPage>
|
|
138
|
+
<Header title={title} />
|
|
139
|
+
<TiledListingList>
|
|
140
|
+
<TiledListingActions>
|
|
145
141
|
{dataDashboards.length !== 0 && (
|
|
146
142
|
<Button
|
|
147
143
|
aria-label="add"
|
|
@@ -154,105 +150,101 @@ const DefaultView = (args): JSX.Element => {
|
|
|
154
150
|
{actions.create.label}
|
|
155
151
|
</Button>
|
|
156
152
|
)}
|
|
157
|
-
</
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
</TiledListingActions>
|
|
154
|
+
<TiledListingContent>
|
|
155
|
+
<DataTable isEmpty={dataDashboards.length === 0}>
|
|
156
|
+
{dataDashboards.length === 0 ? (
|
|
157
|
+
<DataTable.EmptyState
|
|
158
|
+
labels={list.emptyState.labels}
|
|
159
|
+
onCreate={() =>
|
|
160
|
+
setDialogState({ item: null, open: true, variant: 'create' })
|
|
161
|
+
}
|
|
162
|
+
/>
|
|
163
|
+
) : (
|
|
164
|
+
dataDashboards.map((dashboard) => (
|
|
165
|
+
<DataTable.Item
|
|
166
|
+
hasActions
|
|
167
|
+
hasCardAction
|
|
168
|
+
description={dashboard.description}
|
|
169
|
+
key={dashboard.id}
|
|
170
|
+
title={dashboard.name}
|
|
171
|
+
onDelete={() =>
|
|
172
|
+
setDeleteDialogState({ item: dashboard, open: true })
|
|
173
|
+
}
|
|
174
|
+
onEdit={() =>
|
|
175
|
+
setDialogState({
|
|
176
|
+
item: dashboard,
|
|
177
|
+
open: true,
|
|
178
|
+
variant: 'update'
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
/>
|
|
182
|
+
))
|
|
183
|
+
)}
|
|
184
|
+
</DataTable>
|
|
185
|
+
</TiledListingContent>
|
|
186
|
+
<Modal
|
|
187
|
+
open={dialogState.open}
|
|
188
|
+
onClose={() =>
|
|
189
|
+
setDialogState({
|
|
190
|
+
item: null,
|
|
191
|
+
open: false,
|
|
192
|
+
variant: dialogState.variant
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
>
|
|
196
|
+
<Modal.Header>
|
|
197
|
+
{form.labels.title[dialogState.variant ?? 'create']}
|
|
198
|
+
</Modal.Header>
|
|
199
|
+
<Modal.Body>
|
|
200
|
+
<DashboardForm
|
|
201
|
+
labels={DashboardFormDefaultStory!.args!.labels!}
|
|
202
|
+
resource={dialogState.item || undefined}
|
|
203
|
+
variant={dialogState.variant}
|
|
204
|
+
onCancel={() =>
|
|
164
205
|
setDialogState({
|
|
165
206
|
item: null,
|
|
166
|
-
open:
|
|
167
|
-
variant:
|
|
207
|
+
open: false,
|
|
208
|
+
variant: dialogState.variant
|
|
168
209
|
})
|
|
169
210
|
}
|
|
211
|
+
onSubmit={(values) =>
|
|
212
|
+
dialogState.variant === 'create'
|
|
213
|
+
? createDashboard(values)
|
|
214
|
+
: updateDashboard(values)
|
|
215
|
+
}
|
|
170
216
|
/>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
setDialogState({
|
|
199
|
-
item: null,
|
|
200
|
-
open: false,
|
|
201
|
-
variant: dialogState.variant
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
>
|
|
205
|
-
<Modal.Header>
|
|
206
|
-
{form.labels.title[dialogState.variant ?? 'create']}
|
|
207
|
-
</Modal.Header>
|
|
208
|
-
<Modal.Body>
|
|
209
|
-
<DashboardForm
|
|
210
|
-
labels={DashboardFormDefaultStory!.args!.labels!}
|
|
211
|
-
resource={dialogState.item || undefined}
|
|
212
|
-
variant={dialogState.variant}
|
|
213
|
-
onCancel={() =>
|
|
214
|
-
setDialogState({
|
|
215
|
-
item: null,
|
|
216
|
-
open: false,
|
|
217
|
-
variant: dialogState.variant
|
|
218
|
-
})
|
|
219
|
-
}
|
|
220
|
-
onSubmit={(values) =>
|
|
221
|
-
dialogState.variant === 'create'
|
|
222
|
-
? createDashboard(values)
|
|
223
|
-
: updateDashboard(values)
|
|
224
|
-
}
|
|
217
|
+
</Modal.Body>
|
|
218
|
+
</Modal>
|
|
219
|
+
<Modal
|
|
220
|
+
open={deleteDialogState.open}
|
|
221
|
+
onClose={() =>
|
|
222
|
+
setDeleteDialogState({
|
|
223
|
+
...deleteDialogState,
|
|
224
|
+
open: false
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
>
|
|
228
|
+
<Modal.Header>{deleteConfirmation.labels.title}</Modal.Header>
|
|
229
|
+
<Modal.Body>
|
|
230
|
+
<p>
|
|
231
|
+
{deleteConfirmation.labels.description(
|
|
232
|
+
deleteDialogState.item?.name
|
|
233
|
+
)}
|
|
234
|
+
</p>
|
|
235
|
+
</Modal.Body>
|
|
236
|
+
<Modal.Actions
|
|
237
|
+
isDanger
|
|
238
|
+
labels={deleteConfirmation.labels.actions}
|
|
239
|
+
onCancel={() => setDeleteDialogState({ item: null, open: false })}
|
|
240
|
+
onConfirm={() => {
|
|
241
|
+
deleteDashboard(deleteDialogState.item?.id);
|
|
242
|
+
setDeleteDialogState({ item: null, open: false });
|
|
243
|
+
}}
|
|
225
244
|
/>
|
|
226
|
-
</Modal
|
|
227
|
-
</
|
|
228
|
-
|
|
229
|
-
open={deleteDialogState.open}
|
|
230
|
-
onClose={() =>
|
|
231
|
-
setDeleteDialogState({
|
|
232
|
-
...deleteDialogState,
|
|
233
|
-
open: false
|
|
234
|
-
})
|
|
235
|
-
}
|
|
236
|
-
>
|
|
237
|
-
<Modal.Header>{deleteConfirmation.labels.title}</Modal.Header>
|
|
238
|
-
<Modal.Body>
|
|
239
|
-
<p>
|
|
240
|
-
{deleteConfirmation.labels.description(
|
|
241
|
-
deleteDialogState.item?.name
|
|
242
|
-
)}
|
|
243
|
-
</p>
|
|
244
|
-
</Modal.Body>
|
|
245
|
-
<Modal.Actions
|
|
246
|
-
isDanger
|
|
247
|
-
labels={deleteConfirmation.labels.actions}
|
|
248
|
-
onCancel={() => setDeleteDialogState({ item: null, open: false })}
|
|
249
|
-
onConfirm={() => {
|
|
250
|
-
deleteDashboard(deleteDialogState.item?.id);
|
|
251
|
-
setDeleteDialogState({ item: null, open: false });
|
|
252
|
-
}}
|
|
253
|
-
/>
|
|
254
|
-
</Modal>
|
|
255
|
-
</PageLayout>
|
|
245
|
+
</Modal>
|
|
246
|
+
</TiledListingList>
|
|
247
|
+
</TiledListingPage>
|
|
256
248
|
);
|
|
257
249
|
};
|
|
258
250
|
|
package/src/utils/index.ts
CHANGED
package/test/setupTests.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
2
|
/* eslint-disable no-undef */
|
|
3
|
-
// FIXME: testing library setup
|
|
4
|
-
// import '@testing-library/jest-dom';
|
|
5
|
-
// import '@testing-library/react';
|
|
6
3
|
// import '@testing-library/jest-dom/extend-expect';
|
|
7
4
|
import i18n from 'i18next';
|
|
8
5
|
import { initReactI18next } from 'react-i18next';
|