@centreon/ui 26.3.4 → 26.3.6
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 +1 -1
- package/src/ActionsList/ActionsList.styles.ts +2 -2
- package/src/ActionsList/index.stories.tsx +2 -3
- package/src/ActionsList/index.tsx +8 -9
- package/src/Button/Icon/index.stories.tsx +5 -5
- package/src/Button/Icon/index.tsx +3 -3
- package/src/Button/Save/index.stories.tsx +8 -8
- package/src/Button/Save/index.tsx +5 -6
- package/src/Button/Save/useSave.tsx +10 -8
- package/src/Checkbox/Checkbox.tsx +6 -6
- package/src/Checkbox/CheckboxGroup/index.stories.tsx +1 -1
- package/src/Checkbox/CheckboxGroup/index.tsx +6 -7
- package/src/Checkbox/index.stories.tsx +3 -3
- package/src/Checkbox/index.tsx +1 -1
- package/src/Colors/index.stories.tsx +2 -3
- package/src/Colors/index.tsx +6 -6
- package/src/ContentWithCircularProgress/index.stories.tsx +5 -5
- package/src/ContentWithCircularProgress/index.tsx +2 -3
- package/src/Dashboard/Dashboard.styles.ts +39 -39
- package/src/Dashboard/DashboardLayout.stories.tsx +3 -4
- package/src/Dashboard/Grid.tsx +7 -9
- package/src/Dashboard/Item.tsx +15 -15
- package/src/Dashboard/Layout.tsx +16 -14
- package/src/Dashboard/utils.ts +1 -1
- package/src/Dialog/Confirm/index.stories.tsx +1 -1
- package/src/Dialog/Confirm/index.tsx +3 -3
- package/src/Dialog/Duplicate/index.stories.tsx +3 -3
- package/src/Dialog/Duplicate/index.test.tsx +90 -90
- package/src/Dialog/Duplicate/index.tsx +7 -8
- package/src/Dialog/UnsavedChanges/index.stories.tsx +3 -4
- package/src/Dialog/UnsavedChanges/index.tsx +1 -2
- package/src/Dialog/UnsavedChanges/translatedLabels.ts +5 -5
- package/src/Dialog/UnsavedChanges/useUnsavedChanges.ts +1 -2
- package/src/Dialog/index.stories.tsx +4 -5
- package/src/Dialog/index.tsx +9 -10
- package/src/FallbackPage/FallbackPage.stories.tsx +1 -1
- package/src/FallbackPage/FallbackPage.tsx +2 -3
- package/src/FileDropZone/index.stories.tsx +8 -9
- package/src/FileDropZone/index.tsx +12 -13
- package/src/FileDropZone/useDropzone.test.ts +5 -2
- package/src/FileDropZone/useDropzone.ts +6 -8
- package/src/Form/CollapsibleGroup.tsx +18 -13
- package/src/Form/Form.cypress.spec.tsx +12 -13
- package/src/Form/Form.stories.tsx +5 -5
- package/src/Form/Form.tsx +8 -8
- package/src/Form/FormButtons.tsx +5 -7
- package/src/Form/Inputs/Autocomplete.tsx +13 -15
- package/src/Form/Inputs/Checkbox.tsx +5 -7
- package/src/Form/Inputs/CheckboxGroup.tsx +7 -9
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +27 -21
- package/src/Form/Inputs/Custom.tsx +1 -1
- package/src/Form/Inputs/FieldsTable/FieldsTable.tsx +18 -17
- package/src/Form/Inputs/FieldsTable/Row.tsx +7 -8
- package/src/Form/Inputs/File.tsx +12 -10
- package/src/Form/Inputs/Grid.tsx +8 -7
- package/src/Form/Inputs/List/Content.tsx +4 -6
- package/src/Form/Inputs/List/List.styles.ts +1 -1
- package/src/Form/Inputs/List/List.tsx +6 -8
- package/src/Form/Inputs/List/useList.ts +5 -6
- package/src/Form/Inputs/LoadingSkeleton.tsx +1 -2
- package/src/Form/Inputs/PasswordEndAdornment.tsx +3 -3
- package/src/Form/Inputs/Radio.tsx +11 -12
- package/src/Form/Inputs/Switch.tsx +9 -11
- package/src/Form/Inputs/Text.tsx +18 -20
- package/src/Form/Inputs/index.tsx +20 -17
- package/src/Form/Inputs/models.ts +5 -5
- package/src/Form/Section/FormSection.tsx +12 -10
- package/src/Form/Section/PanelTabs.tsx +8 -4
- package/src/Form/storiesData.tsx +19 -20
- package/src/Graph/BarChart/Bar.tsx +126 -0
- package/src/Graph/BarChart/BarChart.cypress.spec.tsx +13 -14
- package/src/Graph/BarChart/BarChart.stories.tsx +30 -29
- package/src/Graph/BarChart/BarChart.tsx +20 -20
- package/src/Graph/BarChart/BarGroup.tsx +12 -12
- package/src/Graph/BarChart/BarStack.tsx +30 -103
- package/src/Graph/BarChart/MemoizedGroup.tsx +10 -9
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +110 -116
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +7 -8
- package/src/Graph/BarChart/atoms.ts +1 -1
- package/src/Graph/BarChart/models.ts +1 -1
- package/src/Graph/BarChart/useBarStack.ts +5 -7
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +3 -3
- package/src/Graph/BarStack/BarStack.stories.tsx +13 -14
- package/src/Graph/BarStack/BarStack.styles.ts +25 -24
- package/src/Graph/BarStack/BarStack.tsx +1 -2
- package/src/Graph/BarStack/Graph.tsx +42 -24
- package/src/Graph/BarStack/GraphAndLegend.tsx +10 -9
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +21 -20
- package/src/Graph/BarStack/useGraphAndLegend.ts +4 -3
- package/src/Graph/BarStack/useResponsiveBarStack.ts +9 -11
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/index.tsx +3 -4
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/useRegularLines.ts +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +11 -11
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +3 -3
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/BasicThreshold.tsx +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/Circle.tsx +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +5 -6
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +3 -4
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/helpers/index.ts +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/index.tsx +1 -2
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/useCoordinateCircle.ts +3 -4
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/useScaleThreshold.ts +6 -7
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +10 -12
- package/src/Graph/Chart/BasicComponents/Lines/models.ts +4 -5
- package/src/Graph/Chart/Chart.cypress.spec.tsx +33 -36
- package/src/Graph/Chart/Chart.stories.tsx +51 -54
- package/src/Graph/Chart/Chart.styles.ts +2 -2
- package/src/Graph/Chart/Chart.tsx +111 -108
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +3 -3
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +7 -9
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +7 -9
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/models.ts +2 -2
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +20 -18
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/Area.tsx +11 -8
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/Line.tsx +8 -5
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/index.tsx +7 -6
- package/src/Graph/Chart/InteractiveComponents/Annotations/Area/Downtime.tsx +4 -4
- package/src/Graph/Chart/InteractiveComponents/Annotations/EventAnnotations.tsx +3 -3
- package/src/Graph/Chart/InteractiveComponents/Annotations/Line/Acknowledgement.tsx +4 -4
- package/src/Graph/Chart/InteractiveComponents/Annotations/Line/Comments.tsx +4 -4
- package/src/Graph/Chart/InteractiveComponents/Annotations/annotationsAtoms.ts +7 -7
- package/src/Graph/Chart/InteractiveComponents/Annotations/index.tsx +3 -4
- package/src/Graph/Chart/InteractiveComponents/Annotations/models.ts +1 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/useAnnotation.ts +12 -8
- package/src/Graph/Chart/InteractiveComponents/Bar.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +3 -4
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltipContent.tsx +3 -4
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +3 -3
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/TimeShiftIcon.tsx +4 -4
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +6 -8
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/index.tsx +6 -8
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/models.ts +1 -1
- package/src/Graph/Chart/InteractiveComponents/TimeShiftZones/useTimeShiftZones.ts +42 -31
- package/src/Graph/Chart/InteractiveComponents/Tooltip/index.tsx +13 -12
- package/src/Graph/Chart/InteractiveComponents/Tooltip/useGraphTooltip.ts +14 -8
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/index.tsx +6 -7
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/models.ts +3 -3
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/useZoomPreview.ts +8 -8
- package/src/Graph/Chart/InteractiveComponents/index.tsx +25 -27
- package/src/Graph/Chart/InteractiveComponents/interactionWithGraphAtoms.ts +2 -2
- package/src/Graph/Chart/Legend/LegendContent.tsx +2 -2
- package/src/Graph/Chart/Legend/LegendHeader.tsx +3 -3
- package/src/Graph/Chart/Legend/index.tsx +21 -22
- package/src/Graph/Chart/Legend/useLegend.ts +3 -4
- package/src/Graph/Chart/LoadingSkeleton.tsx +2 -2
- package/src/Graph/Chart/common/index.ts +2 -2
- package/src/Graph/Chart/graphAtoms.ts +1 -1
- package/src/Graph/Chart/helpers/index.ts +4 -1
- package/src/Graph/Chart/index.tsx +36 -35
- package/src/Graph/Chart/models.ts +2 -4
- package/src/Graph/Chart/useChartData.ts +5 -7
- package/src/Graph/Gauge/AnimatedPie.tsx +4 -4
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +1 -2
- package/src/Graph/Gauge/Gauge.stories.tsx +1 -2
- package/src/Graph/Gauge/Gauge.tsx +5 -5
- package/src/Graph/Gauge/PieData.tsx +3 -4
- package/src/Graph/Gauge/ResponsiveGauge.tsx +5 -6
- package/src/Graph/Gauge/Thresholds.tsx +3 -3
- package/src/Graph/Gauge/models.ts +2 -2
- package/src/Graph/Gauge/useResizeObserver.ts +4 -4
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +3 -4
- package/src/Graph/HeatMap/HeatMap.stories.tsx +3 -4
- package/src/Graph/HeatMap/HeatMap.tsx +1 -2
- package/src/Graph/HeatMap/HeatMapData.json +60 -60
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +8 -10
- package/src/Graph/Legend/Legend.styles.ts +1 -1
- package/src/Graph/Legend/Legend.tsx +4 -4
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +1 -1
- package/src/Graph/PieChart/PieChart.stories.tsx +4 -4
- package/src/Graph/PieChart/PieChart.tsx +1 -2
- package/src/Graph/PieChart/ResponsivePie.tsx +43 -41
- package/src/Graph/PieChart/useResponsivePie.ts +2 -3
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +39 -18
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +26 -2
- package/src/Graph/SingleBar/SingleBar.stories.tsx +51 -3
- package/src/Graph/SingleBar/SingleBar.tsx +2 -2
- package/src/Graph/SingleBar/ThresholdLine.tsx +46 -37
- package/src/Graph/SingleBar/Thresholds.tsx +11 -4
- package/src/Graph/SingleBar/models.ts +3 -1
- package/src/Graph/Text/Text.cypress.spec.tsx +1 -2
- package/src/Graph/Text/Text.stories.tsx +1 -2
- package/src/Graph/Text/Text.tsx +7 -8
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +34 -31
- package/src/Graph/Timeline/Timeline.cypress.spec.tsx +22 -20
- package/src/Graph/Timeline/Timeline.stories.tsx +19 -18
- package/src/Graph/Timeline/Timeline.tsx +4 -4
- package/src/Graph/Timeline/timeline.styles.ts +3 -3
- package/src/Graph/Timeline/useTimeline.ts +19 -15
- package/src/Graph/Tree/DescendantNodes.tsx +3 -4
- package/src/Graph/Tree/Links.tsx +5 -5
- package/src/Graph/Tree/StandaloneTree.tsx +2 -2
- package/src/Graph/Tree/Tree.cypress.spec.tsx +6 -7
- package/src/Graph/Tree/Tree.stories.tsx +8 -11
- package/src/Graph/Tree/Tree.tsx +6 -8
- package/src/Graph/Tree/index.ts +2 -2
- package/src/Graph/Tree/stories/contents.tsx +8 -9
- package/src/Graph/Tree/stories/datas.ts +1 -1
- package/src/Graph/Tree/utils.ts +1 -1
- package/src/Graph/common/Axes/UnitLabel.tsx +1 -2
- package/src/Graph/common/Axes/index.tsx +6 -7
- package/src/Graph/common/Axes/models.ts +2 -2
- package/src/Graph/common/Axes/useAxisY.ts +2 -4
- package/src/Graph/common/BaseChart/AdditionalLine.tsx +5 -4
- package/src/Graph/common/BaseChart/BaseChart.tsx +15 -11
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +7 -6
- package/src/Graph/common/BaseChart/Header/index.tsx +4 -4
- package/src/Graph/common/BaseChart/Header/useHeaderStyles.ts +2 -2
- package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +2 -3
- package/src/Graph/common/BaseChart/useComputeYAxisMaxCharacters.ts +12 -11
- package/src/Graph/common/Grids/index.tsx +3 -4
- package/src/Graph/common/Thresholds/ThresholdLine.tsx +13 -10
- package/src/Graph/common/Thresholds/Thresholds.tsx +3 -4
- package/src/Graph/common/models.ts +1 -1
- package/src/Graph/common/timeSeries/index.test.ts +32 -33
- package/src/Graph/common/timeSeries/index.ts +26 -27
- package/src/Graph/common/timeSeries/models.ts +2 -2
- package/src/Graph/common/useMarginTop.ts +5 -1
- package/src/Graph/common/utils.ts +12 -12
- package/src/Graph/index.ts +11 -11
- package/src/Graph/mockedData/annotationData.json +141 -141
- package/src/Graph/mockedData/curvesWithSameColor.json +97 -97
- package/src/Graph/mockedData/dataWithMissingPoint.json +34 -34
- package/src/Graph/mockedData/exclusionPeriodFirstPeriod.json +210 -210
- package/src/Graph/mockedData/exclusionPeriodSecondPeriod.json +210 -210
- package/src/Graph/mockedData/exclusionPeriodThirdPeriod.json +210 -210
- package/src/Graph/mockedData/lastDay.json +94 -94
- package/src/Graph/mockedData/lastDayAreaStack.json +325 -325
- package/src/Graph/mockedData/lastDayForward.json +108 -108
- package/src/Graph/mockedData/lastDayThreshold.json +210 -210
- package/src/Graph/mockedData/lastDayWithIncompleteValues.json +94 -94
- package/src/Graph/mockedData/lastDayWithLotOfUnits.json +125 -125
- package/src/Graph/mockedData/lastDayWithNullValues.json +94 -94
- package/src/Graph/mockedData/lastMonth.json +108 -108
- package/src/Graph/mockedData/lastWeek.json +108 -108
- package/src/Graph/mockedData/pingService.json +107 -107
- package/src/Graph/mockedData/pingServiceLinesBars.json +114 -114
- package/src/Graph/mockedData/pingServiceLinesBarsMixed.json +114 -114
- package/src/Graph/mockedData/pingServiceLinesBarsStacked.json +114 -114
- package/src/Graph/mockedData/pingServiceMixedStacked.json +109 -109
- package/src/Graph/mockedData/pingServiceStacked.json +109 -109
- package/src/Graph/mockedData/pingServiceWithStackedKeys.json +88 -88
- package/src/Graph/mockedData/zoomPreview.json +108 -108
- package/src/Icon/AcknowledgementIcon.tsx +2 -2
- package/src/Icon/BaseIcon.tsx +3 -3
- package/src/Icon/BusinessActivityIcon.tsx +2 -2
- package/src/Icon/ContainerIcon.tsx +1 -1
- package/src/Icon/DowntimeIcon.tsx +2 -2
- package/src/Icon/FlappingIcon.tsx +2 -2
- package/src/Icon/HostGroupIcon.tsx +2 -2
- package/src/Icon/HostIcon.tsx +2 -2
- package/src/Icon/IconAttach/index.stories.tsx +2 -2
- package/src/Icon/MetaServiceIcon.tsx +2 -2
- package/src/Icon/RegexIcon.tsx +5 -3
- package/src/Icon/ServiceGroupIcon.tsx +2 -2
- package/src/Icon/ServiceIcon.tsx +2 -2
- package/src/Icon/index.ts +6 -6
- package/src/Image/Image.tsx +1 -2
- package/src/Image/index.stories.tsx +1 -2
- package/src/Image/index.test.tsx +45 -45
- package/src/Image/useLoadImage.ts +1 -1
- package/src/InputField/Number/Number.cypress.spec.tsx +3 -3
- package/src/InputField/Number/Number.stories.tsx +8 -6
- package/src/InputField/Number/Number.tsx +7 -8
- package/src/InputField/Search/PersistentTooltip.tsx +6 -7
- package/src/InputField/Search/RegexpHelpTooltip.tsx +2 -3
- package/src/InputField/Search/index.stories.tsx +1 -2
- package/src/InputField/Search/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +3 -2
- package/src/InputField/Select/Autocomplete/Connected/Multi/Popover.tsx +0 -1
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/Single.tsx +0 -1
- package/src/InputField/Select/Autocomplete/Connected/index.stories.tsx +2 -3
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +107 -107
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +43 -36
- package/src/InputField/Select/Autocomplete/Draggable/Multi.tsx +0 -1
- package/src/InputField/Select/Autocomplete/Draggable/MultiConnected.tsx +0 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +6 -8
- package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +11 -11
- package/src/InputField/Select/Autocomplete/Draggable/index.stories.tsx +7 -10
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +19 -20
- package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +7 -6
- package/src/InputField/Select/Autocomplete/Multi/Multi.styles.ts +7 -7
- package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +16 -16
- package/src/InputField/Select/Autocomplete/Multi/Popover.tsx +0 -1
- package/src/InputField/Select/Autocomplete/Multi/index.stories.tsx +3 -4
- package/src/InputField/Select/Autocomplete/Popover/index.tsx +10 -11
- package/src/InputField/Select/Autocomplete/autoComplete.styles.ts +3 -3
- package/src/InputField/Select/Autocomplete/index.stories.tsx +5 -4
- package/src/InputField/Select/Autocomplete/index.tsx +41 -34
- package/src/InputField/Select/IconPopover/index.stories.tsx +1 -1
- package/src/InputField/Select/IconPopover/index.tsx +13 -15
- package/src/InputField/Select/Option.tsx +4 -5
- package/src/InputField/Select/index.stories.tsx +5 -5
- package/src/InputField/Select/index.tsx +11 -12
- package/src/InputField/Text/index.stories.tsx +6 -6
- package/src/InputField/Text/index.tsx +19 -21
- package/src/InputField/Text/useAutoSize.ts +10 -4
- package/src/LicenseMessage/index.stories.tsx +3 -3
- package/src/LicenseMessage/index.tsx +2 -2
- package/src/Listing/ActionBar/ColumnMultiSelect.tsx +7 -7
- package/src/Listing/ActionBar/Pagination.tsx +2 -3
- package/src/Listing/ActionBar/PaginationActions.tsx +7 -7
- package/src/Listing/ActionBar/index.tsx +22 -23
- package/src/Listing/Cell/DataCell.tsx +13 -16
- package/src/Listing/Cell/EllipsisTypography.tsx +1 -1
- package/src/Listing/Cell/index.tsx +17 -18
- package/src/Listing/Checkbox.tsx +1 -1
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +8 -9
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +6 -6
- package/src/Listing/Header/ListingHeader.tsx +30 -20
- package/src/Listing/Header/_internals/DraggableIconButton.tsx +2 -2
- package/src/Listing/Header/_internals/Label.tsx +3 -2
- package/src/Listing/Header/_internals/PredefinedSelectionList.tsx +1 -1
- package/src/Listing/Listing.cypress.spec.tsx +4 -5
- package/src/Listing/Row/EmptyRow.tsx +2 -2
- package/src/Listing/Row/Row.tsx +11 -11
- package/src/Listing/Row/SkeletonLoaderRows.tsx +0 -1
- package/src/Listing/index.stories.tsx +11 -13
- package/src/Listing/index.tsx +35 -36
- package/src/Listing/tableAtoms.ts +3 -3
- package/src/Listing/useResizeObserver.ts +2 -3
- package/src/Listing/useStyleTable.ts +7 -8
- package/src/ListingPage/Filter.tsx +3 -3
- package/src/ListingPage/FilterSkeleton.tsx +2 -2
- package/src/ListingPage/ListingSkeleton.tsx +2 -2
- package/src/ListingPage/index.stories.tsx +9 -12
- package/src/ListingPage/index.tsx +2 -4
- package/src/LoadingSkeleton/index.stories.tsx +3 -3
- package/src/LoadingSkeleton/index.tsx +1 -1
- package/src/Logo/CentreonLogo.stories.tsx +1 -1
- package/src/Logo/CentreonLogo.tsx +1 -3
- package/src/MenuSkeleton/index.stories.tsx +1 -1
- package/src/MenuSkeleton/index.tsx +2 -2
- package/src/Module/LicensedModule/LicenseCheck/decoder.ts +1 -1
- package/src/Module/LicensedModule/LicenseCheck/index.stories.tsx +3 -4
- package/src/Module/LicensedModule/LicenseCheck/index.tsx +1 -2
- package/src/Module/LicensedModule/index.tsx +2 -3
- package/src/Module/Module.cypress.spec.tsx +1 -3
- package/src/Module/index.tsx +4 -4
- package/src/MultiSelectEntries/index.stories.tsx +6 -6
- package/src/MultiSelectEntries/index.tsx +6 -8
- package/src/MultiSelectEntries/useHover.ts +4 -4
- package/src/PageSkeleton/BaseSkeleton.tsx +3 -4
- package/src/PageSkeleton/ContentSkeleton.tsx +3 -4
- package/src/PageSkeleton/index.stories.tsx +2 -2
- package/src/PageSkeleton/index.tsx +2 -3
- package/src/Pagination/Pagination.cypress.spec.tsx +14 -11
- package/src/Pagination/Pagination.stories.tsx +9 -8
- package/src/Pagination/Pagination.styles.ts +30 -30
- package/src/Pagination/Pagination.tsx +15 -14
- package/src/Panel/Memoized.tsx +1 -2
- package/src/Panel/Section/ExpandableSection.tsx +7 -7
- package/src/Panel/Section/index.stories.tsx +3 -3
- package/src/Panel/Section/index.test.tsx +50 -50
- package/src/Panel/Section/index.tsx +7 -8
- package/src/Panel/Tab.tsx +2 -2
- package/src/Panel/index.stories.tsx +2 -2
- package/src/Panel/index.tsx +29 -26
- package/src/ParentSize/ParentSize.tsx +1 -2
- package/src/PopoverMenu/index.tsx +8 -9
- package/src/Responsive/index.stories.tsx +2 -2
- package/src/Responsive/index.tsx +11 -5
- package/src/RichTextEditor/ContentEditable.tsx +15 -9
- package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +1 -1
- package/src/RichTextEditor/RichTextEditor.tsx +5 -5
- package/src/RichTextEditor/index.stories.tsx +4 -5
- package/src/RichTextEditor/index.ts +1 -1
- package/src/RichTextEditor/initialEditorState.json +3 -3
- package/src/RichTextEditor/plugins/AutoLinkPlugin/index.tsx +4 -5
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +13 -14
- package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +8 -10
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +4 -6
- package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +9 -11
- package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +7 -9
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +3 -5
- package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +3 -4
- package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +2 -2
- package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +6 -8
- package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +1 -0
- package/src/RichTextEditor/utils/getSelectedNode.ts +1 -1
- package/src/Snackbar/SnackbarProvider.tsx +5 -5
- package/src/Snackbar/Transition.tsx +6 -6
- package/src/Snackbar/index.stories.tsx +2 -3
- package/src/Snackbar/index.tsx +7 -8
- package/src/Snackbar/useSnackbar.tsx +3 -5
- package/src/SortableItems/Item.tsx +1 -1
- package/src/SortableItems/SortableItem.tsx +0 -1
- package/src/SortableItems/index.stories.tsx +14 -11
- package/src/SortableItems/index.tsx +38 -41
- package/src/StatusChip/index.stories.tsx +3 -3
- package/src/StatusChip/index.tsx +3 -4
- package/src/StoryBookThemeProvider/index.tsx +7 -7
- package/src/ThemeProvider/base.css +1 -1
- package/src/ThemeProvider/index.tsx +13 -14
- package/src/ThemeProvider/palettes.ts +10 -9
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.tsx +4 -5
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/ErrorText.tsx +1 -1
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +8 -8
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/index.tsx +7 -7
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +3 -4
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/usePickersStartEndDate.ts +5 -7
- package/src/TimePeriods/CustomTimePeriod/SimpleCustomTimePeriod.tsx +3 -3
- package/src/TimePeriods/CustomTimePeriod/index.tsx +2 -4
- package/src/TimePeriods/DateTimePickerInput.tsx +8 -9
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +8 -8
- package/src/TimePeriods/SelectedTimePeriod.tsx +9 -9
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +10 -8
- package/src/TimePeriods/TimePeriods.tsx +4 -3
- package/src/TimePeriods/helpers/index.ts +4 -4
- package/src/TimePeriods/index.stories.tsx +6 -7
- package/src/TimePeriods/index.tsx +3 -3
- package/src/TimePeriods/models.ts +1 -2
- package/src/TimePeriods/timePeriodsAtoms.ts +2 -2
- package/src/TimePeriods/useSortTimePeriods.ts +2 -2
- package/src/TimePeriods/useTimePeriod.ts +11 -7
- package/src/TopCounterElements/ResourceCounters.tsx +3 -4
- package/src/TopCounterElements/ResourceSubMenu.tsx +7 -7
- package/src/TopCounterElements/StatusCounter.tsx +5 -5
- package/src/TopCounterElements/TopCounterLayout.tsx +4 -5
- package/src/TopCounterElements/index.tsx +3 -3
- package/src/TopCounterElements/useCloseOnLegacyPage.tsx +3 -4
- package/src/Typography/EllipsisTypography.tsx +2 -2
- package/src/Typography/FluidTypography/index.stories.tsx +3 -3
- package/src/Typography/FluidTypography/index.tsx +1 -1
- package/src/Typography/Subtitle.tsx +6 -13
- package/src/Typography/Typography.stories.tsx +1 -1
- package/src/Typography/story.utils.tsx +4 -4
- package/src/WallpaperPage/index.stories.tsx +1 -2
- package/src/WallpaperPage/index.tsx +2 -3
- package/src/Wizard/ActionsBar.test.tsx +109 -109
- package/src/Wizard/ActionsBar.tsx +4 -4
- package/src/Wizard/StepIcon.tsx +3 -3
- package/src/Wizard/Stepper.tsx +5 -5
- package/src/Wizard/WizardContent.tsx +3 -5
- package/src/Wizard/index.stories.tsx +17 -19
- package/src/Wizard/index.test.tsx +116 -158
- package/src/Wizard/index.tsx +8 -10
- package/src/Wizard/models.ts +2 -2
- package/src/api/QueryProvider.tsx +1 -2
- package/src/api/TestQueryProvider.tsx +1 -2
- package/src/api/buildListingDecoder.ts +1 -1
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +1 -1
- package/src/api/buildListingEndpoint/index.ts +17 -4
- package/src/api/buildListingEndpoint/models.ts +2 -1
- package/src/api/customFetch.ts +1 -1
- package/src/api/index.ts +1 -1
- package/src/api/useBulkResponse.ts +1 -0
- package/src/api/useCancelTokenSource.ts +1 -2
- package/src/api/useFetchQuery/index.test.ts +9 -3
- package/src/api/useFetchQuery/index.ts +11 -8
- package/src/api/useGraphQuery/index.ts +9 -11
- package/src/api/useGraphQuery/models.ts +1 -1
- package/src/api/useMutationQuery/index.ts +12 -9
- package/src/api/useMutationQuery/useMutationQuery.cypress.spec.tsx +11 -11
- package/src/api/useMutationQuery/useOptimisticMutation.ts +2 -1
- package/src/api/useRequest/index.test.ts +11 -10
- package/src/api/useRequest/index.ts +5 -6
- package/src/base/tokens/source/base.json +68 -68
- package/src/base/tokens/themes/base.tokens.json +331 -331
- package/src/base/tokens/themes/ui-dark.tokens.json +331 -331
- package/src/base/tokens/themes/ui-light.tokens.json +331 -331
- package/src/components/Avatar/Avatar.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +2 -2
- package/src/components/Button/Button.stories.tsx +6 -5
- package/src/components/Button/Button.tsx +6 -6
- package/src/components/Button/Icon/IconButton.stories.tsx +2 -2
- package/src/components/Button/Icon/IconButton.tsx +6 -7
- package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +1 -1
- package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +2 -2
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +6 -7
- package/src/components/CopyCommand/CopyCommand.cypress.spec.tsx +24 -22
- package/src/components/CopyCommand/CopyCommand.stories.tsx +13 -12
- package/src/components/CopyCommand/CopyCommand.styles.tsx +47 -45
- package/src/components/CopyCommand/CopyCommand.tsx +8 -8
- package/src/components/CrudPage/Actions/Actions.styles.ts +16 -16
- package/src/components/CrudPage/Actions/Actions.tsx +2 -1
- package/src/components/CrudPage/Actions/AddButton.tsx +4 -2
- package/src/components/CrudPage/Actions/Filters.tsx +3 -1
- package/src/components/CrudPage/Actions/Search.tsx +4 -3
- package/src/components/CrudPage/Actions/useSearch.tsx +12 -8
- package/src/components/CrudPage/Columns/Actions.tsx +16 -11
- package/src/components/CrudPage/CrudPage.cypress.spec.tsx +100 -98
- package/src/components/CrudPage/CrudPage.stories.tsx +67 -65
- package/src/components/CrudPage/CrudPageRoot.tsx +21 -20
- package/src/components/CrudPage/DeleteModal.tsx +8 -6
- package/src/components/CrudPage/Form/AddModal.tsx +8 -9
- package/src/components/CrudPage/Form/Buttons.tsx +14 -11
- package/src/components/CrudPage/Form/UpdateModal.tsx +17 -18
- package/src/components/CrudPage/Listing.tsx +14 -13
- package/src/components/CrudPage/atoms.ts +2 -1
- package/src/components/CrudPage/hooks/useDeleteItem.ts +7 -5
- package/src/components/CrudPage/hooks/useGetItem.ts +3 -2
- package/src/components/CrudPage/hooks/useGetItems.ts +11 -10
- package/src/components/CrudPage/hooks/useListingQueryKey.ts +2 -1
- package/src/components/CrudPage/index.tsx +3 -3
- package/src/components/CrudPage/models.ts +10 -6
- package/src/components/DataTable/DataListing.tsx +2 -2
- package/src/components/DataTable/DataTable.cypress.spec.tsx +3 -4
- package/src/components/DataTable/DataTable.stories.tsx +5 -6
- package/src/components/DataTable/DataTable.styles.ts +5 -5
- package/src/components/DataTable/DataTable.tsx +1 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +1 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +1 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -6
- package/src/components/DataTable/Item/DataTableItem.stories.tsx +1 -1
- package/src/components/DataTable/Item/DataTableItem.tsx +7 -2
- package/src/components/DataTable/Item/DataTableItemSkeleton.tsx +1 -2
- package/src/components/ExpandableContainer/ExpandableContainer.tsx +14 -12
- package/src/components/ExpandableContainer/models.ts +3 -2
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +2 -3
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +2 -3
- package/src/components/Form/AccessRights/AccessRights.tsx +2 -3
- package/src/components/Form/AccessRights/Actions/Actions.tsx +5 -6
- package/src/components/Form/AccessRights/Actions/useActions.ts +1 -1
- package/src/components/Form/AccessRights/List/Item.tsx +5 -6
- package/src/components/Form/AccessRights/List/List.tsx +4 -5
- package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +1 -2
- package/src/components/Form/AccessRights/List/ListSkeleton.tsx +1 -2
- package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +3 -3
- package/src/components/Form/AccessRights/List/StateChip.tsx +1 -2
- package/src/components/Form/AccessRights/List/useItem.ts +2 -2
- package/src/components/Form/AccessRights/Provider.tsx +2 -3
- package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +5 -6
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +14 -12
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +14 -11
- package/src/components/Form/AccessRights/Stats/Stats.tsx +3 -3
- package/src/components/Form/AccessRights/atoms.ts +5 -1
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +4 -5
- package/src/components/Form/AccessRights/storiesData.ts +3 -4
- package/src/components/Form/AccessRights/useAccessRightsChange.ts +2 -4
- package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +2 -3
- package/src/components/Form/AccessRights/utils.ts +1 -1
- package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +7 -9
- package/src/components/Form/Dashboard/DashboardForm.tsx +7 -9
- package/src/components/Form/Dashboard/GlobalRefreshFieldOption.tsx +7 -9
- package/src/components/Form/Dashboard/index.ts +1 -1
- package/src/components/Form/FormActions.tsx +4 -6
- package/src/components/Form/index.ts +6 -4
- package/src/components/Header/PageHeader/PageHeader.stories.tsx +2 -3
- package/src/components/Header/PageHeader/PageHeader.styles.ts +11 -11
- 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/PageHeaderMessage.tsx +2 -2
- package/src/components/Header/PageHeader/PageHeaderTitle.tsx +2 -3
- package/src/components/Inputs/Switch/Switch.stories.tsx +1 -1
- package/src/components/Inputs/Switch/Switch.tsx +1 -1
- package/src/components/ItemComposition/Item.tsx +3 -4
- package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +1 -2
- package/src/components/ItemComposition/ItemComposition.stories.tsx +4 -4
- package/src/components/ItemComposition/ItemComposition.styles.ts +7 -7
- package/src/components/ItemComposition/ItemComposition.tsx +5 -7
- package/src/components/Layout/AreaIndicator.tsx +2 -2
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -2
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +5 -5
- package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +3 -2
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +1 -1
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +6 -6
- package/src/components/Layout/PageLayout.cypress.spec.tsx +1 -3
- package/src/components/List/Item/Avatar.tsx +2 -2
- package/src/components/List/Item/AvatarSkeleton.tsx +2 -2
- package/src/components/List/Item/ListItem.stories.tsx +1 -1
- package/src/components/List/Item/ListItem.tsx +8 -3
- package/src/components/List/Item/Text.tsx +2 -2
- package/src/components/List/Item/TextSkeleton.tsx +2 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/Menu/Button/MenuButton.stories.tsx +1 -1
- package/src/components/Menu/Button/MenuButton.tsx +7 -7
- package/src/components/Menu/Menu.stories.tsx +2 -3
- package/src/components/Menu/Menu.tsx +1 -1
- package/src/components/Menu/MenuDivider.tsx +2 -2
- package/src/components/Menu/MenuItem.tsx +3 -3
- package/src/components/Menu/MenuItems.tsx +5 -5
- package/src/components/Menu/useMenu.tsx +2 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +6 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +2 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +3 -4
- package/src/components/Modal/Modal.stories.tsx +2 -2
- package/src/components/Modal/Modal.styles.ts +2 -2
- package/src/components/Modal/Modal.tsx +10 -11
- package/src/components/Modal/ModalActions.tsx +4 -4
- package/src/components/Modal/ModalBody.tsx +1 -1
- package/src/components/Modal/ModalHeader.tsx +5 -2
- package/src/components/Tabs/Tabs.cypress.spec.tsx +1 -2
- package/src/components/Tabs/Tabs.stories.tsx +2 -3
- package/src/components/Tabs/Tabs.tsx +7 -7
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +2 -3
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.styles.tsx +2 -2
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +3 -3
- package/src/components/Tooltip/ConfirmationTooltip/TooltipContent.tsx +1 -2
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +2 -2
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +4 -4
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +6 -7
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +5 -5
- package/src/components/Tooltip/index.ts +1 -1
- package/src/components/Zoom/Minimap.tsx +10 -10
- package/src/components/Zoom/Zoom.stories.tsx +6 -6
- package/src/components/Zoom/Zoom.styles.tsx +2 -2
- package/src/components/Zoom/Zoom.tsx +4 -5
- package/src/components/Zoom/ZoomContent.tsx +17 -19
- package/src/components/Zoom/localPoint.ts +1 -2
- package/src/components/Zoom/models.ts +1 -1
- package/src/components/Zoom/useMinimap.ts +13 -15
- package/src/components/Zoom/useZoom.ts +3 -4
- package/src/components/Zoom/utils.ts +1 -1
- package/src/components/index.ts +11 -11
- package/src/index.ts +115 -142
- package/src/queryParameters/index.ts +1 -1
- package/src/queryParameters/url/index.ts +1 -1
- package/src/styles/tokens/themes/_ui-dark.tokens.json +331 -331
- package/src/styles/tokens/themes/_ui-light.tokens.json +331 -331
- package/src/utils/index.ts +18 -18
- package/src/utils/resourcesStatusURL.ts +3 -4
- package/src/utils/useDebounce.ts +11 -8
- package/src/utils/useDeepCallback.ts +2 -1
- package/src/utils/useDeepMemo.ts +1 -1
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +3 -3
- package/src/utils/useFullscreen/useFullscreen.ts +3 -3
- package/src/utils/useFullscreen/useFullscreenListener.ts +31 -30
- package/src/utils/useInfiniteScrollListing.ts +9 -10
- package/src/utils/useIntersectionObserver.ts +1 -1
- package/src/utils/useKeyObserver.tsx +14 -11
- package/src/utils/useLicenseExpirationWarning.test.tsx +122 -124
- package/src/utils/useLicenseExpirationWarning.ts +3 -5
- package/src/utils/useLoadImage.tsx +2 -3
- package/src/utils/useLocale/index.ts +1 -0
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +4 -2
- package/src/utils/useLocaleDateTimeFormat/index.test.tsx +71 -71
- package/src/utils/useLocaleDateTimeFormat/index.ts +2 -2
- package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +42 -42
- package/src/utils/useLocaleTimezoneDate/LocaleTimezoneDate.cypress.spec.tsx +2 -1
- package/src/utils/useLocaleTimezoneDate/useLocaleTimezoneDate.ts +3 -4
- package/src/utils/useMemoComponent.ts +2 -3
- package/src/utils/usePluralizedTranslation.test.ts +2 -2
- package/src/utils/usePluralizedTranslation.ts +2 -3
- package/src/utils/useRefreshInterval.ts +2 -2
- package/src/utils/useThemeMode.ts +2 -2
- package/src/utils/useViewportIntersection.ts +8 -2
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +0 -64
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { FormControlLabel, Switch, Typography } from '@mui/material';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
4
|
import { atom, useAtom, useSetAtom } from 'jotai';
|
|
4
|
-
import {
|
|
5
|
+
import { HttpResponse, http } from 'msw';
|
|
5
6
|
import { identity, isNil, prop } from 'ramda';
|
|
6
|
-
import { ChangeEvent, useEffect } from 'react';
|
|
7
|
-
|
|
7
|
+
import { type ChangeEvent, useEffect } from 'react';
|
|
8
|
+
|
|
8
9
|
import { SnackbarProvider } from '../../';
|
|
9
|
-
import { Column, ColumnType } from '../../Listing/models';
|
|
10
|
+
import { type Column, ColumnType } from '../../Listing/models';
|
|
11
|
+
import { CrudPage } from '.';
|
|
10
12
|
import '../../ThemeProvider/tailwindcss.css';
|
|
11
13
|
|
|
12
14
|
interface Item {
|
|
@@ -25,19 +27,19 @@ const generateItems = (count: number) =>
|
|
|
25
27
|
Array(count)
|
|
26
28
|
.fill(0)
|
|
27
29
|
.map((_, idx) => ({
|
|
30
|
+
description: `Description ${idx}`,
|
|
28
31
|
id: idx,
|
|
29
32
|
name: `Item ${idx}`,
|
|
30
|
-
description: `Description ${idx}`,
|
|
31
33
|
subItems: [{ id: 1, name: 'SubItem' }]
|
|
32
34
|
}));
|
|
33
35
|
|
|
34
36
|
const mockedListing = {
|
|
35
|
-
result: generateItems(30),
|
|
36
37
|
meta: {
|
|
38
|
+
limit: 30,
|
|
37
39
|
page: 1,
|
|
38
|
-
total: 60
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
total: 60
|
|
41
|
+
},
|
|
42
|
+
result: generateItems(30)
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
const filtersAtom = atom<Filters>({
|
|
@@ -63,32 +65,32 @@ const getSearchParameters = ({ filters }) => ({
|
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
const labels = {
|
|
66
|
-
title: 'Items',
|
|
67
|
-
welcome: {
|
|
68
|
-
title: 'Welcome to the items page',
|
|
69
|
-
description: 'This page handles item'
|
|
70
|
-
},
|
|
71
68
|
actions: {
|
|
72
69
|
create: 'Create item'
|
|
73
70
|
},
|
|
74
71
|
listing: {
|
|
75
72
|
search: 'Search'
|
|
73
|
+
},
|
|
74
|
+
title: 'Items',
|
|
75
|
+
welcome: {
|
|
76
|
+
description: 'This page handles item',
|
|
77
|
+
title: 'Welcome to the items page'
|
|
76
78
|
}
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
const columns: Array<Column> = [
|
|
80
82
|
{
|
|
81
|
-
|
|
83
|
+
displaySubItemsCaret: true,
|
|
84
|
+
getFormattedString: prop('name'),
|
|
82
85
|
id: 'name',
|
|
83
86
|
label: 'Name',
|
|
84
|
-
|
|
85
|
-
displaySubItemsCaret: true
|
|
87
|
+
type: ColumnType.string
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
|
-
|
|
90
|
+
getFormattedString: prop('description'),
|
|
89
91
|
id: 'description',
|
|
90
92
|
label: 'Description',
|
|
91
|
-
|
|
93
|
+
type: ColumnType.string
|
|
92
94
|
}
|
|
93
95
|
];
|
|
94
96
|
|
|
@@ -126,17 +128,35 @@ const Filters = () => {
|
|
|
126
128
|
|
|
127
129
|
const args = {
|
|
128
130
|
baseEndpoint: '/listing',
|
|
129
|
-
filtersAtom,
|
|
130
|
-
getSearchParameters,
|
|
131
|
-
labels,
|
|
132
131
|
columns,
|
|
132
|
+
deleteItem: {
|
|
133
|
+
deleteEndpoint: (item) =>
|
|
134
|
+
!isNil(item?.parent)
|
|
135
|
+
? `/delete/${item?.parent?.id}/subItems/${item?.id}`
|
|
136
|
+
: `/delete/${item?.id}`,
|
|
137
|
+
labels: {
|
|
138
|
+
cancel: 'Cancel',
|
|
139
|
+
confirm: 'Delete',
|
|
140
|
+
description: (item) =>
|
|
141
|
+
!isNil(item?.parent) ? (
|
|
142
|
+
<Typography>
|
|
143
|
+
The sub item <strong>{item?.name}</strong> from the item{' '}
|
|
144
|
+
<strong>{item?.parent?.name}</strong> will be deleted
|
|
145
|
+
</Typography>
|
|
146
|
+
) : (
|
|
147
|
+
<Typography>
|
|
148
|
+
The item <strong>{item?.name}</strong> will be deleted
|
|
149
|
+
</Typography>
|
|
150
|
+
),
|
|
151
|
+
successMessage: (item) =>
|
|
152
|
+
!isNil(item?.parent) ? 'Sub item deleted' : 'Item deleted',
|
|
153
|
+
title: (item) =>
|
|
154
|
+
!isNil(item?.parent) ? 'Delete sub item' : 'Delete item'
|
|
155
|
+
}
|
|
156
|
+
},
|
|
133
157
|
filters: <Filters />,
|
|
158
|
+
filtersAtom,
|
|
134
159
|
form: {
|
|
135
|
-
getItem: {
|
|
136
|
-
baseEndpoint: (id) => `/item/${id}`,
|
|
137
|
-
adapter: identity,
|
|
138
|
-
itemQueryKey: 'item'
|
|
139
|
-
},
|
|
140
160
|
Form: ({ initialValues }) => {
|
|
141
161
|
const [askBeforeCloseForm, setAskBeforeCloseFormModal] = useAtom(
|
|
142
162
|
CrudPage.askBeforeCloseFormModalAtom
|
|
@@ -150,7 +170,7 @@ const args = {
|
|
|
150
170
|
|
|
151
171
|
setOpenFormModal(null);
|
|
152
172
|
setAskBeforeCloseFormModal(false);
|
|
153
|
-
}, [askBeforeCloseForm]);
|
|
173
|
+
}, [askBeforeCloseForm, setAskBeforeCloseFormModal, setOpenFormModal]);
|
|
154
174
|
|
|
155
175
|
return (
|
|
156
176
|
<Typography>
|
|
@@ -160,44 +180,26 @@ const args = {
|
|
|
160
180
|
</Typography>
|
|
161
181
|
);
|
|
162
182
|
},
|
|
183
|
+
getItem: {
|
|
184
|
+
adapter: identity,
|
|
185
|
+
baseEndpoint: (id) => `/item/${id}`,
|
|
186
|
+
itemQueryKey: 'item'
|
|
187
|
+
},
|
|
163
188
|
labels: {
|
|
164
189
|
add: {
|
|
165
|
-
title: 'Add item',
|
|
166
190
|
cancel: 'Cancel',
|
|
167
|
-
confirm: 'Add'
|
|
191
|
+
confirm: 'Add',
|
|
192
|
+
title: 'Add item'
|
|
168
193
|
},
|
|
169
194
|
update: {
|
|
170
|
-
title: 'Update item',
|
|
171
195
|
cancel: 'Cancel',
|
|
172
|
-
confirm: 'Update'
|
|
196
|
+
confirm: 'Update',
|
|
197
|
+
title: 'Update item'
|
|
173
198
|
}
|
|
174
199
|
}
|
|
175
200
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
!isNil(item?.parent)
|
|
179
|
-
? `/delete/${item?.parent?.id}/subItems/${item?.id}`
|
|
180
|
-
: `/delete/${item?.id}`,
|
|
181
|
-
labels: {
|
|
182
|
-
successMessage: (item) =>
|
|
183
|
-
!isNil(item?.parent) ? 'Sub item deleted' : 'Item deleted',
|
|
184
|
-
confirm: 'Delete',
|
|
185
|
-
cancel: 'Cancel',
|
|
186
|
-
title: (item) =>
|
|
187
|
-
!isNil(item?.parent) ? 'Delete sub item' : 'Delete item',
|
|
188
|
-
description: (item) =>
|
|
189
|
-
!isNil(item?.parent) ? (
|
|
190
|
-
<Typography>
|
|
191
|
-
The sub item <strong>{item?.name}</strong> from the item{' '}
|
|
192
|
-
<strong>{item?.parent?.name}</strong> will be deleted
|
|
193
|
-
</Typography>
|
|
194
|
-
) : (
|
|
195
|
-
<Typography>
|
|
196
|
-
The item <strong>{item?.name}</strong> will be deleted
|
|
197
|
-
</Typography>
|
|
198
|
-
)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
+
getSearchParameters,
|
|
202
|
+
labels
|
|
201
203
|
};
|
|
202
204
|
|
|
203
205
|
const meta: Meta<typeof CrudPage<Item, Filters, Item, Item>> = {
|
|
@@ -211,9 +213,9 @@ const meta: Meta<typeof CrudPage<Item, Filters, Item, Item>> = {
|
|
|
211
213
|
}),
|
|
212
214
|
http.get('**/item**', () => {
|
|
213
215
|
return HttpResponse.json({
|
|
216
|
+
description: 'Description 0',
|
|
214
217
|
id: 0,
|
|
215
218
|
name: 'Item 0',
|
|
216
|
-
description: 'Description 0',
|
|
217
219
|
subItems: [{ id: 1, name: 'SubItem' }]
|
|
218
220
|
});
|
|
219
221
|
}),
|
|
@@ -246,12 +248,12 @@ export const Default: Story = {
|
|
|
246
248
|
handlers: [
|
|
247
249
|
http.get('**/listing**', () => {
|
|
248
250
|
return HttpResponse.json({
|
|
249
|
-
result: [],
|
|
250
251
|
meta: {
|
|
252
|
+
limit: 30,
|
|
251
253
|
page: 1,
|
|
252
|
-
total: 60
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
total: 60
|
|
255
|
+
},
|
|
256
|
+
result: []
|
|
255
257
|
});
|
|
256
258
|
})
|
|
257
259
|
]
|
|
@@ -272,8 +274,8 @@ export const WithSubItem: Story = {
|
|
|
272
274
|
canCheckSubItems: false,
|
|
273
275
|
enable: true,
|
|
274
276
|
getRowProperty: () => 'subItems',
|
|
275
|
-
|
|
276
|
-
|
|
277
|
+
labelCollapse: 'Collapse',
|
|
278
|
+
labelExpand: 'Expand'
|
|
277
279
|
}
|
|
278
280
|
}
|
|
279
281
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { useSetAtom } from 'jotai';
|
|
2
2
|
import { equals } from 'ramda';
|
|
3
3
|
import { useCallback, useRef } from 'react';
|
|
4
|
+
|
|
4
5
|
import PageSkeleton from '../../PageSkeleton';
|
|
5
6
|
import { DataTable } from '../DataTable';
|
|
6
7
|
import { PageHeader } from '../Header';
|
|
7
8
|
import { PageLayout } from '../Layout';
|
|
8
|
-
import DeleteModal from './DeleteModal';
|
|
9
|
-
import AddModal from './Form/AddModal';
|
|
10
|
-
import UpdateModal from './Form/UpdateModal';
|
|
11
|
-
import Listing from './Listing';
|
|
12
9
|
import {
|
|
13
10
|
canDeleteSubItemsAtom,
|
|
14
11
|
formLabelButtonsAtom,
|
|
15
12
|
openFormModalAtom
|
|
16
13
|
} from './atoms';
|
|
14
|
+
import DeleteModal from './DeleteModal';
|
|
15
|
+
import AddModal from './Form/AddModal';
|
|
16
|
+
import UpdateModal from './Form/UpdateModal';
|
|
17
17
|
import { useGetItems } from './hooks/useGetItems';
|
|
18
|
+
import Listing from './Listing';
|
|
18
19
|
import type { CrudPageRootProps } from './models';
|
|
19
20
|
|
|
20
21
|
export const CrudPageRoot = <
|
|
@@ -41,11 +42,11 @@ export const CrudPageRoot = <
|
|
|
41
42
|
TData,
|
|
42
43
|
TFilters
|
|
43
44
|
>({
|
|
44
|
-
|
|
45
|
-
filtersAtom,
|
|
45
|
+
baseEndpoint,
|
|
46
46
|
decoder,
|
|
47
|
+
filtersAtom,
|
|
47
48
|
getSearchParameters,
|
|
48
|
-
|
|
49
|
+
queryKeyName
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
const setOpenFormModal = useSetAtom(openFormModalAtom);
|
|
@@ -73,7 +74,7 @@ export const CrudPageRoot = <
|
|
|
73
74
|
previousFormLabelButtonsRef.current = form.labels;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
const add = useCallback(() => setOpenFormModal('add'), []);
|
|
77
|
+
const add = useCallback(() => setOpenFormModal('add'), [setOpenFormModal]);
|
|
77
78
|
|
|
78
79
|
if (isLoading && !hasItems) {
|
|
79
80
|
return <PageSkeleton displayHeaderAndNavigation={false} />;
|
|
@@ -89,7 +90,7 @@ export const CrudPageRoot = <
|
|
|
89
90
|
</PageHeader>
|
|
90
91
|
</PageLayout.Header>
|
|
91
92
|
<PageLayout.Body>
|
|
92
|
-
|
|
93
|
+
<div className="h-full w-full">
|
|
93
94
|
<DataTable
|
|
94
95
|
isEmpty={isDataEmpty}
|
|
95
96
|
variant={isDataEmpty ? 'grid' : 'listing'}
|
|
@@ -99,45 +100,45 @@ export const CrudPageRoot = <
|
|
|
99
100
|
aria-label="create"
|
|
100
101
|
buttonCreateTestId="create-crudpage"
|
|
101
102
|
labels={{
|
|
102
|
-
|
|
103
|
+
actions: labels?.actions,
|
|
103
104
|
description: labels.welcome.description,
|
|
104
|
-
|
|
105
|
+
title: labels.welcome.title
|
|
105
106
|
}}
|
|
106
107
|
onCreate={add}
|
|
107
108
|
/>
|
|
108
109
|
) : (
|
|
109
110
|
<Listing
|
|
110
|
-
total={total}
|
|
111
|
-
isLoading={isLoading}
|
|
112
|
-
rows={items}
|
|
113
111
|
columns={columns}
|
|
114
|
-
|
|
112
|
+
filters={filters}
|
|
113
|
+
isLoading={isLoading}
|
|
115
114
|
labels={{
|
|
116
115
|
add: labels.actions.create,
|
|
117
116
|
search: labels.listing.search
|
|
118
117
|
}}
|
|
119
|
-
|
|
118
|
+
rows={items}
|
|
119
|
+
subItems={subItems}
|
|
120
|
+
total={total}
|
|
120
121
|
/>
|
|
121
122
|
)}
|
|
122
123
|
</DataTable>
|
|
123
124
|
<DeleteModal<TData>
|
|
124
|
-
listingQueryKey={queryKeyName}
|
|
125
125
|
deleteEndpoint={deleteItem.deleteEndpoint}
|
|
126
126
|
labels={deleteItem.labels}
|
|
127
|
+
listingQueryKey={queryKeyName}
|
|
127
128
|
modalSize={deleteItem.modalSize}
|
|
128
129
|
/>
|
|
129
130
|
<AddModal
|
|
130
|
-
title={form.labels.add.title}
|
|
131
131
|
Form={form.Form}
|
|
132
132
|
modalSize={form.modalSize}
|
|
133
|
+
title={form.labels.add.title}
|
|
133
134
|
/>
|
|
134
135
|
<UpdateModal<TItem, TItemForm>
|
|
135
|
-
title={form.labels.update.title}
|
|
136
136
|
Form={form.Form}
|
|
137
137
|
modalSize={form.modalSize}
|
|
138
|
+
title={form.labels.update.title}
|
|
138
139
|
{...form.getItem}
|
|
139
140
|
/>
|
|
140
|
-
|
|
141
|
+
</div>
|
|
141
142
|
</PageLayout.Body>
|
|
142
143
|
</PageLayout>
|
|
143
144
|
);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Box, CircularProgress, Typography } from '@mui/material';
|
|
2
|
+
|
|
2
3
|
import { useAtom } from 'jotai';
|
|
3
4
|
import { useCallback, useRef } from 'react';
|
|
5
|
+
|
|
4
6
|
import { Button } from '../Button';
|
|
5
7
|
import { Modal } from '../Modal';
|
|
6
8
|
import { itemToDeleteAtom } from './atoms';
|
|
7
9
|
import { useDeleteItem } from './hooks/useDeleteItem';
|
|
8
|
-
import { DeleteItem, ItemToDelete } from './models';
|
|
10
|
+
import type { DeleteItem, ItemToDelete } from './models';
|
|
9
11
|
import { isAFunction } from './utils';
|
|
10
12
|
|
|
11
13
|
const DeleteModal = <TData extends { id: number; name: string }>({
|
|
@@ -30,18 +32,18 @@ const DeleteModal = <TData extends { id: number; name: string }>({
|
|
|
30
32
|
|
|
31
33
|
const close = useCallback(() => {
|
|
32
34
|
setItemToDelete(null);
|
|
33
|
-
}, []);
|
|
35
|
+
}, [setItemToDelete]);
|
|
34
36
|
|
|
35
37
|
const confirm = useCallback(() => {
|
|
36
38
|
deleteItem(itemToDeleteRef.current).then(close);
|
|
37
|
-
}, [
|
|
39
|
+
}, [close, deleteItem]);
|
|
38
40
|
|
|
39
41
|
if (isOpen) {
|
|
40
42
|
itemToDeleteRef.current = itemToDelete;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
|
-
<Modal
|
|
46
|
+
<Modal onClose={close} open={isOpen} size={modalSize}>
|
|
45
47
|
<Modal.Header>
|
|
46
48
|
{isAFunction(labels.title)
|
|
47
49
|
? labels.title(itemToDeleteRef.current as TData)
|
|
@@ -63,10 +65,10 @@ const DeleteModal = <TData extends { id: number; name: string }>({
|
|
|
63
65
|
}}
|
|
64
66
|
>
|
|
65
67
|
{isMutating && <CircularProgress size={20} />}
|
|
66
|
-
<Button
|
|
68
|
+
<Button disabled={isMutating} onClick={close} variant="ghost">
|
|
67
69
|
{labels.cancel}
|
|
68
70
|
</Button>
|
|
69
|
-
<Button isDanger onClick={confirm}
|
|
71
|
+
<Button disabled={isMutating} isDanger onClick={confirm}>
|
|
70
72
|
{labels.confirm}
|
|
71
73
|
</Button>
|
|
72
74
|
</Box>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAtomValue, useSetAtom } from 'jotai';
|
|
2
2
|
import { equals, isNotNil } from 'ramda';
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
|
+
|
|
4
5
|
import { Modal } from '../../Modal';
|
|
5
6
|
import { askBeforeCloseFormModalAtom, openFormModalAtom } from '../atoms';
|
|
6
7
|
import Buttons from './Buttons';
|
|
@@ -17,18 +18,16 @@ const AddModal = ({ title, Form, modalSize = 'medium' }): JSX.Element => {
|
|
|
17
18
|
|
|
18
19
|
const openAskBeforeClose = useCallback(
|
|
19
20
|
() => setAskBeforeCloseFormModal(true),
|
|
20
|
-
[]
|
|
21
|
+
[setAskBeforeCloseFormModal]
|
|
21
22
|
);
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
|
-
|
|
25
|
-
<Modal
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</Modal>
|
|
31
|
-
</>
|
|
25
|
+
<Modal onClose={openAskBeforeClose} open={isModalOpen} size={modalSize}>
|
|
26
|
+
<Modal.Header>{title}</Modal.Header>
|
|
27
|
+
<Modal.Body>
|
|
28
|
+
<Form Buttons={Buttons} />
|
|
29
|
+
</Modal.Body>
|
|
30
|
+
</Modal>
|
|
32
31
|
);
|
|
33
32
|
};
|
|
34
33
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { UnsavedChangesDialog } from '@centreon/ui';
|
|
2
1
|
import SaveIcon from '@mui/icons-material/Save';
|
|
3
2
|
import { Box, CircularProgress } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
import { UnsavedChangesDialog } from '@centreon/ui';
|
|
5
|
+
|
|
4
6
|
import { useFormikContext } from 'formik';
|
|
5
7
|
import { useAtom, useAtomValue } from 'jotai';
|
|
6
8
|
import { equals } from 'ramda';
|
|
7
9
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
10
|
+
|
|
8
11
|
import { Button } from '../../Button';
|
|
9
12
|
import {
|
|
10
13
|
askBeforeCloseFormModalAtom,
|
|
@@ -39,7 +42,7 @@ const Buttons = (): JSX.Element => {
|
|
|
39
42
|
const discard = useCallback(() => {
|
|
40
43
|
setAskBeforeCloseFormModal(false);
|
|
41
44
|
setOpenFormModal(null);
|
|
42
|
-
}, []);
|
|
45
|
+
}, [setAskBeforeCloseFormModal, setOpenFormModal]);
|
|
43
46
|
|
|
44
47
|
const close = useCallback(() => {
|
|
45
48
|
if (dirty) {
|
|
@@ -48,16 +51,16 @@ const Buttons = (): JSX.Element => {
|
|
|
48
51
|
}
|
|
49
52
|
setOpenFormModal(null);
|
|
50
53
|
setAskBeforeCloseFormModal(false);
|
|
51
|
-
}, [dirty]);
|
|
54
|
+
}, [dirty, setAskBeforeCloseFormModal, setOpenFormModal]);
|
|
52
55
|
|
|
53
56
|
const submitAndClose = useCallback(() => {
|
|
54
57
|
submitForm();
|
|
55
58
|
setAskBeforeCloseFormModal(false);
|
|
56
|
-
}, []);
|
|
59
|
+
}, [setAskBeforeCloseFormModal, submitForm]);
|
|
57
60
|
|
|
58
61
|
const closeAskBeforeCloseModal = useCallback(() => {
|
|
59
62
|
setAskBeforeCloseFormModal(false);
|
|
60
|
-
}, []);
|
|
63
|
+
}, [setAskBeforeCloseFormModal]);
|
|
61
64
|
|
|
62
65
|
useEffect(() => {
|
|
63
66
|
if (!askBeforeCloseForm || dirty) {
|
|
@@ -65,31 +68,31 @@ const Buttons = (): JSX.Element => {
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
close();
|
|
68
|
-
}, [askBeforeCloseForm, dirty]);
|
|
71
|
+
}, [askBeforeCloseForm, dirty, close]);
|
|
69
72
|
|
|
70
73
|
return (
|
|
71
74
|
<>
|
|
72
75
|
<Box sx={{ display: 'flex', gap: 2, justifyContent: 'flex-end' }}>
|
|
73
76
|
{isSubmitting && <CircularProgress size={24} />}
|
|
74
|
-
<Button variant="ghost"
|
|
77
|
+
<Button onClick={close} variant="ghost">
|
|
75
78
|
{cancelLabel}
|
|
76
79
|
</Button>
|
|
77
80
|
<Button
|
|
78
81
|
disabled={isSubmitDisabled}
|
|
79
|
-
iconVariant="start"
|
|
80
82
|
icon={<SaveIcon />}
|
|
83
|
+
iconVariant="start"
|
|
81
84
|
onClick={submitForm}
|
|
82
85
|
>
|
|
83
86
|
{confirmLabel}
|
|
84
87
|
</Button>
|
|
85
88
|
</Box>
|
|
86
89
|
<UnsavedChangesDialog
|
|
90
|
+
closeDialog={closeAskBeforeCloseModal}
|
|
91
|
+
dialogOpened={askBeforeCloseForm && dirty}
|
|
92
|
+
discardChanges={discard}
|
|
87
93
|
isSubmitting={isSubmitting}
|
|
88
94
|
isValidForm={isValid}
|
|
89
95
|
saveChanges={submitAndClose}
|
|
90
|
-
closeDialog={closeAskBeforeCloseModal}
|
|
91
|
-
discardChanges={discard}
|
|
92
|
-
dialogOpened={askBeforeCloseForm && dirty}
|
|
93
96
|
/>
|
|
94
97
|
</>
|
|
95
98
|
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useAtomValue, useSetAtom } from 'jotai';
|
|
2
2
|
import { equals, isNotNil } from 'ramda';
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
|
+
|
|
4
5
|
import { Modal } from '../..';
|
|
5
6
|
import { askBeforeCloseFormModalAtom, openFormModalAtom } from '../atoms';
|
|
6
7
|
import { useGetItem } from '../hooks/useGetItem';
|
|
7
|
-
import { Form as FormModel, GetItem } from '../models';
|
|
8
|
+
import type { Form as FormModel, GetItem } from '../models';
|
|
8
9
|
import Buttons from './Buttons';
|
|
9
10
|
|
|
10
11
|
const UpdateModal = <TItem extends { id: number; name: string }, TItemForm>({
|
|
@@ -24,11 +25,11 @@ const UpdateModal = <TItem extends { id: number; name: string }, TItemForm>({
|
|
|
24
25
|
const openFormModal = useAtomValue(openFormModalAtom);
|
|
25
26
|
|
|
26
27
|
const { initialValues, isLoading } = useGetItem({
|
|
27
|
-
|
|
28
|
-
decoder,
|
|
28
|
+
adapter,
|
|
29
29
|
baseEndpoint,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
decoder,
|
|
31
|
+
id: openFormModal,
|
|
32
|
+
itemQueryKey
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
const isModalOpen = useMemo(
|
|
@@ -38,22 +39,20 @@ const UpdateModal = <TItem extends { id: number; name: string }, TItemForm>({
|
|
|
38
39
|
|
|
39
40
|
const openAskBeforeClose = useCallback(
|
|
40
41
|
() => setAskBeforeCloseFormModal(true),
|
|
41
|
-
[]
|
|
42
|
+
[setAskBeforeCloseFormModal]
|
|
42
43
|
);
|
|
43
44
|
|
|
44
45
|
return (
|
|
45
|
-
|
|
46
|
-
<Modal
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</Modal>
|
|
56
|
-
</>
|
|
46
|
+
<Modal onClose={openAskBeforeClose} open={isModalOpen} size={modalSize}>
|
|
47
|
+
<Modal.Header>{title}</Modal.Header>
|
|
48
|
+
<Modal.Body>
|
|
49
|
+
<Form
|
|
50
|
+
Buttons={Buttons}
|
|
51
|
+
initialValues={initialValues}
|
|
52
|
+
isLoading={isLoading}
|
|
53
|
+
/>
|
|
54
|
+
</Modal.Body>
|
|
55
|
+
</Modal>
|
|
57
56
|
);
|
|
58
57
|
};
|
|
59
58
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
|
|
2
|
+
|
|
2
3
|
import { ColumnType } from '../../../';
|
|
3
4
|
import { MemoizedListing } from '../../Listing';
|
|
4
5
|
import Actions from './Actions/Actions';
|
|
5
|
-
import ColumnActions from './Columns/Actions';
|
|
6
6
|
import {
|
|
7
7
|
changeSortAtom,
|
|
8
8
|
limitAtom,
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
sortFieldAtom,
|
|
11
11
|
sortOrderAtom
|
|
12
12
|
} from './atoms';
|
|
13
|
-
import
|
|
13
|
+
import ColumnActions from './Columns/Actions';
|
|
14
|
+
import type { ListingProps } from './models';
|
|
14
15
|
|
|
15
16
|
const Listing = <TData extends { id: number; name: string }>({
|
|
16
17
|
rows,
|
|
@@ -33,29 +34,29 @@ const Listing = <TData extends { id: number; name: string }>({
|
|
|
33
34
|
const changeSort = useSetAtom(changeSortAtom);
|
|
34
35
|
|
|
35
36
|
const listingColumns = columns.concat({
|
|
36
|
-
|
|
37
|
+
Component: ColumnActions,
|
|
38
|
+
clickable: true,
|
|
37
39
|
id: 'actions',
|
|
38
40
|
label: '',
|
|
39
|
-
|
|
40
|
-
width: 'min-content'
|
|
41
|
-
clickable: true
|
|
41
|
+
type: ColumnType.component,
|
|
42
|
+
width: 'min-content'
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
return (
|
|
45
46
|
<MemoizedListing
|
|
46
|
-
actions={<Actions
|
|
47
|
+
actions={<Actions filters={filters} labels={labels} />}
|
|
47
48
|
columns={listingColumns}
|
|
48
|
-
subItems={subItems}
|
|
49
|
-
loading={isLoading}
|
|
50
|
-
rows={rows}
|
|
51
49
|
currentPage={page}
|
|
52
|
-
onPaginate={setPage}
|
|
53
50
|
limit={limit}
|
|
51
|
+
loading={isLoading}
|
|
54
52
|
onLimitChange={setLimit}
|
|
55
|
-
|
|
53
|
+
onPaginate={setPage}
|
|
54
|
+
onSort={changeSort}
|
|
55
|
+
rows={rows}
|
|
56
56
|
sortField={sortField}
|
|
57
57
|
sortOrder={sortOrder}
|
|
58
|
-
|
|
58
|
+
subItems={subItems}
|
|
59
|
+
totalRows={total}
|
|
59
60
|
/>
|
|
60
61
|
);
|
|
61
62
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Method,
|
|
3
|
-
ResponseError,
|
|
3
|
+
type ResponseError,
|
|
4
4
|
useMutationQuery,
|
|
5
5
|
useSnackbar
|
|
6
6
|
} from '@centreon/ui';
|
|
7
|
+
|
|
7
8
|
import { useQueryClient } from '@tanstack/react-query';
|
|
8
|
-
import { ReactElement } from 'react';
|
|
9
|
-
|
|
9
|
+
import type { ReactElement } from 'react';
|
|
10
|
+
|
|
11
|
+
import type { ItemToDelete } from '../models';
|
|
10
12
|
import { isAFunction } from '../utils';
|
|
11
13
|
|
|
12
14
|
interface UseDeleteItem {
|
|
@@ -47,7 +49,7 @@ export const useDeleteItem = ({
|
|
|
47
49
|
mutateAsync({ _meta: item });
|
|
48
50
|
|
|
49
51
|
return {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
deleteItem,
|
|
53
|
+
isMutating
|
|
52
54
|
};
|
|
53
55
|
};
|