@centreon/ui 23.10.121 → 24.4.0
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 +64 -45
- package/public/mockServiceWorker.js +2 -2
- package/src/ActionsList/ActionsList.styles.ts +40 -71
- package/src/Button/Icon/index.stories.tsx +1 -1
- package/src/Button/Icon/index.tsx +2 -2
- package/src/Button/Save/StartIcon.tsx +3 -3
- package/src/Button/Save/index.tsx +9 -5
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
- package/src/Checkbox/fonts/roboto-bold-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-bold-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-bold-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.woff2 +0 -0
- package/src/Dashboard/Dashboard.styles.ts +6 -5
- package/src/Dashboard/Item.tsx +1 -1
- package/src/Dashboard/Layout.tsx +2 -2
- package/src/Dashboard/utils.ts +1 -1
- package/src/Dialog/Confirm/index.tsx +10 -2
- package/src/Dialog/UnsavedChanges/index.tsx +21 -20
- package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
- package/src/Dialog/index.tsx +9 -2
- package/src/FallbackPage/FallbackPage.tsx +3 -3
- package/src/FileDropZone/index.tsx +3 -1
- package/src/Form/Form.cypress.spec.tsx +133 -0
- package/src/Form/Inputs/Grid.tsx +8 -4
- package/src/Form/Inputs/List/Content.tsx +62 -0
- package/src/Form/Inputs/List/List.styles.ts +29 -0
- package/src/Form/Inputs/List/List.tsx +58 -0
- package/src/Form/Inputs/List/useList.ts +81 -0
- package/src/Form/Inputs/Text.tsx +3 -1
- package/src/Form/Inputs/index.tsx +3 -1
- package/src/Form/Inputs/models.ts +23 -13
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +217 -0
- package/src/Graph/BarStack/BarStack.stories.tsx +125 -0
- package/src/Graph/BarStack/BarStack.styles.ts +66 -0
- package/src/Graph/BarStack/BarStack.tsx +14 -0
- package/src/Graph/BarStack/Graph.tsx +176 -0
- package/src/Graph/BarStack/GraphAndLegend.tsx +119 -0
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +114 -0
- package/src/Graph/BarStack/constants.ts +5 -0
- package/src/Graph/BarStack/index.ts +1 -0
- package/src/Graph/BarStack/models.ts +19 -0
- package/src/Graph/BarStack/useGraphAndLegend.ts +86 -0
- package/src/Graph/BarStack/useResponsiveBarStack.ts +106 -0
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
- package/src/Graph/Gauge/Gauge.tsx +1 -1
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
- package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
- package/src/Graph/HeatMap/HeatMap.styles.tsx +1 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +39 -12
- package/src/Graph/HeatMap/model.ts +6 -1
- package/src/Graph/Legend/Legend.styles.ts +10 -0
- package/src/Graph/Legend/Legend.tsx +26 -0
- package/src/Graph/Legend/index.ts +1 -0
- package/src/Graph/Legend/models.ts +11 -0
- package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +2 -1
- package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +3 -4
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
- package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +3 -5
- package/src/Graph/LineChart/Header/index.tsx +3 -31
- package/src/Graph/LineChart/Icons/Downtime.tsx +3 -3
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
- package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
- package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/index.tsx +2 -1
- package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
- package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
- package/src/Graph/LineChart/Legend/Legend.styles.ts +85 -32
- package/src/Graph/LineChart/Legend/LegendContent.tsx +12 -6
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +66 -27
- package/src/Graph/LineChart/Legend/index.tsx +43 -46
- package/src/Graph/LineChart/Legend/models.ts +5 -0
- package/src/Graph/LineChart/Legend/useLegend.ts +12 -13
- package/src/Graph/LineChart/LineChart.cypress.spec.tsx +144 -0
- package/src/Graph/LineChart/LineChart.styles.ts +8 -0
- package/src/Graph/LineChart/LineChart.tsx +125 -123
- package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
- package/src/Graph/LineChart/helpers/doc.ts +16 -13
- package/src/Graph/LineChart/helpers/index.ts +1 -1
- package/src/Graph/LineChart/index.stories.tsx +17 -2
- package/src/Graph/LineChart/index.tsx +6 -7
- package/src/Graph/LineChart/mockedData/curvesWithSameColor.json +252 -0
- package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
- package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
- package/src/Graph/LineChart/models.ts +12 -1
- package/src/Graph/LineChart/useLineChartData.ts +68 -18
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
- package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
- package/src/Graph/PieChart/PieChart.styles.ts +39 -0
- package/src/Graph/PieChart/PieChart.tsx +14 -0
- package/src/Graph/PieChart/ResponsivePie.tsx +245 -0
- package/src/Graph/PieChart/index.ts +1 -0
- package/src/Graph/PieChart/models.ts +20 -0
- package/src/Graph/PieChart/useResponsivePie.ts +81 -0
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
- package/src/Graph/SingleBar/Thresholds.tsx +2 -2
- package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
- package/src/Graph/Text/Text.stories.tsx +60 -4
- package/src/Graph/Text/Text.styles.ts +12 -1
- package/src/Graph/Text/Text.tsx +17 -12
- package/src/Graph/Tree/DescendantNodes.tsx +88 -0
- package/src/Graph/Tree/Links.tsx +64 -0
- package/src/Graph/Tree/StandaloneTree.tsx +32 -0
- package/src/Graph/Tree/Tree.cypress.spec.tsx +171 -0
- package/src/Graph/Tree/Tree.stories.tsx +144 -0
- package/src/Graph/Tree/Tree.tsx +116 -0
- package/src/Graph/Tree/constants.ts +2 -0
- package/src/Graph/Tree/index.ts +4 -0
- package/src/Graph/Tree/models.ts +52 -0
- package/src/Graph/Tree/stories/contents.tsx +164 -0
- package/src/Graph/Tree/stories/datas.ts +305 -0
- package/src/Graph/Tree/utils.ts +49 -0
- package/src/Graph/common/testUtils.ts +71 -0
- package/src/Graph/common/timeSeries/index.ts +53 -15
- package/src/Graph/common/utils.ts +69 -1
- package/src/Graph/index.ts +4 -0
- package/src/Icon/BaseIcon.tsx +32 -0
- package/src/Icon/DowntimeIcon.tsx +14 -0
- package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
- package/src/InputField/Number/Number.stories.tsx +66 -0
- package/src/InputField/Number/Number.tsx +74 -0
- package/src/InputField/Search/index.tsx +2 -2
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +22 -1
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +3 -2
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +35 -17
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Multi/index.stories.tsx +19 -0
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +12 -7
- package/src/InputField/Select/Autocomplete/index.tsx +129 -116
- package/src/InputField/Select/IconPopover/index.tsx +3 -3
- package/src/InputField/Select/index.tsx +15 -2
- package/src/InputField/Text/index.tsx +53 -46
- package/src/Listing/ActionBar/index.tsx +11 -10
- package/src/Listing/Cell/DataCell.styles.ts +3 -0
- package/src/Listing/Cell/DataCell.tsx +23 -5
- package/src/Listing/Header/ListingHeader.tsx +1 -1
- package/src/Listing/Listing.cypress.spec.tsx +218 -33
- package/src/Listing/Listing.styles.ts +4 -7
- package/src/Listing/Row/Row.tsx +7 -3
- package/src/Listing/index.stories.tsx +39 -5
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +207 -149
- package/src/Listing/models.ts +1 -0
- package/src/Listing/useStyleTable.ts +1 -0
- package/src/Module/LicensedModule/LicenseCheck/index.tsx +24 -9
- package/src/Module/LicensedModule/index.tsx +7 -1
- package/src/Module/Module.cypress.spec.tsx +129 -0
- package/src/Module/index.tsx +2 -4
- package/src/Panel/index.tsx +1 -1
- package/src/PopoverMenu/index.tsx +9 -8
- package/src/RichTextEditor/ContentEditable.tsx +195 -195
- package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +100 -52
- package/src/RichTextEditor/RichTextEditor.tsx +21 -4
- package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +21 -20
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +35 -77
- package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +29 -83
- package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +106 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +155 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +23 -39
- package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +24 -14
- package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +6 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +5 -10
- package/src/RichTextEditor/translatedLabels.ts +3 -0
- package/src/SortableItems/index.tsx +2 -7
- package/src/StoryBookThemeProvider/index.tsx +35 -36
- package/src/ThemeProvider/index.tsx +39 -12
- package/src/ThemeProvider/palettes.ts +15 -12
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +10 -6
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -2
- package/src/TimePeriods/DateTimePickerInput.tsx +59 -19
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +9 -33
- package/src/TimePeriods/helpers/index.ts +1 -1
- package/src/TimePeriods/index.stories.tsx +12 -4
- package/src/TimePeriods/index.tsx +2 -2
- package/src/TopCounterElements/TopCounterLayout.tsx +3 -0
- package/src/TopCounterElements/useCloseOnLegacyPage.tsx +42 -0
- package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
- package/src/Typography/FluidTypography/index.stories.tsx +2 -2
- package/src/Typography/FluidTypography/index.tsx +21 -28
- package/src/Typography/Subtitle.tsx +55 -0
- package/src/api/QueryProvider.tsx +1 -1
- package/src/api/TestQueryProvider.tsx +1 -1
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +7 -1
- package/src/api/buildListingEndpoint/models.ts +3 -1
- package/src/api/customFetch.ts +12 -3
- package/src/api/index.ts +3 -3
- package/src/api/useFetchQuery/index.ts +49 -28
- package/src/api/useGraphQuery/index.ts +26 -5
- package/src/api/useGraphQuery/models.ts +5 -0
- package/src/api/useMutationQuery/index.test.ts +4 -4
- package/src/api/useMutationQuery/index.ts +65 -20
- package/src/components/Button/Icon/IconButton.tsx +6 -2
- package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
- package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
- package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
- package/src/components/DataTable/DataListing.tsx +6 -0
- package/src/components/DataTable/DataTable.cypress.spec.tsx +174 -0
- package/src/components/DataTable/DataTable.stories.tsx +40 -0
- package/src/components/DataTable/DataTable.styles.ts +3 -0
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DataTable/Item/DataTableItem.styles.ts +7 -2
- package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
- package/src/components/DataTable/index.ts +3 -1
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +373 -0
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +119 -0
- package/src/components/Form/AccessRights/AccessRights.styles.ts +10 -0
- package/src/components/Form/AccessRights/AccessRights.tsx +60 -0
- package/src/components/Form/AccessRights/Actions/Actions.styles.ts +14 -0
- package/src/components/Form/AccessRights/Actions/Actions.tsx +81 -0
- package/src/components/Form/AccessRights/Actions/useActions.ts +79 -0
- package/src/components/Form/AccessRights/List/Item.tsx +90 -0
- package/src/components/Form/AccessRights/List/List.styles.tsx +45 -0
- package/src/components/Form/AccessRights/List/List.tsx +52 -0
- package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +18 -0
- package/src/components/Form/AccessRights/List/ListSkeleton.tsx +22 -0
- package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +38 -0
- package/src/components/Form/AccessRights/List/StateChip.tsx +28 -0
- package/src/components/Form/AccessRights/List/useItem.ts +64 -0
- package/src/components/Form/AccessRights/Provider.tsx +15 -0
- package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +50 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +17 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +78 -0
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +113 -0
- package/src/components/Form/AccessRights/Stats/Stats.tsx +36 -0
- package/src/components/Form/AccessRights/atoms.ts +97 -0
- package/src/components/Form/AccessRights/common/RoleSelectField.styles.tsx +7 -0
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +45 -0
- package/src/components/Form/AccessRights/models.ts +55 -0
- package/src/components/Form/AccessRights/storiesData.ts +222 -0
- package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +51 -0
- package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
- package/src/components/Form/Dashboard/DashboardForm.tsx +15 -12
- package/src/components/Form/Dashboard/index.ts +1 -0
- package/src/components/Form/FormActions.tsx +7 -2
- package/src/components/Form/index.ts +2 -1
- package/src/components/ItemComposition/Item.tsx +1 -1
- package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
- package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
- package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
- package/src/components/ItemComposition/ItemComposition.tsx +41 -17
- package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -1
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +76 -0
- package/src/components/Layout/PageLayout/index.ts +3 -1
- package/src/components/Layout/PageLayout.cypress.spec.tsx +66 -0
- package/src/components/List/Item/ListItem.styles.ts +6 -0
- package/src/components/List/Item/ListItem.tsx +6 -4
- package/src/components/List/Item/Text.tsx +5 -3
- package/src/components/Menu/Button/MenuButton.tsx +4 -2
- package/src/components/Menu/MenuItem.tsx +5 -3
- package/src/components/Menu/MenuItems.tsx +4 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
- package/src/components/Modal/Modal.styles.ts +10 -2
- package/src/components/Modal/ModalActions.tsx +4 -2
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
- package/src/components/Zoom/Minimap.tsx +127 -0
- package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
- package/src/components/Zoom/Zoom.stories.tsx +115 -0
- package/src/components/Zoom/Zoom.styles.tsx +68 -0
- package/src/components/Zoom/Zoom.tsx +61 -0
- package/src/components/Zoom/ZoomContent.tsx +167 -0
- package/src/components/Zoom/constants.ts +2 -0
- package/src/components/Zoom/localPoint.ts +51 -0
- package/src/components/Zoom/models.ts +25 -0
- package/src/components/Zoom/useMinimap.ts +156 -0
- package/src/components/Zoom/useZoom.ts +70 -0
- package/src/components/Zoom/utils.ts +55 -0
- package/src/components/index.ts +1 -0
- package/src/fonts/roboto-bold-webfont.ttf +0 -0
- package/src/fonts/roboto-bold-webfont.woff +0 -0
- package/src/fonts/roboto-bold-webfont.woff2 +0 -0
- package/src/fonts/roboto-light-webfont.ttf +0 -0
- package/src/fonts/roboto-light-webfont.woff +0 -0
- package/src/fonts/roboto-light-webfont.woff2 +0 -0
- package/src/fonts/roboto-medium-webfont.ttf +0 -0
- package/src/fonts/roboto-medium-webfont.woff +0 -0
- package/src/fonts/roboto-medium-webfont.woff2 +0 -0
- package/src/fonts/roboto-regular-webfont.ttf +0 -0
- package/src/fonts/roboto-regular-webfont.woff +0 -0
- package/src/fonts/roboto-regular-webfont.woff2 +0 -0
- package/src/index.ts +6 -0
- package/src/queryParameters/url/index.ts +5 -1
- package/src/utils/index.ts +25 -22
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +133 -0
- package/src/utils/useFullscreen/atoms.ts +3 -0
- package/src/utils/useFullscreen/index.ts +2 -0
- package/src/utils/useFullscreen/translatedLabels.ts +1 -0
- package/src/utils/useFullscreen/useFullscreen.ts +73 -0
- package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
- package/src/utils/useInfiniteScrollListing.ts +31 -8
- package/src/utils/{useLicenseExpirationWarning.cypress.spec.tsx → useLicenseExpirationWarning.test.tsx} +48 -37
- package/src/utils/useLicenseExpirationWarning.ts +18 -18
- package/src/utils/useLocale/index.ts +10 -0
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +40 -0
- package/src/utils/useLocaleDateTimeFormat/index.ts +8 -2
- package/src/utils/usePluralizedTranslation.ts +21 -0
- package/src/@assets/icons/downtime.icon.svg +0 -1
- package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
- package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
- package/src/Graph/LineChart/Legend/Marker.tsx +0 -43
- package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
- package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
- package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
- package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
- package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
- package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
- package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
- package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
- package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
- package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
- package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
- package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
- package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -52
- package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
- package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
- package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
- package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
- package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
- package/src/components/Form/AccessRights/index.ts +0 -3
- package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
- package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
- package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +0 -281
- package/src/utils/useDateTimePickerAdapter.ts +0 -309
- /package/{public → src/Button}/fonts/roboto-bold-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-bold-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-bold-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.woff2 +0 -0
|
@@ -3,8 +3,6 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
3
3
|
|
|
4
4
|
import { Box, Typography } from '@mui/material';
|
|
5
5
|
|
|
6
|
-
import EllipsisTypography from '../../Typography/EllipsisTypography';
|
|
7
|
-
|
|
8
6
|
import heatMapData from './HeatMapData.json';
|
|
9
7
|
|
|
10
8
|
import { HeatMap } from '.';
|
|
@@ -22,29 +20,6 @@ const meta: Meta<typeof HeatMap<Data>> = {
|
|
|
22
20
|
export default meta;
|
|
23
21
|
type Story = StoryObj<typeof HeatMap<Data>>;
|
|
24
22
|
|
|
25
|
-
const TileContent = ({
|
|
26
|
-
isSmallestSize,
|
|
27
|
-
data
|
|
28
|
-
}: {
|
|
29
|
-
data: Data;
|
|
30
|
-
isSmallestSize: boolean;
|
|
31
|
-
}): JSX.Element | false =>
|
|
32
|
-
!isSmallestSize && (
|
|
33
|
-
<Box
|
|
34
|
-
sx={{
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
color: 'common.black',
|
|
37
|
-
display: 'flex',
|
|
38
|
-
flexDirection: 'column',
|
|
39
|
-
width: '100%'
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<EllipsisTypography textAlign="center">{data.host}</EllipsisTypography>
|
|
43
|
-
<EllipsisTypography textAlign="center">{data.service}</EllipsisTypography>
|
|
44
|
-
<EllipsisTypography textAlign="center">{data.counter}</EllipsisTypography>
|
|
45
|
-
</Box>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
23
|
const TooltipContent = ({ data }: { data: Data }): JSX.Element => {
|
|
49
24
|
return (
|
|
50
25
|
<Box sx={{ backgroundColor: 'common.white', color: 'common.black' }}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import { scaleLinear } from '@visx/scale';
|
|
4
|
-
import { equals, gt, lt } from 'ramda';
|
|
4
|
+
import { T, equals, gt, lt } from 'ramda';
|
|
5
5
|
|
|
6
6
|
import { Box } from '@mui/material';
|
|
7
7
|
|
|
@@ -13,6 +13,7 @@ import { useHeatMapStyles } from './HeatMap.styles';
|
|
|
13
13
|
const gap = 8;
|
|
14
14
|
const maxTileSize = 120;
|
|
15
15
|
const smallestTileSize = 44;
|
|
16
|
+
const toleratedRangeWidth = 10;
|
|
16
17
|
|
|
17
18
|
const ResponsiveHeatMap = <TData,>({
|
|
18
19
|
width,
|
|
@@ -20,9 +21,11 @@ const ResponsiveHeatMap = <TData,>({
|
|
|
20
21
|
tiles,
|
|
21
22
|
arrowClassName,
|
|
22
23
|
tooltipContent,
|
|
23
|
-
tileSizeFixed
|
|
24
|
+
tileSizeFixed,
|
|
25
|
+
displayTooltipCondition = T
|
|
24
26
|
}: HeatMapProps<TData> & { width: number }): JSX.Element | null => {
|
|
25
27
|
const { classes, cx } = useHeatMapStyles();
|
|
28
|
+
const previousTileSize = useRef(0);
|
|
26
29
|
|
|
27
30
|
const tileSize = useMemo(() => {
|
|
28
31
|
const scaleWidth = scaleLinear({
|
|
@@ -38,8 +41,14 @@ const ResponsiveHeatMap = <TData,>({
|
|
|
38
41
|
tilesLength * maxTileSize + (tilesLength - 1) * gap;
|
|
39
42
|
const theoricalTotalTilesWidth =
|
|
40
43
|
tilesLength * tileWidth + (tilesLength - 1) * gap;
|
|
44
|
+
const canUpdateTileSize =
|
|
45
|
+
Math.abs(tileWidth - previousTileSize.current) > toleratedRangeWidth;
|
|
41
46
|
|
|
42
|
-
if (
|
|
47
|
+
if (!canUpdateTileSize) {
|
|
48
|
+
return previousTileSize.current;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (lt(width, 680) && gt(maxTotalTilesWidth, width) && !tileSizeFixed) {
|
|
43
52
|
return smallestTileSize;
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -51,6 +60,8 @@ const ResponsiveHeatMap = <TData,>({
|
|
|
51
60
|
}, [width, tiles]);
|
|
52
61
|
|
|
53
62
|
const isSmallestSize = equals(tileSize, smallestTileSize);
|
|
63
|
+
const isMediumSize = !isSmallestSize && lt(tileSize, 90);
|
|
64
|
+
previousTileSize.current = tileSize;
|
|
54
65
|
|
|
55
66
|
if (equals(width, 0)) {
|
|
56
67
|
return null;
|
|
@@ -65,24 +76,40 @@ const ResponsiveHeatMap = <TData,>({
|
|
|
65
76
|
}}
|
|
66
77
|
>
|
|
67
78
|
{tiles.map(({ backgroundColor, id, data }) => (
|
|
68
|
-
<Box
|
|
79
|
+
<Box
|
|
80
|
+
className={classes.heatMapTile}
|
|
81
|
+
data-testid={id}
|
|
82
|
+
key={id}
|
|
83
|
+
sx={{ backgroundColor }}
|
|
84
|
+
>
|
|
69
85
|
<Tooltip
|
|
70
86
|
hasCaret
|
|
71
87
|
classes={{
|
|
72
88
|
arrow: cx(classes.heatMapTooltipArrow, arrowClassName),
|
|
73
89
|
tooltip: classes.heatMapTooltip
|
|
74
90
|
}}
|
|
91
|
+
data-testid={`tooltip-${data?.id}`}
|
|
75
92
|
followCursor={false}
|
|
76
|
-
label={
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
label={
|
|
94
|
+
displayTooltipCondition?.(data) &&
|
|
95
|
+
tooltipContent?.({
|
|
96
|
+
backgroundColor,
|
|
97
|
+
data,
|
|
98
|
+
id,
|
|
99
|
+
isSmallestSize
|
|
100
|
+
})
|
|
101
|
+
}
|
|
82
102
|
position="right-start"
|
|
83
103
|
>
|
|
84
104
|
<div className={classes.heatMapTileContent}>
|
|
85
|
-
{children({
|
|
105
|
+
{children({
|
|
106
|
+
backgroundColor,
|
|
107
|
+
data,
|
|
108
|
+
id,
|
|
109
|
+
isMediumSize,
|
|
110
|
+
isSmallestSize,
|
|
111
|
+
tileSize
|
|
112
|
+
})}
|
|
86
113
|
</div>
|
|
87
114
|
</Tooltip>
|
|
88
115
|
</Box>
|
|
@@ -10,7 +10,9 @@ interface ChildrenProps<TData> {
|
|
|
10
10
|
backgroundColor: string;
|
|
11
11
|
data: TData;
|
|
12
12
|
id: string;
|
|
13
|
+
isMediumSize?: boolean;
|
|
13
14
|
isSmallestSize: boolean;
|
|
15
|
+
tileSize?: number;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export interface HeatMapProps<TData> {
|
|
@@ -19,8 +21,11 @@ export interface HeatMapProps<TData> {
|
|
|
19
21
|
backgroundColor,
|
|
20
22
|
id,
|
|
21
23
|
data,
|
|
22
|
-
isSmallestSize
|
|
24
|
+
isSmallestSize,
|
|
25
|
+
tileSize,
|
|
26
|
+
isMediumSize
|
|
23
27
|
}: ChildrenProps<TData>) => ReactElement | boolean | null;
|
|
28
|
+
displayTooltipCondition?: (data: TData) => boolean;
|
|
24
29
|
tileSizeFixed?: boolean;
|
|
25
30
|
tiles: Array<Tile<TData>>;
|
|
26
31
|
tooltipContent?: ({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
export const useStyles = makeStyles()((theme) => ({
|
|
4
|
+
container: {
|
|
5
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
6
|
+
borderRadius: theme.shape.borderRadius,
|
|
7
|
+
padding: theme.spacing(1),
|
|
8
|
+
width: 'fit-content'
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LegendOrdinal } from '@visx/legend';
|
|
2
|
+
import { scaleOrdinal } from '@visx/scale';
|
|
3
|
+
import { equals } from 'ramda';
|
|
4
|
+
|
|
5
|
+
import { useStyles } from './Legend.styles';
|
|
6
|
+
import { LegendProps } from './models';
|
|
7
|
+
|
|
8
|
+
const Legend = ({ scale, direction = 'column' }: LegendProps): JSX.Element => {
|
|
9
|
+
const { classes } = useStyles();
|
|
10
|
+
|
|
11
|
+
const legendScale = scaleOrdinal({
|
|
12
|
+
domain: scale.domain,
|
|
13
|
+
range: scale.range
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<LegendOrdinal
|
|
18
|
+
className={classes.container}
|
|
19
|
+
direction={direction}
|
|
20
|
+
labelMargin={equals(direction, 'row') ? '0 12px 0 0' : '0 0 0 0'}
|
|
21
|
+
scale={legendScale}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default Legend;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Legend } from './Legend';
|
|
@@ -55,6 +55,7 @@ const RegularLine = ({
|
|
|
55
55
|
if (filled) {
|
|
56
56
|
return (
|
|
57
57
|
<Shape.AreaClosed<TimeValue>
|
|
58
|
+
data-metric={metric_id}
|
|
58
59
|
fill={getFillColor({ areaColor, transparency })}
|
|
59
60
|
fillRule="nonzero"
|
|
60
61
|
key={metric_id}
|
|
@@ -65,7 +66,7 @@ const RegularLine = ({
|
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
return <Shape.LinePath<TimeValue> {...props} />;
|
|
69
|
+
return <Shape.LinePath<TimeValue> data-metric={metric_id} {...props} />;
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
export default memo(RegularLine, (prevProps, nextProps) => {
|
|
@@ -45,10 +45,8 @@ const StackLines = ({
|
|
|
45
45
|
>
|
|
46
46
|
{({ stacks, path: linePath }): Array<JSX.Element> => {
|
|
47
47
|
return stacks.map((stack, index) => {
|
|
48
|
-
const { areaColor, transparency, lineColor, highlight } =
|
|
49
|
-
index,
|
|
50
|
-
lines
|
|
51
|
-
) as Line;
|
|
48
|
+
const { areaColor, transparency, lineColor, highlight, metric_id } =
|
|
49
|
+
nth(index, lines) as Line;
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
52
|
<g key={`stack-${prop('key', stack)}`}>
|
|
@@ -65,6 +63,7 @@ const StackLines = ({
|
|
|
65
63
|
)}
|
|
66
64
|
<path
|
|
67
65
|
d={linePath(stack) || ''}
|
|
66
|
+
data-metric={metric_id}
|
|
68
67
|
fill={getFillColor({ areaColor, transparency })}
|
|
69
68
|
opacity={highlight === false ? 0.3 : 1}
|
|
70
69
|
stroke={lineColor}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Shape } from '@visx/visx';
|
|
2
2
|
import { isEmpty, isNil } from 'ramda';
|
|
3
3
|
|
|
4
|
-
import { Circle } from './models';
|
|
4
|
+
import { Circle as CircleModel } from './models';
|
|
5
5
|
import useCoordinateCircle from './useCoordinateCircle';
|
|
6
6
|
|
|
7
7
|
const Circle = ({
|
|
@@ -11,7 +11,7 @@ const Circle = ({
|
|
|
11
11
|
timeSeries,
|
|
12
12
|
getX,
|
|
13
13
|
getCountDisplayedCircles
|
|
14
|
-
}:
|
|
14
|
+
}: CircleModel): JSX.Element | null => {
|
|
15
15
|
const coordinates = useCoordinateCircle({
|
|
16
16
|
getCountDisplayedCircles,
|
|
17
17
|
getX,
|
|
@@ -2,6 +2,8 @@ import { equals } from 'ramda';
|
|
|
2
2
|
|
|
3
3
|
import { useTheme } from '@mui/material';
|
|
4
4
|
|
|
5
|
+
import { margin } from '../common';
|
|
6
|
+
|
|
5
7
|
interface Props {
|
|
6
8
|
hideTooltip: () => void;
|
|
7
9
|
label: string;
|
|
@@ -28,7 +30,7 @@ export const ThresholdLine = ({
|
|
|
28
30
|
const onMouseEnter = (): void =>
|
|
29
31
|
showTooltip({
|
|
30
32
|
tooltipData: label,
|
|
31
|
-
tooltipLeft:
|
|
33
|
+
tooltipLeft: -(margin.left + margin.right),
|
|
32
34
|
tooltipTop: scaledValue
|
|
33
35
|
});
|
|
34
36
|
|
|
@@ -2,7 +2,7 @@ import { equals, isNil } from 'ramda';
|
|
|
2
2
|
|
|
3
3
|
import { getUnits, getYScale } from '../../common/timeSeries';
|
|
4
4
|
import { Line } from '../../common/timeSeries/models';
|
|
5
|
-
import { Thresholds } from '../../common/models';
|
|
5
|
+
import { Thresholds as ThresholdsModel } from '../../common/models';
|
|
6
6
|
|
|
7
7
|
import { ThresholdLine } from './ThresholdLine';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ interface Props {
|
|
|
13
13
|
rightScale: (value: number) => number;
|
|
14
14
|
showTooltip: (props) => void;
|
|
15
15
|
thresholdUnit?: string;
|
|
16
|
-
thresholds:
|
|
16
|
+
thresholds: ThresholdsModel;
|
|
17
17
|
width: number;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { equals, propEq, reject } from 'ramda';
|
|
4
4
|
|
|
5
5
|
import { Line } from '../../common/timeSeries/models';
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ const useFilterLines = ({
|
|
|
28
28
|
linesGraph,
|
|
29
29
|
setLinesGraph
|
|
30
30
|
}: UseFilterLines): Result => {
|
|
31
|
-
const displayedLines = reject(propEq('display'
|
|
31
|
+
const displayedLines = reject(propEq(false, 'display'), linesGraph ?? lines);
|
|
32
32
|
const filterLines = (): Array<Line> => {
|
|
33
33
|
const lineOriginMetric = findLineOfOriginMetricThreshold(lines);
|
|
34
34
|
|
|
@@ -51,9 +51,7 @@ const useFilterLines = ({
|
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setLinesGraph(sortedLines);
|
|
54
|
+
setLinesGraph(filteredLines);
|
|
57
55
|
}, [lines, displayThreshold]);
|
|
58
56
|
|
|
59
57
|
return { displayedLines, newLines: linesGraph ?? lines };
|
|
@@ -1,41 +1,17 @@
|
|
|
1
|
-
import { ScaleLinear } from 'd3-scale';
|
|
2
|
-
import { isNil } from 'ramda';
|
|
3
|
-
|
|
4
1
|
import Typography from '@mui/material/Typography';
|
|
5
2
|
|
|
6
|
-
import {
|
|
3
|
+
import { useMemoComponent } from '@centreon/ui';
|
|
7
4
|
|
|
8
5
|
import { useStyles } from '../LineChart.styles';
|
|
9
|
-
import useTickGraph from '../InteractiveComponents/AnchorPoint/useTickGraph';
|
|
10
6
|
import { LineChartHeader } from '../models';
|
|
11
|
-
import { TimeValue } from '../../common/timeSeries/models';
|
|
12
7
|
|
|
13
8
|
interface Props {
|
|
14
|
-
displayTimeTick?: boolean;
|
|
15
9
|
header?: LineChartHeader;
|
|
16
|
-
timeSeries: Array<TimeValue>;
|
|
17
10
|
title: string;
|
|
18
|
-
xScale: ScaleLinear<number, number>;
|
|
19
11
|
}
|
|
20
12
|
|
|
21
|
-
const Header = ({
|
|
22
|
-
title,
|
|
23
|
-
displayTimeTick = true,
|
|
24
|
-
header,
|
|
25
|
-
timeSeries,
|
|
26
|
-
xScale
|
|
27
|
-
}: Props): JSX.Element => {
|
|
13
|
+
const Header = ({ title, header }: Props): JSX.Element => {
|
|
28
14
|
const { classes } = useStyles();
|
|
29
|
-
const { toDateTime } = useLocaleDateTimeFormat();
|
|
30
|
-
|
|
31
|
-
const { tickAxisBottom } = useTickGraph({
|
|
32
|
-
timeSeries,
|
|
33
|
-
xScale
|
|
34
|
-
});
|
|
35
|
-
const time =
|
|
36
|
-
displayTimeTick && !isNil(tickAxisBottom)
|
|
37
|
-
? toDateTime(tickAxisBottom)
|
|
38
|
-
: null;
|
|
39
15
|
|
|
40
16
|
const displayTitle = header?.displayTitle ?? true;
|
|
41
17
|
|
|
@@ -49,16 +25,12 @@ const Header = ({
|
|
|
49
25
|
{title}
|
|
50
26
|
</Typography>
|
|
51
27
|
)}
|
|
52
|
-
|
|
53
|
-
<Typography align="center" style={{ height: 20 }} variant="body1">
|
|
54
|
-
{time}
|
|
55
|
-
</Typography>
|
|
56
28
|
</div>
|
|
57
29
|
{header?.extraComponent}
|
|
58
30
|
</div>
|
|
59
31
|
),
|
|
60
32
|
|
|
61
|
-
memoProps: [
|
|
33
|
+
memoProps: [title, header]
|
|
62
34
|
});
|
|
63
35
|
};
|
|
64
36
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvgIconProps } from '@mui/material';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { DowntimeIcon } from '../../../Icon/DowntimeIcon';
|
|
4
4
|
|
|
5
5
|
const Downtime = (props: SvgIconProps): JSX.Element => (
|
|
6
|
-
<
|
|
6
|
+
<DowntimeIcon {...props} />
|
|
7
7
|
);
|
|
8
8
|
|
|
9
9
|
export default Downtime;
|
|
@@ -2,7 +2,7 @@ import { Shape } from '@visx/visx';
|
|
|
2
2
|
|
|
3
3
|
import { grey } from '@mui/material/colors';
|
|
4
4
|
|
|
5
|
-
import { GuidingLines } from './models';
|
|
5
|
+
import { GuidingLines as GuidingLinesModel } from './models';
|
|
6
6
|
import useTickGraph from './useTickGraph';
|
|
7
7
|
|
|
8
8
|
const GuidingLines = ({
|
|
@@ -10,7 +10,7 @@ const GuidingLines = ({
|
|
|
10
10
|
xScale,
|
|
11
11
|
graphHeight,
|
|
12
12
|
graphWidth
|
|
13
|
-
}:
|
|
13
|
+
}: GuidingLinesModel): JSX.Element | null => {
|
|
14
14
|
const { positionX, positionY } = useTickGraph({
|
|
15
15
|
timeSeries,
|
|
16
16
|
xScale
|
|
@@ -2,13 +2,12 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { ScaleLinear } from 'd3-scale';
|
|
4
4
|
import { useAtomValue } from 'jotai';
|
|
5
|
-
import { isEmpty, isNil, not } from 'ramda';
|
|
6
5
|
|
|
7
6
|
import useAxisY from '../../BasicComponents/Axes/useAxisY';
|
|
8
7
|
import { margin } from '../../common';
|
|
9
|
-
import {
|
|
8
|
+
import { getTimeValue } from '../../../common/timeSeries';
|
|
10
9
|
import { Line, TimeValue } from '../../../common/timeSeries/models';
|
|
11
|
-
import { mousePositionAtom
|
|
10
|
+
import { mousePositionAtom } from '../interactionWithGraphAtoms';
|
|
12
11
|
|
|
13
12
|
interface AnchorPointResult {
|
|
14
13
|
positionX?: number;
|
|
@@ -42,14 +41,13 @@ const useTickGraph = ({
|
|
|
42
41
|
const { axisRight, axisLeft } = useAxisY({ data: { baseAxis, lines } });
|
|
43
42
|
|
|
44
43
|
const mousePosition = useAtomValue(mousePositionAtom);
|
|
45
|
-
const timeValueData = useAtomValue(timeValueAtom);
|
|
46
44
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
const positionX = mousePosition
|
|
46
|
+
? mousePosition[0] - margin.left - 4
|
|
47
|
+
: undefined;
|
|
48
|
+
const positionY = mousePosition
|
|
49
|
+
? mousePosition[1] - margin.top + 2
|
|
50
|
+
: undefined;
|
|
53
51
|
|
|
54
52
|
useEffect(() => {
|
|
55
53
|
if (!mousePosition) {
|
|
@@ -62,7 +60,7 @@ const useTickGraph = ({
|
|
|
62
60
|
const mousePositionTimeTick = mousePosition
|
|
63
61
|
? getTimeValue({ timeSeries, x: mousePosition[0], xScale }).timeTick
|
|
64
62
|
: 0;
|
|
65
|
-
const timeTickValue =
|
|
63
|
+
const timeTickValue = mousePosition
|
|
66
64
|
? new Date(mousePositionTimeTick)
|
|
67
65
|
: null;
|
|
68
66
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useAtomValue } from 'jotai';
|
|
2
|
+
import { equals, isNil } from 'ramda';
|
|
3
|
+
|
|
4
|
+
import { Box, Typography } from '@mui/material';
|
|
5
|
+
|
|
6
|
+
import { mousePositionAtom } from '../interactionWithGraphAtoms';
|
|
7
|
+
import { formatMetricValueWithUnit } from '../../../common/timeSeries';
|
|
8
|
+
|
|
9
|
+
import { useGraphValueTooltip } from './useGraphValueTooltip';
|
|
10
|
+
import { useGraphValueTooltipStyles } from './useGraphValueTooltipStyles';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
base: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const GraphValueTooltip = ({ base }: Props): JSX.Element | null => {
|
|
17
|
+
const { classes } = useGraphValueTooltipStyles();
|
|
18
|
+
const mousePosition = useAtomValue(mousePositionAtom);
|
|
19
|
+
|
|
20
|
+
const graphValue = useGraphValueTooltip();
|
|
21
|
+
|
|
22
|
+
if (isNil(graphValue) || isNil(mousePosition)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={classes.tooltipContainer}>
|
|
28
|
+
<Typography fontWeight="bold">{graphValue.dateTime}</Typography>
|
|
29
|
+
<div className={classes.metrics}>
|
|
30
|
+
{graphValue.metrics.map(({ unit, color, id, value, name }) => {
|
|
31
|
+
const isMetricHighlighted = equals(
|
|
32
|
+
id,
|
|
33
|
+
graphValue.highlightedMetricId
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={classes.metric}
|
|
39
|
+
data-highlight={isMetricHighlighted}
|
|
40
|
+
data-metric={name}
|
|
41
|
+
key={id}
|
|
42
|
+
>
|
|
43
|
+
<Box
|
|
44
|
+
className={classes.metricColorBox}
|
|
45
|
+
sx={{ backgroundColor: color }}
|
|
46
|
+
/>
|
|
47
|
+
<Typography
|
|
48
|
+
className={classes.metricName}
|
|
49
|
+
fontWeight={isMetricHighlighted ? 'bold' : undefined}
|
|
50
|
+
>
|
|
51
|
+
{name}
|
|
52
|
+
</Typography>
|
|
53
|
+
<Typography fontWeight={isMetricHighlighted ? 'bold' : undefined}>
|
|
54
|
+
{formatMetricValueWithUnit({
|
|
55
|
+
base,
|
|
56
|
+
unit,
|
|
57
|
+
value
|
|
58
|
+
})}
|
|
59
|
+
</Typography>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
})}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default GraphValueTooltip;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useAtomValue } from 'jotai';
|
|
2
|
+
import { isNil } from 'ramda';
|
|
3
|
+
|
|
4
|
+
import { graphTooltipDataAtom } from '../interactionWithGraphAtoms';
|
|
5
|
+
import { useLocaleDateTimeFormat } from '../../../../utils';
|
|
6
|
+
import { GraphTooltipData } from '../../models';
|
|
7
|
+
|
|
8
|
+
interface UseGraphValueTooltipState extends Omit<GraphTooltipData, 'date'> {
|
|
9
|
+
dateTime: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const useGraphValueTooltip = (): UseGraphValueTooltipState | null => {
|
|
13
|
+
const { toDate, toTime } = useLocaleDateTimeFormat();
|
|
14
|
+
const graphTooltipData = useAtomValue(graphTooltipDataAtom);
|
|
15
|
+
|
|
16
|
+
if (isNil(graphTooltipData)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const formattedDateTime = `${toDate(graphTooltipData.date)} / ${toTime(graphTooltipData.date)}`;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
dateTime: formattedDateTime,
|
|
24
|
+
highlightedMetricId: graphTooltipData.highlightedMetricId,
|
|
25
|
+
metrics: graphTooltipData.metrics
|
|
26
|
+
};
|
|
27
|
+
};
|
package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
export const useGraphValueTooltipStyles = makeStyles()((theme) => ({
|
|
4
|
+
dateTimeLabel: {
|
|
5
|
+
fontSize: '1.1rem'
|
|
6
|
+
},
|
|
7
|
+
metric: {
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
gap: theme.spacing(1),
|
|
11
|
+
weidth: '100%'
|
|
12
|
+
},
|
|
13
|
+
metricColorBox: {
|
|
14
|
+
borderRadius: theme.shape.borderRadius,
|
|
15
|
+
flexShrink: 0,
|
|
16
|
+
height: theme.spacing(1.5),
|
|
17
|
+
width: theme.spacing(1.5)
|
|
18
|
+
},
|
|
19
|
+
metricName: {
|
|
20
|
+
flexGrow: 1
|
|
21
|
+
},
|
|
22
|
+
metrics: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
marginTop: theme.spacing(0.5),
|
|
26
|
+
width: '100%'
|
|
27
|
+
},
|
|
28
|
+
tooltipContainer: {
|
|
29
|
+
padding: theme.spacing(1)
|
|
30
|
+
}
|
|
31
|
+
}));
|