@centreon/ui 24.8.6 → 24.9.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 +4 -3
- package/src/@types/globals.d.ts +4 -4
- package/src/ActionsList/ActionsList.styles.ts +1 -1
- package/src/ActionsList/index.stories.tsx +1 -1
- package/src/ActionsList/index.tsx +6 -6
- package/src/Button/Icon/index.stories.tsx +1 -1
- package/src/Button/Icon/index.tsx +1 -1
- package/src/Button/Save/StartIcon.tsx +1 -1
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Colors/index.stories.tsx +0 -2
- package/src/Colors/index.tsx +7 -3
- package/src/ContentWithCircularProgress/index.stories.tsx +1 -1
- package/src/Dashboard/Dashboard.styles.ts +111 -111
- package/src/Dashboard/Grid.tsx +2 -2
- package/src/Dashboard/Item.tsx +3 -3
- package/src/Dashboard/Layout.tsx +3 -3
- package/src/Dashboard/index.tsx +9 -9
- package/src/Dialog/Duplicate/index.test.tsx +1 -1
- package/src/Dialog/Duplicate/index.tsx +5 -2
- package/src/Dialog/UnsavedChanges/index.tsx +2 -2
- package/src/Dialog/index.stories.tsx +1 -1
- package/src/Dialog/index.tsx +5 -5
- package/src/FallbackPage/FallbackPage.tsx +4 -4
- package/src/FileDropZone/index.stories.tsx +1 -1
- package/src/FileDropZone/index.tsx +5 -5
- package/src/FileDropZone/useDropzone.test.ts +1 -1
- package/src/FileDropZone/useDropzone.ts +1 -1
- package/src/Form/CollapsibleGroup.tsx +6 -6
- package/src/Form/Form.cypress.spec.tsx +1 -1
- package/src/Form/Form.stories.tsx +3 -3
- package/src/Form/Form.tsx +5 -4
- package/src/Form/FormButtons.tsx +2 -2
- package/src/Form/Inputs/Autocomplete.tsx +3 -3
- package/src/Form/Inputs/Checkbox.tsx +1 -1
- package/src/Form/Inputs/CheckboxGroup.tsx +2 -2
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +1 -1
- package/src/Form/Inputs/FieldsTable/FieldsTable.tsx +15 -15
- package/src/Form/Inputs/FieldsTable/Row.tsx +2 -2
- package/src/Form/Inputs/List/Content.tsx +1 -1
- package/src/Form/Inputs/List/List.tsx +3 -3
- package/src/Form/Inputs/PasswordEndAdornment.tsx +1 -1
- package/src/Form/Inputs/Radio.tsx +3 -3
- package/src/Form/Inputs/Switch.tsx +1 -1
- package/src/Form/Inputs/Text.tsx +4 -4
- package/src/Form/Inputs/index.tsx +81 -72
- package/src/Form/Inputs/models.ts +14 -14
- package/src/Form/storiesData.tsx +26 -30
- package/src/Form/storiesData.tsx-E +481 -0
- package/src/Graph/BarChart/BarChart.stories.tsx +1 -1
- package/src/Graph/BarChart/BarChart.tsx +3 -3
- package/src/Graph/BarChart/BarGroup.tsx +6 -4
- package/src/Graph/BarChart/BarStack.tsx +4 -4
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +10 -10
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +5 -5
- package/src/Graph/BarChart/useBarStack.ts +2 -2
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +1 -1
- package/src/Graph/BarStack/BarStack.stories.tsx +1 -1
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +10 -6
- package/src/Graph/BarStack/useResponsiveBarStack.ts +4 -4
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/index.tsx +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/useRegularLines.ts +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +4 -4
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/index.tsx +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/models.ts +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/useScaleThreshold.ts +2 -2
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +7 -7
- package/src/Graph/Chart/BasicComponents/Lines/models.ts +1 -1
- package/src/Graph/Chart/Chart.cypress.spec.tsx +4 -4
- package/src/Graph/Chart/Chart.stories.tsx +6 -6
- package/src/Graph/Chart/Chart.tsx +11 -11
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +1 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/Area.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/Line.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/index.tsx +3 -3
- package/src/Graph/Chart/InteractiveComponents/Annotations/Area/Downtime.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/EventAnnotations.tsx +3 -3
- package/src/Graph/Chart/InteractiveComponents/Annotations/Line/Comments.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/annotationsAtoms.ts +4 -4
- package/src/Graph/Chart/InteractiveComponents/Bar.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltipContent.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +3 -3
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/index.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/models.ts +2 -2
- package/src/Graph/Chart/InteractiveComponents/Tooltip/useGraphTooltip.ts +1 -1
- package/src/Graph/Chart/InteractiveComponents/index.tsx +7 -7
- package/src/Graph/Chart/Legend/LegendHeader.tsx +2 -2
- package/src/Graph/Chart/Legend/index.tsx +3 -3
- package/src/Graph/Chart/common/index.ts +5 -5
- package/src/Graph/Chart/helpers/index.ts +5 -5
- package/src/Graph/Chart/index.tsx +2 -2
- package/src/Graph/Chart/models.ts +4 -4
- package/src/Graph/Gauge/AnimatedPie.tsx +1 -1
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +2 -2
- package/src/Graph/Gauge/PieData.tsx +1 -1
- package/src/Graph/Gauge/ResponsiveGauge.tsx +5 -5
- package/src/Graph/Gauge/models.ts +3 -3
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +3 -3
- package/src/Graph/HeatMap/HeatMapData.json +1 -1
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +1 -1
- package/src/Graph/PieChart/PieChart.stories.tsx +1 -1
- package/src/Graph/PieChart/ResponsivePie.tsx +7 -3
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +8 -8
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +1 -1
- package/src/Graph/SingleBar/SingleBar.tsx +1 -1
- package/src/Graph/Text/Text.cypress.spec.tsx +2 -2
- package/src/Graph/Tree/DescendantNodes.tsx +1 -1
- package/src/Graph/Tree/Links.tsx +5 -5
- package/src/Graph/Tree/StandaloneTree.tsx +1 -1
- package/src/Graph/Tree/Tree.cypress.spec.tsx +2 -2
- package/src/Graph/Tree/Tree.stories.tsx +2 -2
- package/src/Graph/Tree/Tree.tsx +3 -3
- package/src/Graph/Tree/stories/contents.tsx +2 -2
- package/src/Graph/common/Axes/index.tsx +1 -1
- package/src/Graph/common/Axes/models.ts +1 -1
- package/src/Graph/common/Axes/useAxisY.ts +1 -1
- package/src/Graph/common/BaseChart/BaseChart.tsx +1 -1
- package/src/Graph/common/BaseChart/Header/index.tsx +1 -1
- package/src/Graph/common/Thresholds/Thresholds.tsx +2 -2
- package/src/Graph/common/timeSeries/index.test.ts +57 -45
- package/src/Graph/common/timeSeries/index.test.ts-E +622 -0
- package/src/Graph/common/timeSeries/index.ts +30 -30
- package/src/Graph/common/utils.ts +2 -2
- package/src/Graph/mockedData/annotationData.json +318 -320
- package/src/Graph/mockedData/curvesWithSameColor.json +1 -1
- package/src/Graph/mockedData/exclusionPeriodFirstPeriod.json +366 -586
- package/src/Graph/mockedData/exclusionPeriodSecondPeriod.json +370 -586
- package/src/Graph/mockedData/exclusionPeriodThirdPeriod.json +365 -579
- package/src/Graph/mockedData/lastDay.json +1290 -1324
- package/src/Graph/mockedData/lastDayAreaStack.json +3048 -3104
- package/src/Graph/mockedData/lastDayForward.json +1303 -1336
- package/src/Graph/mockedData/lastDayThreshold.json +2318 -2350
- package/src/Graph/mockedData/lastDayWithIncompleteValues.json +7 -41
- package/src/Graph/mockedData/lastDayWithLotOfUnits.json +1618 -1665
- package/src/Graph/mockedData/lastDayWithNullValues.json +7 -41
- package/src/Graph/mockedData/lastMonth.json +1639 -1672
- package/src/Graph/mockedData/lastWeek.json +2167 -2200
- package/src/Graph/mockedData/pingService.json +4 -12
- package/src/Graph/mockedData/pingServiceLinesBars.json +242 -250
- package/src/Graph/mockedData/pingServiceLinesBarsMixed.json +242 -250
- package/src/Graph/mockedData/pingServiceLinesBarsStacked.json +242 -250
- package/src/Graph/mockedData/pingServiceMixedStacked.json +4 -12
- package/src/Graph/mockedData/pingServiceStacked.json +4 -12
- package/src/Graph/mockedData/zoomPreview.json +370 -740
- package/src/Icon/IconAttach/index.tsx +1 -6
- package/src/Image/Image.tsx +75 -75
- package/src/Image/atoms.ts +3 -3
- package/src/Image/index.stories.tsx +1 -1
- package/src/Image/index.test.tsx +53 -53
- package/src/Image/models.ts +3 -3
- package/src/Image/useLoadImage.ts +49 -49
- package/src/InputField/Number/Number.tsx +2 -2
- package/src/InputField/Search/PersistentTooltip.tsx +2 -2
- package/src/InputField/Search/RegexpHelpTooltip.tsx +1 -1
- package/src/InputField/Search/index.stories.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.stories.tsx +4 -4
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +6 -6
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +12 -12
- package/src/InputField/Select/Autocomplete/Draggable/MultiConnected.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +5 -6
- package/src/InputField/Select/Autocomplete/Draggable/index.stories.tsx +6 -6
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +15 -16
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Popover/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/index.stories.tsx +2 -3
- package/src/InputField/Select/Autocomplete/index.tsx +10 -11
- package/src/InputField/Select/IconPopover/index.tsx +3 -3
- package/src/InputField/Select/Option.tsx +1 -1
- package/src/InputField/Select/index.tsx +6 -6
- package/src/InputField/Text/index.stories.tsx +3 -4
- package/src/InputField/Text/index.tsx +3 -3
- package/src/InputField/Text/useAutoSize.ts +62 -62
- package/src/LicenseMessage/index.tsx +1 -1
- package/src/Listing/ActionBar/ColumnMultiSelect.tsx +4 -4
- package/src/Listing/ActionBar/PaginationActions.tsx +1 -1
- package/src/Listing/ActionBar/index.tsx +6 -6
- package/src/Listing/Cell/DataCell.tsx +2 -2
- package/src/Listing/Cell/EllipsisTypography.tsx +0 -2
- package/src/Listing/Cell/index.tsx +7 -8
- package/src/Listing/Checkbox.tsx +1 -1
- package/src/Listing/EmptyResult/EmptyResult.tsx +0 -2
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +1 -1
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +1 -3
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +3 -5
- package/src/Listing/Header/ListingHeader.tsx +6 -7
- package/src/Listing/Header/_internals/DraggableIconButton.tsx +1 -3
- package/src/Listing/Header/_internals/Label.tsx +2 -3
- package/src/Listing/Listing.cypress.spec.tsx +307 -307
- package/src/Listing/Row/Row.tsx +4 -5
- package/src/Listing/Row/SkeletonLoaderRows.tsx +7 -9
- package/src/Listing/index.stories.tsx +1 -1
- package/src/Listing/index.tsx +36 -30
- package/src/Listing/useResizeObserver.ts +1 -1
- package/src/ListingPage/Filter.tsx +15 -18
- package/src/ListingPage/index.tsx +2 -2
- package/src/Logo/CentreonLogo.tsx +2 -2
- package/src/MenuSkeleton/index.tsx +1 -1
- package/src/Module/LicensedModule/LicenseCheck/index.tsx +1 -1
- package/src/Module/index.tsx +3 -3
- package/src/MultiSelectEntries/index.tsx +1 -1
- package/src/MultiSelectEntries/useHover.ts +1 -1
- package/src/Panel/Section/ExpandableSection.tsx +6 -6
- package/src/Panel/Section/index.test.tsx +1 -1
- package/src/Panel/Section/index.tsx +1 -1
- package/src/Panel/index.tsx +15 -13
- package/src/RichTextEditor/ContentEditable.tsx +195 -195
- package/src/RichTextEditor/RichTextEditor.tsx +244 -244
- package/src/RichTextEditor/index.ts +2 -2
- package/src/RichTextEditor/initialEditorState.json +113 -113
- package/src/RichTextEditor/plugins/AutoLinkPlugin/index.tsx +4 -4
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +10 -10
- package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +4 -4
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +7 -7
- package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +124 -124
- package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +5 -5
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +2 -2
- package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +4 -4
- package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +97 -97
- package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +62 -62
- package/src/RichTextEditor/translatedLabels.ts +8 -8
- package/src/Snackbar/SnackbarProvider.tsx +3 -4
- package/src/Snackbar/Transition.tsx +5 -6
- package/src/Snackbar/index.tsx +7 -8
- package/src/SortableItems/Item.tsx +3 -3
- package/src/SortableItems/SortableItem.tsx +1 -1
- package/src/SortableItems/index.stories.tsx +5 -6
- package/src/SortableItems/index.tsx +18 -19
- package/src/StatusChip/index.tsx +1 -1
- package/src/StoryBookThemeProvider/index.tsx +35 -36
- package/src/ThemeProvider/index.tsx +8 -10
- package/src/ThemeProvider/palettes.ts +42 -27
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +1 -1
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/index.tsx +1 -1
- package/src/TimePeriods/SelectedTimePeriod.tsx +1 -1
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +3 -3
- package/src/TimePeriods/TimePeriods.tsx +1 -1
- package/src/TimePeriods/helpers/index.ts +1 -1
- package/src/TimePeriods/index.stories.tsx +1 -1
- package/src/TimePeriods/index.tsx +1 -1
- package/src/TimePeriods/models.ts +2 -2
- package/src/TimePeriods/timePeriodsAtoms.ts +1 -1
- package/src/TimePeriods/useTimePeriod.ts +4 -4
- package/src/TopCounterElements/ResourceSubMenu.tsx +1 -4
- package/src/TopCounterElements/StatusCounter.tsx +2 -2
- package/src/Typography/FluidTypography/index.tsx +46 -46
- package/src/Typography/Subtitle.tsx +2 -2
- package/src/Typography/story.utils.tsx +6 -6
- package/src/WallpaperPage/index.tsx +1 -1
- package/src/Wizard/ActionsBar.test.tsx +1 -1
- package/src/Wizard/ActionsBar.tsx +1 -1
- package/src/Wizard/StepIcon.tsx +1 -1
- package/src/Wizard/Stepper.tsx +2 -2
- package/src/Wizard/WizardContent.tsx +1 -1
- package/src/Wizard/index.stories.tsx +2 -2
- package/src/Wizard/index.test.tsx +3 -3
- package/src/Wizard/index.tsx +2 -2
- package/src/Wizard/models.ts +1 -1
- package/src/api/TestQueryProvider.tsx +24 -24
- package/src/api/buildListingDecoder.ts +1 -1
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +11 -11
- package/src/api/buildListingEndpoint/index.ts +1 -1
- package/src/api/useFetchQuery/index.test.ts +1 -1
- package/src/api/useFetchQuery/index.ts +8 -8
- package/src/api/useGraphQuery/index.ts +1 -1
- package/src/api/useMutationQuery/index.test.ts +1 -1
- package/src/api/useMutationQuery/index.ts +4 -4
- package/src/api/useRequest/index.test.ts +1 -1
- package/src/api/useRequest/index.ts +3 -3
- package/src/base/tokens/source/$metadata.json +2 -4
- package/src/base/tokens/source/base.json +1 -1
- package/src/base/tokens/themes/base.tokens.json +34 -166
- package/src/base/tokens/themes/ui-dark.tokens.json +34 -166
- package/src/base/tokens/themes/ui-light.tokens.json +34 -166
- package/src/components/Button/Icon/IconButton.tsx +1 -1
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +2 -2
- package/src/components/DataTable/DataListing.tsx +1 -1
- package/src/components/DataTable/DataTable.cypress.spec.tsx +1 -1
- package/src/components/DataTable/DataTable.stories.tsx +4 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +1 -1
- package/src/components/DataTable/index.ts +2 -2
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +11 -11
- package/src/components/Form/AccessRights/Actions/Actions.tsx +1 -1
- package/src/components/Form/AccessRights/List/Item.tsx +5 -5
- package/src/components/Form/AccessRights/List/List.tsx +4 -4
- package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +2 -2
- package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +1 -1
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +3 -3
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +2 -2
- package/src/components/Form/AccessRights/Stats/Stats.tsx +2 -2
- package/src/components/Form/AccessRights/atoms.ts +1 -1
- package/src/components/Form/AccessRights/storiesData.ts +1 -1
- package/src/components/Form/AccessRights/useAccessRightsChange.ts +1 -1
- package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +3 -3
- package/src/components/Form/Dashboard/DashboardForm.tsx +5 -5
- package/src/components/Form/Dashboard/GlobalRefreshFieldOption.tsx +4 -4
- package/src/components/Header/PageHeader/PageHeader.tsx +1 -1
- package/src/components/Header/PageHeader/PageHeaderActions.tsx +1 -1
- package/src/components/Header/PageHeader/PageHeaderMain.tsx +1 -1
- package/src/components/Header/PageHeader/PageHeaderMenu.tsx +1 -1
- package/src/components/Header/PageHeader/PageHeaderTitle.tsx +1 -1
- package/src/components/Header/PageHeader/index.ts +2 -2
- package/src/components/Inputs/Switch/Switch.tsx +1 -1
- package/src/components/ItemComposition/ItemComposition.stories.tsx +6 -4
- package/src/components/ItemComposition/index.ts +1 -1
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -1
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +12 -13
- package/src/components/Layout/PageLayout/index.ts +2 -2
- package/src/components/List/Item/ListItem.tsx +3 -3
- package/src/components/List/Item/index.ts +2 -2
- package/src/components/List/List.stories.tsx +16 -14
- package/src/components/List/List.tsx +2 -2
- package/src/components/List/index.ts +1 -1
- package/src/components/Menu/Button/MenuButton.tsx +1 -1
- package/src/components/Menu/index.ts +2 -2
- package/src/components/Menu/useMenu.tsx +3 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +1 -1
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +1 -1
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +1 -1
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/components/Modal/ModalBody.tsx +1 -1
- package/src/components/Modal/ModalHeader.tsx +1 -1
- package/src/components/Modal/index.ts +2 -2
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +2 -2
- package/src/components/Tooltip/ConfirmationTooltip/TooltipContent.tsx +1 -1
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +1 -1
- package/src/components/Zoom/Minimap.tsx +1 -1
- package/src/components/Zoom/Zoom.stories.tsx +1 -1
- package/src/components/Zoom/ZoomContent.tsx +3 -3
- package/src/components/Zoom/localPoint.ts +4 -4
- package/src/components/Zoom/useMinimap.ts +1 -1
- package/src/queryParameters/index.ts +1 -1
- package/src/styles/tokens/themes/_ui-dark.tokens.json +34 -166
- package/src/styles/tokens/themes/_ui-light.tokens.json +34 -166
- package/src/utils/index.ts +29 -29
- package/src/utils/resourcesStatusURL.ts +2 -2
- package/src/utils/sanitizedHTML.ts +1 -1
- package/src/utils/useCopyToClipboard.ts +1 -1
- package/src/utils/useDebounce.ts +1 -1
- package/src/utils/useFullscreen/useFullscreen.ts +2 -2
- package/src/utils/useInfiniteScrollListing.ts +129 -129
- package/src/utils/useIntersectionObserver.ts +1 -1
- package/src/utils/useKeyObserver.tsx +1 -1
- package/src/utils/useLicenseExpirationWarning.test.tsx +1 -1
- package/src/utils/useLicenseExpirationWarning.ts +1 -1
- package/src/utils/useLocaleDateTimeFormat/index.test.tsx +3 -3
- package/src/utils/useLocaleDateTimeFormat/index.ts +1 -1
- package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +4 -4
- package/src/utils/useLocaleTimezoneDate/LocaleTimezoneDate.cypress.spec.tsx +2 -2
- package/src/utils/useMemoComponent.ts +1 -1
- package/src/utils/usePluralizedTranslation.ts +2 -2
- package/src/utils/useViewportIntersection.ts +1 -1
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
import { LineChartData } from '../models';
|
|
2
|
+
|
|
3
|
+
type TestCase = [number | null, string, 1000 | 1024, string | null];
|
|
4
|
+
|
|
5
|
+
describe('timeSeries', () => {
|
|
6
|
+
const graphData: LineChartData = {
|
|
7
|
+
global: {},
|
|
8
|
+
metrics: [
|
|
9
|
+
{
|
|
10
|
+
average_value: 1,
|
|
11
|
+
data: [0, 1],
|
|
12
|
+
ds_data: {
|
|
13
|
+
ds_color_area: 'transparent',
|
|
14
|
+
ds_color_line: 'black',
|
|
15
|
+
ds_filled: false,
|
|
16
|
+
ds_invert: null,
|
|
17
|
+
ds_legend: 'Round-Trip-Time Average',
|
|
18
|
+
ds_order: null,
|
|
19
|
+
ds_stack: null,
|
|
20
|
+
ds_transparency: 80
|
|
21
|
+
},
|
|
22
|
+
legend: 'Round-Trip-Time Average (ms)',
|
|
23
|
+
maximum_value: 1.5,
|
|
24
|
+
metric: 'rta',
|
|
25
|
+
metric_id: 1,
|
|
26
|
+
minimum_value: 0.5,
|
|
27
|
+
unit: 'ms'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
average_value: 1,
|
|
31
|
+
data: [0.5, 3],
|
|
32
|
+
ds_data: {
|
|
33
|
+
ds_color_area: 'blue',
|
|
34
|
+
ds_color_line: 'blue',
|
|
35
|
+
ds_filled: true,
|
|
36
|
+
ds_invert: null,
|
|
37
|
+
ds_legend: 'Time',
|
|
38
|
+
ds_order: null,
|
|
39
|
+
ds_stack: null,
|
|
40
|
+
ds_transparency: 80
|
|
41
|
+
},
|
|
42
|
+
legend: 'Time (ms)',
|
|
43
|
+
maximum_value: 1.5,
|
|
44
|
+
metric: 'time',
|
|
45
|
+
metric_id: 2,
|
|
46
|
+
minimum_value: 0.5,
|
|
47
|
+
unit: 'ms'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
average_value: 1,
|
|
51
|
+
data: [6, 4],
|
|
52
|
+
ds_data: {
|
|
53
|
+
ds_color_area: 'red',
|
|
54
|
+
ds_color_line: 'red',
|
|
55
|
+
ds_filled: true,
|
|
56
|
+
ds_invert: null,
|
|
57
|
+
ds_legend: 'Average duration',
|
|
58
|
+
ds_order: '2',
|
|
59
|
+
ds_stack: '1',
|
|
60
|
+
ds_transparency: 80
|
|
61
|
+
},
|
|
62
|
+
legend: 'Average duration (ms)',
|
|
63
|
+
maximum_value: 1.5,
|
|
64
|
+
metric: 'avgDuration',
|
|
65
|
+
metric_id: 3,
|
|
66
|
+
minimum_value: 0.5,
|
|
67
|
+
unit: 'ms'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
average_value: 1,
|
|
71
|
+
data: [12, 25],
|
|
72
|
+
ds_data: {
|
|
73
|
+
ds_color_area: 'yellow',
|
|
74
|
+
ds_color_line: 'yellow',
|
|
75
|
+
ds_filled: true,
|
|
76
|
+
ds_invert: '1',
|
|
77
|
+
ds_legend: 'Duration',
|
|
78
|
+
ds_order: '1',
|
|
79
|
+
ds_stack: '1',
|
|
80
|
+
ds_transparency: 80
|
|
81
|
+
},
|
|
82
|
+
legend: 'Duration (ms)',
|
|
83
|
+
maximum_value: 1.5,
|
|
84
|
+
metric: 'duration',
|
|
85
|
+
metric_id: 4,
|
|
86
|
+
minimum_value: 0.5,
|
|
87
|
+
unit: 'ms'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
average_value: 1,
|
|
91
|
+
data: [0, 1],
|
|
92
|
+
ds_data: {
|
|
93
|
+
ds_color_area: 'yellow',
|
|
94
|
+
ds_color_line: 'yellow',
|
|
95
|
+
ds_filled: true,
|
|
96
|
+
ds_invert: null,
|
|
97
|
+
ds_legend: 'Packet Loss',
|
|
98
|
+
ds_order: null,
|
|
99
|
+
ds_stack: null,
|
|
100
|
+
ds_transparency: 80
|
|
101
|
+
},
|
|
102
|
+
legend: 'Packet Loss (%)',
|
|
103
|
+
maximum_value: 1.5,
|
|
104
|
+
metric: 'packet_loss',
|
|
105
|
+
metric_id: 5,
|
|
106
|
+
minimum_value: 0.5,
|
|
107
|
+
unit: '%'
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
times: ['2020-11-05T10:35:00Z', '2020-11-05T10:40:00Z']
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
describe('getTimeSeries', () => {
|
|
114
|
+
it('returns the time series for the given graph data', () => {
|
|
115
|
+
expect(getTimeSeries(graphData)).toEqual([
|
|
116
|
+
{
|
|
117
|
+
1: 0,
|
|
118
|
+
2: 0.5,
|
|
119
|
+
3: 6,
|
|
120
|
+
4: 12,
|
|
121
|
+
5: 0,
|
|
122
|
+
timeTick: '2020-11-05T10:35:00Z'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
1: 1,
|
|
126
|
+
2: 3,
|
|
127
|
+
3: 4,
|
|
128
|
+
4: 25,
|
|
129
|
+
5: 1,
|
|
130
|
+
timeTick: '2020-11-05T10:40:00Z'
|
|
131
|
+
}
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('filters metric values below the given lower-limit value', () => {
|
|
136
|
+
const graphDataWithLowerLimit = {
|
|
137
|
+
...graphData,
|
|
138
|
+
global: {
|
|
139
|
+
'lower-limit': 0.4
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
expect(getTimeSeries(graphDataWithLowerLimit)).toEqual([
|
|
144
|
+
{
|
|
145
|
+
2: 0.5,
|
|
146
|
+
3: 6,
|
|
147
|
+
4: 12,
|
|
148
|
+
timeTick: '2020-11-05T10:35:00Z'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
1: 1,
|
|
152
|
+
2: 3,
|
|
153
|
+
3: 4,
|
|
154
|
+
4: 25,
|
|
155
|
+
5: 1,
|
|
156
|
+
timeTick: '2020-11-05T10:40:00Z'
|
|
157
|
+
}
|
|
158
|
+
]);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('getLineData', () => {
|
|
163
|
+
it('returns the line information for the given graph data', () => {
|
|
164
|
+
expect(getLineData(graphData)).toEqual([
|
|
165
|
+
{
|
|
166
|
+
areaColor: 'transparent',
|
|
167
|
+
average_value: 1,
|
|
168
|
+
color: 'black',
|
|
169
|
+
display: true,
|
|
170
|
+
filled: false,
|
|
171
|
+
highlight: undefined,
|
|
172
|
+
invert: null,
|
|
173
|
+
legend: 'Round-Trip-Time Average',
|
|
174
|
+
lineColor: 'black',
|
|
175
|
+
maximum_value: 1.5,
|
|
176
|
+
metric: 'rta',
|
|
177
|
+
metric_id: 1,
|
|
178
|
+
minimum_value: 0.5,
|
|
179
|
+
name: 'Round-Trip-Time Average (ms)',
|
|
180
|
+
stackOrder: null,
|
|
181
|
+
transparency: 80,
|
|
182
|
+
unit: 'ms'
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
areaColor: 'blue',
|
|
186
|
+
average_value: 1,
|
|
187
|
+
color: 'blue',
|
|
188
|
+
display: true,
|
|
189
|
+
filled: true,
|
|
190
|
+
highlight: undefined,
|
|
191
|
+
invert: null,
|
|
192
|
+
legend: 'Time',
|
|
193
|
+
lineColor: 'blue',
|
|
194
|
+
maximum_value: 1.5,
|
|
195
|
+
metric: 'time',
|
|
196
|
+
metric_id: 2,
|
|
197
|
+
minimum_value: 0.5,
|
|
198
|
+
name: 'Time (ms)',
|
|
199
|
+
stackOrder: null,
|
|
200
|
+
transparency: 80,
|
|
201
|
+
unit: 'ms'
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
areaColor: 'red',
|
|
205
|
+
average_value: 1,
|
|
206
|
+
color: 'red',
|
|
207
|
+
display: true,
|
|
208
|
+
filled: true,
|
|
209
|
+
highlight: undefined,
|
|
210
|
+
invert: null,
|
|
211
|
+
legend: 'Average duration',
|
|
212
|
+
lineColor: 'red',
|
|
213
|
+
maximum_value: 1.5,
|
|
214
|
+
metric: 'avgDuration',
|
|
215
|
+
metric_id: 3,
|
|
216
|
+
minimum_value: 0.5,
|
|
217
|
+
name: 'Average duration (ms)',
|
|
218
|
+
stackOrder: 2,
|
|
219
|
+
transparency: 80,
|
|
220
|
+
unit: 'ms'
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
areaColor: 'yellow',
|
|
224
|
+
average_value: 1,
|
|
225
|
+
color: 'yellow',
|
|
226
|
+
display: true,
|
|
227
|
+
filled: true,
|
|
228
|
+
highlight: undefined,
|
|
229
|
+
invert: '1',
|
|
230
|
+
legend: 'Duration',
|
|
231
|
+
lineColor: 'yellow',
|
|
232
|
+
maximum_value: 1.5,
|
|
233
|
+
metric: 'duration',
|
|
234
|
+
metric_id: 4,
|
|
235
|
+
minimum_value: 0.5,
|
|
236
|
+
name: 'Duration (ms)',
|
|
237
|
+
stackOrder: 1,
|
|
238
|
+
transparency: 80,
|
|
239
|
+
unit: 'ms'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
areaColor: 'yellow',
|
|
243
|
+
average_value: 1,
|
|
244
|
+
color: 'yellow',
|
|
245
|
+
display: true,
|
|
246
|
+
filled: true,
|
|
247
|
+
highlight: undefined,
|
|
248
|
+
invert: null,
|
|
249
|
+
legend: 'Packet Loss',
|
|
250
|
+
lineColor: 'yellow',
|
|
251
|
+
maximum_value: 1.5,
|
|
252
|
+
metric: 'packet_loss',
|
|
253
|
+
metric_id: 5,
|
|
254
|
+
minimum_value: 0.5,
|
|
255
|
+
name: 'Packet Loss (%)',
|
|
256
|
+
stackOrder: null,
|
|
257
|
+
transparency: 80,
|
|
258
|
+
unit: '%'
|
|
259
|
+
}
|
|
260
|
+
]);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
describe('getMetrics', () => {
|
|
265
|
+
it('returns the metrics for the given time value', () => {
|
|
266
|
+
expect(
|
|
267
|
+
getMetrics({
|
|
268
|
+
rta: 1,
|
|
269
|
+
time: 0,
|
|
270
|
+
timeTick: '2020-11-05T10:40:00Z'
|
|
271
|
+
})
|
|
272
|
+
).toEqual(['rta', 'time']);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
describe('getMetricValuesForUnit', () => {
|
|
277
|
+
it('returns the values in the given time series corresponding to the given line unit', () => {
|
|
278
|
+
const series = getTimeSeries(graphData);
|
|
279
|
+
const lines = getLineData(graphData);
|
|
280
|
+
const unit = 'ms';
|
|
281
|
+
|
|
282
|
+
expect(
|
|
283
|
+
getMetricValuesForUnit({ lines, timeSeries: series, unit })
|
|
284
|
+
).toEqual([0, 1, 0.5, 3, 6, 4, 12, 25]);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
describe('getUnits', () => {
|
|
289
|
+
it('returns the units for the given lines', () => {
|
|
290
|
+
const lines = getLineData(graphData);
|
|
291
|
+
|
|
292
|
+
expect(getUnits(lines)).toEqual(['ms', '%']);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
describe('getDates', () => {
|
|
297
|
+
it('teruns the dates for the given time series', () => {
|
|
298
|
+
const series = getTimeSeries(graphData);
|
|
299
|
+
|
|
300
|
+
expect(getDates(series)).toEqual([
|
|
301
|
+
new Date('2020-11-05T10:35:00.000Z'),
|
|
302
|
+
new Date('2020-11-05T10:40:00.000Z')
|
|
303
|
+
]);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
describe('getLineForMetric', () => {
|
|
308
|
+
it('returns the line corresponding to the given metrics', () => {
|
|
309
|
+
const lines = getLineData(graphData);
|
|
310
|
+
|
|
311
|
+
expect(getLineForMetric({ lines, metric_id: 1 })).toEqual({
|
|
312
|
+
areaColor: 'transparent',
|
|
313
|
+
average_value: 1,
|
|
314
|
+
color: 'black',
|
|
315
|
+
display: true,
|
|
316
|
+
filled: false,
|
|
317
|
+
highlight: undefined,
|
|
318
|
+
invert: null,
|
|
319
|
+
legend: 'Round-Trip-Time Average',
|
|
320
|
+
lineColor: 'black',
|
|
321
|
+
maximum_value: 1.5,
|
|
322
|
+
metric: 'rta',
|
|
323
|
+
metric_id: 1,
|
|
324
|
+
minimum_value: 0.5,
|
|
325
|
+
name: 'Round-Trip-Time Average (ms)',
|
|
326
|
+
stackOrder: null,
|
|
327
|
+
transparency: 80,
|
|
328
|
+
unit: 'ms'
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
describe('getMetricValuesForLines', () => {
|
|
334
|
+
it('returns the metric values for the given lines within the given time series', () => {
|
|
335
|
+
const lines = getLineData(graphData);
|
|
336
|
+
const series = getTimeSeries(graphData);
|
|
337
|
+
|
|
338
|
+
expect(
|
|
339
|
+
getMetricValuesForLines({ lines, timeSeries: series })
|
|
340
|
+
).toEqual([0, 1, 0.5, 3, 6, 4, 12, 25, 0, 1]);
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
describe(formatMetricValue, () => {
|
|
345
|
+
const cases: Array<TestCase> = [
|
|
346
|
+
[218857269, '', 1000, '218.86m'],
|
|
347
|
+
[218857269, '', 1024, '208.72 M'],
|
|
348
|
+
[0.12232323445, '', 1000, '0.12'],
|
|
349
|
+
[1024, 'B', 1000, '1 KB'],
|
|
350
|
+
[1024, 'B', 1024, '1 KB'],
|
|
351
|
+
[null, 'B', 1024, null]
|
|
352
|
+
];
|
|
353
|
+
|
|
354
|
+
it.each(cases)(
|
|
355
|
+
'formats the given value to a human readable form according to the given unit and base',
|
|
356
|
+
(value, unit, base, formattedResult) => {
|
|
357
|
+
expect(formatMetricValue({ base, unit, value })).toEqual(
|
|
358
|
+
formattedResult
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
describe('getSortedStackedLines', () => {
|
|
365
|
+
it('returns stacked lines sorted by their own order for the given lines', () => {
|
|
366
|
+
const lines = getLineData(graphData);
|
|
367
|
+
|
|
368
|
+
expect(getSortedStackedLines(lines)).toEqual([
|
|
369
|
+
{
|
|
370
|
+
areaColor: 'yellow',
|
|
371
|
+
average_value: 1,
|
|
372
|
+
color: 'yellow',
|
|
373
|
+
display: true,
|
|
374
|
+
filled: true,
|
|
375
|
+
highlight: undefined,
|
|
376
|
+
invert: '1',
|
|
377
|
+
legend: 'Duration',
|
|
378
|
+
lineColor: 'yellow',
|
|
379
|
+
maximum_value: 1.5,
|
|
380
|
+
metric: 'duration',
|
|
381
|
+
metric_id: 4,
|
|
382
|
+
minimum_value: 0.5,
|
|
383
|
+
name: 'Duration (ms)',
|
|
384
|
+
stackOrder: 1,
|
|
385
|
+
transparency: 80,
|
|
386
|
+
unit: 'ms'
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
areaColor: 'red',
|
|
390
|
+
average_value: 1,
|
|
391
|
+
color: 'red',
|
|
392
|
+
display: true,
|
|
393
|
+
filled: true,
|
|
394
|
+
highlight: undefined,
|
|
395
|
+
invert: null,
|
|
396
|
+
legend: 'Average duration',
|
|
397
|
+
lineColor: 'red',
|
|
398
|
+
maximum_value: 1.5,
|
|
399
|
+
metric: 'avgDuration',
|
|
400
|
+
metric_id: 3,
|
|
401
|
+
minimum_value: 0.5,
|
|
402
|
+
name: 'Average duration (ms)',
|
|
403
|
+
stackOrder: 2,
|
|
404
|
+
transparency: 80,
|
|
405
|
+
unit: 'ms'
|
|
406
|
+
}
|
|
407
|
+
]);
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
describe('getStackedMetricValues', () => {
|
|
412
|
+
it('returns stacked metrics values for the given lines and the given time series', () => {
|
|
413
|
+
const lines = getLineData(graphData);
|
|
414
|
+
const series = getTimeSeries(graphData);
|
|
415
|
+
|
|
416
|
+
expect(
|
|
417
|
+
getStackedMetricValues({
|
|
418
|
+
lines: getSortedStackedLines(lines),
|
|
419
|
+
timeSeries: series
|
|
420
|
+
})
|
|
421
|
+
).toEqual([18, 29]);
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
describe('getTimeSeriesForLines', () => {
|
|
426
|
+
it('returns the specific time series for the given lines and the fiven time series', () => {
|
|
427
|
+
const lines = getLineData(graphData);
|
|
428
|
+
const series = getTimeSeries(graphData);
|
|
429
|
+
|
|
430
|
+
expect(
|
|
431
|
+
getTimeSeriesForLines({
|
|
432
|
+
lines: getSortedStackedLines(lines),
|
|
433
|
+
timeSeries: series
|
|
434
|
+
})
|
|
435
|
+
).toEqual([
|
|
436
|
+
{
|
|
437
|
+
3: 6,
|
|
438
|
+
4: 12,
|
|
439
|
+
timeTick: '2020-11-05T10:35:00Z'
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
3: 4,
|
|
443
|
+
4: 25,
|
|
444
|
+
timeTick: '2020-11-05T10:40:00Z'
|
|
445
|
+
}
|
|
446
|
+
]);
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
describe('getInvertedStackedLines', () => {
|
|
451
|
+
it('returns inverted and stacked lines for the given lines', () => {
|
|
452
|
+
const lines = getLineData(graphData);
|
|
453
|
+
|
|
454
|
+
expect(getInvertedStackedLines(lines)).toEqual([
|
|
455
|
+
{
|
|
456
|
+
areaColor: 'yellow',
|
|
457
|
+
average_value: 1,
|
|
458
|
+
color: 'yellow',
|
|
459
|
+
display: true,
|
|
460
|
+
filled: true,
|
|
461
|
+
highlight: undefined,
|
|
462
|
+
invert: '1',
|
|
463
|
+
legend: 'Duration',
|
|
464
|
+
lineColor: 'yellow',
|
|
465
|
+
maximum_value: 1.5,
|
|
466
|
+
metric: 'duration',
|
|
467
|
+
metric_id: 4,
|
|
468
|
+
minimum_value: 0.5,
|
|
469
|
+
name: 'Duration (ms)',
|
|
470
|
+
stackOrder: 1,
|
|
471
|
+
transparency: 80,
|
|
472
|
+
unit: 'ms'
|
|
473
|
+
}
|
|
474
|
+
]);
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
describe('getNotInvertedStackedLines', () => {
|
|
479
|
+
it('returns not inverted and stacked lines for the given lines', () => {
|
|
480
|
+
const lines = getLineData(graphData);
|
|
481
|
+
|
|
482
|
+
expect(getNotInvertedStackedLines(lines)).toEqual([
|
|
483
|
+
{
|
|
484
|
+
areaColor: 'red',
|
|
485
|
+
average_value: 1,
|
|
486
|
+
color: 'red',
|
|
487
|
+
display: true,
|
|
488
|
+
filled: true,
|
|
489
|
+
highlight: undefined,
|
|
490
|
+
invert: null,
|
|
491
|
+
legend: 'Average duration',
|
|
492
|
+
lineColor: 'red',
|
|
493
|
+
maximum_value: 1.5,
|
|
494
|
+
metric: 'avgDuration',
|
|
495
|
+
metric_id: 3,
|
|
496
|
+
minimum_value: 0.5,
|
|
497
|
+
name: 'Average duration (ms)',
|
|
498
|
+
stackOrder: 2,
|
|
499
|
+
transparency: 80,
|
|
500
|
+
unit: 'ms'
|
|
501
|
+
}
|
|
502
|
+
]);
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
describe('hasUnitStackedLines', () => {
|
|
507
|
+
it('returns true if the given unit contains stacked lines following the given lines, false otherwise', () => {
|
|
508
|
+
const lines = getLineData(graphData);
|
|
509
|
+
|
|
510
|
+
expect(hasUnitStackedLines({ lines, unit: 'ms' })).toEqual(
|
|
511
|
+
true
|
|
512
|
+
);
|
|
513
|
+
|
|
514
|
+
expect(hasUnitStackedLines({ lines, unit: '%' })).toEqual(
|
|
515
|
+
false
|
|
516
|
+
);
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
describe('Format value with unit', () => {
|
|
522
|
+
const units = [
|
|
523
|
+
'B',
|
|
524
|
+
'bytes',
|
|
525
|
+
'bytespersecond',
|
|
526
|
+
'B/s',
|
|
527
|
+
'B/sec',
|
|
528
|
+
'o',
|
|
529
|
+
'octets',
|
|
530
|
+
'b/s',
|
|
531
|
+
'b',
|
|
532
|
+
'ms',
|
|
533
|
+
'%',
|
|
534
|
+
''
|
|
535
|
+
];
|
|
536
|
+
|
|
537
|
+
const getExpectedResult = (unit): string => {
|
|
538
|
+
if (unit === '') {
|
|
539
|
+
return '324.23m';
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return `309.21 M${unit}`;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
const humanReadableTestCases = units.map((unit) => {
|
|
546
|
+
if (unit === '%') {
|
|
547
|
+
return {
|
|
548
|
+
expectedResult: '45.56%',
|
|
549
|
+
unit,
|
|
550
|
+
value: 45.55678
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
if (unit === 'ms') {
|
|
555
|
+
return {
|
|
556
|
+
expectedResult: '34.23 seconds',
|
|
557
|
+
unit,
|
|
558
|
+
value: 34232
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return {
|
|
563
|
+
expectedResult: getExpectedResult(unit),
|
|
564
|
+
unit,
|
|
565
|
+
value: 324234232.34233
|
|
566
|
+
};
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
const rawTestCases = units.map((unit) => {
|
|
570
|
+
if (unit === '%') {
|
|
571
|
+
return {
|
|
572
|
+
expectedResult: '45.55678%',
|
|
573
|
+
unit,
|
|
574
|
+
value: 45.55678
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (unit === 'ms') {
|
|
579
|
+
return {
|
|
580
|
+
expectedResult: '34232 ms',
|
|
581
|
+
unit,
|
|
582
|
+
value: 34232
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return {
|
|
587
|
+
expectedResult:
|
|
588
|
+
unit === '' ? '324234232.34233 ' : `324234232.34233 ${unit}`,
|
|
589
|
+
unit,
|
|
590
|
+
value: 324234232.34233
|
|
591
|
+
};
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
describe('Format the value as human readable', () => {
|
|
595
|
+
it.each(humanReadableTestCases)(
|
|
596
|
+
'formats the value with $unit',
|
|
597
|
+
({ value, unit, expectedResult }) => {
|
|
598
|
+
expect(
|
|
599
|
+
formatMetricValueWithUnit({
|
|
600
|
+
unit,
|
|
601
|
+
value
|
|
602
|
+
})
|
|
603
|
+
).toEqual(expectedResult);
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
describe('Format the value as raw', () => {
|
|
609
|
+
it.each(rawTestCases)(
|
|
610
|
+
'formats the value with $unit',
|
|
611
|
+
({ value, unit, expectedResult }) => {
|
|
612
|
+
expect(
|
|
613
|
+
timeSeries.formatMetricValueWithUnit({
|
|
614
|
+
isRaw: true,
|
|
615
|
+
unit,
|
|
616
|
+
value
|
|
617
|
+
})
|
|
618
|
+
).toEqual(expectedResult);
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
});
|
|
622
|
+
});
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import numeral from 'numeral';
|
|
2
1
|
import { Scale } from '@visx/visx';
|
|
3
2
|
import { bisector } from 'd3-array';
|
|
4
3
|
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
4
|
+
import numeral from 'numeral';
|
|
5
5
|
import {
|
|
6
|
-
map,
|
|
7
|
-
pipe,
|
|
8
|
-
reduce,
|
|
9
|
-
filter,
|
|
10
|
-
addIndex,
|
|
11
|
-
isNil,
|
|
12
6
|
path,
|
|
13
|
-
|
|
7
|
+
T,
|
|
8
|
+
add,
|
|
9
|
+
addIndex,
|
|
10
|
+
always,
|
|
11
|
+
any,
|
|
12
|
+
cond,
|
|
14
13
|
equals,
|
|
14
|
+
filter,
|
|
15
|
+
find,
|
|
16
|
+
flatten,
|
|
17
|
+
head,
|
|
18
|
+
identity,
|
|
19
|
+
includes,
|
|
20
|
+
isEmpty,
|
|
21
|
+
isNil,
|
|
22
|
+
isNotNil,
|
|
15
23
|
keys,
|
|
24
|
+
last,
|
|
25
|
+
lt,
|
|
26
|
+
map,
|
|
27
|
+
negate,
|
|
28
|
+
pipe,
|
|
16
29
|
prop,
|
|
17
|
-
flatten,
|
|
18
30
|
propEq,
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
reduce,
|
|
32
|
+
reject,
|
|
21
33
|
sortBy,
|
|
22
|
-
add,
|
|
23
|
-
isEmpty,
|
|
24
|
-
any,
|
|
25
|
-
lt,
|
|
26
|
-
identity,
|
|
27
|
-
head,
|
|
28
|
-
last,
|
|
29
|
-
cond,
|
|
30
|
-
always,
|
|
31
|
-
T,
|
|
32
|
-
includes,
|
|
33
34
|
split,
|
|
34
|
-
|
|
35
|
-
isNotNil
|
|
35
|
+
uniq
|
|
36
36
|
} from 'ramda';
|
|
37
37
|
|
|
38
38
|
import { margin } from '../../Chart/common';
|
|
39
39
|
import { LineChartData } from '../models';
|
|
40
40
|
|
|
41
41
|
import {
|
|
42
|
-
Metric,
|
|
43
|
-
TimeValue,
|
|
44
|
-
Line,
|
|
45
42
|
AxeScale,
|
|
46
|
-
Xscale,
|
|
47
43
|
FormatMetricValueProps,
|
|
48
|
-
|
|
44
|
+
Line,
|
|
45
|
+
Metric,
|
|
46
|
+
TimeValue,
|
|
47
|
+
TimeValueProps,
|
|
48
|
+
Xscale
|
|
49
49
|
} from './models';
|
|
50
50
|
|
|
51
51
|
interface TimeTickWithMetrics {
|
|
@@ -137,7 +137,7 @@ const toLine = ({
|
|
|
137
137
|
name: legend,
|
|
138
138
|
stackOrder:
|
|
139
139
|
equals(ds_data.ds_stack, '1') || equals(ds_data.ds_stack, true)
|
|
140
|
-
? parseInt(ds_data.ds_order || '0', 10)
|
|
140
|
+
? Number.parseInt(ds_data.ds_order || '0', 10)
|
|
141
141
|
: null,
|
|
142
142
|
transparency: ds_data.ds_transparency,
|
|
143
143
|
unit
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import numeral from 'numeral';
|
|
1
2
|
import {
|
|
2
3
|
T,
|
|
3
4
|
always,
|
|
@@ -12,9 +13,8 @@ import {
|
|
|
12
13
|
lte,
|
|
13
14
|
pluck
|
|
14
15
|
} from 'ramda';
|
|
15
|
-
import numeral from 'numeral';
|
|
16
16
|
|
|
17
|
-
import { darken, getLuminance, lighten
|
|
17
|
+
import { Theme, darken, getLuminance, lighten } from '@mui/material';
|
|
18
18
|
|
|
19
19
|
import { Thresholds } from './models';
|
|
20
20
|
|