@centreon/ui 25.3.3 → 25.4.0-MON-191119-npm-develop.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 +25 -11
- package/public/mockServiceWorker.js +8 -31
- package/src/ActionsList/index.tsx +1 -0
- package/src/Button/Icon/index.tsx +3 -1
- package/src/Button/Save/index.stories.tsx +1 -0
- package/src/Checkbox/Checkbox.tsx +3 -1
- package/src/Checkbox/CheckboxGroup/index.tsx +6 -1
- package/src/Colors/index.tsx +1 -1
- package/src/Dashboard/Dashboard.styles.ts +1 -1
- package/src/Dashboard/Layout.tsx +1 -1
- package/src/Dialog/UnsavedChanges/index.stories.tsx +1 -0
- package/src/Form/CollapsibleGroup.tsx +13 -13
- package/src/Form/Form.cypress.spec.tsx +137 -2
- package/src/Form/Form.stories.tsx +11 -31
- package/src/Form/Form.tsx +2 -0
- package/src/Form/Inputs/Checkbox.tsx +3 -2
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +6 -1
- package/src/Form/Inputs/Grid.tsx +18 -29
- package/src/Form/Inputs/SubGroupDivider.tsx +7 -0
- package/src/Form/Inputs/Text.tsx +1 -0
- package/src/Form/Inputs/index.tsx +31 -24
- package/src/Form/Inputs/models.ts +8 -1
- package/src/Form/Section/FormSection.tsx +34 -0
- package/src/Form/Section/PanelTabs.tsx +13 -0
- package/src/Form/Section/navigateToSection.ts +9 -0
- package/src/Form/storiesData.tsx +14 -4
- package/src/Graph/BarChart/BarChart.cypress.spec.tsx +46 -6
- package/src/Graph/BarChart/BarChart.stories.tsx +60 -0
- package/src/Graph/BarChart/BarChart.tsx +56 -32
- package/src/Graph/BarChart/BarGroup.tsx +22 -32
- package/src/Graph/BarChart/MemoizedGroup.tsx +8 -11
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +145 -32
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +2 -2
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +18 -45
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +42 -28
- package/src/Graph/Chart/Chart.cypress.spec.tsx +85 -15
- package/src/Graph/Chart/Chart.stories.tsx +84 -1
- package/src/Graph/Chart/Chart.tsx +17 -4
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +8 -2
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +10 -3
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +19 -2
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/index.tsx +1 -1
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +2 -4
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/index.tsx +14 -3
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/models.ts +3 -0
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/useZoomPreview.ts +12 -10
- package/src/Graph/Chart/InteractiveComponents/index.tsx +63 -5
- package/src/Graph/Chart/Legend/index.tsx +26 -2
- package/src/Graph/Chart/helpers/index.ts +4 -3
- package/src/Graph/Chart/index.tsx +45 -45
- package/src/Graph/Chart/models.ts +8 -0
- package/src/Graph/Chart/useChartData.ts +14 -2
- package/src/Graph/Gauge/Gauge.tsx +18 -14
- package/src/Graph/Gauge/ResponsiveGauge.tsx +10 -6
- package/src/Graph/Gauge/useResizeObserver.ts +68 -0
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +18 -16
- package/src/Graph/SingleBar/ThresholdLine.tsx +4 -4
- package/src/Graph/SingleBar/models.ts +1 -0
- package/src/Graph/Text/Text.styles.ts +2 -2
- package/src/Graph/Text/Text.tsx +23 -10
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +4 -0
- package/src/Graph/Timeline/Timeline.tsx +21 -4
- package/src/Graph/Tree/Links.tsx +2 -2
- package/src/Graph/Tree/Tree.tsx +2 -2
- package/src/Graph/Tree/constants.ts +1 -1
- package/src/Graph/common/BaseChart/BaseChart.tsx +6 -1
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +5 -4
- package/src/Graph/common/BaseChart/Header/index.tsx +3 -1
- package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +13 -9
- package/src/Graph/common/timeSeries/index.test.ts +20 -0
- package/src/Graph/common/timeSeries/index.ts +225 -44
- package/src/Graph/common/timeSeries/models.ts +6 -2
- package/src/Graph/common/utils.ts +45 -12
- package/src/Graph/index.ts +3 -1
- package/src/Graph/mockedData/dataWithMissingPoint.json +74 -0
- package/src/Graph/mockedData/pingServiceWithStackedKeys.json +205 -0
- package/src/Icon/RegexIcon.tsx +20 -0
- package/src/Icon/index.ts +1 -0
- package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +68 -14
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +49 -14
- package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +78 -0
- package/src/InputField/Select/Autocomplete/Multi/Multi.styles.ts +26 -0
- package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +124 -0
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -117
- package/src/InputField/Select/Autocomplete/index.tsx +28 -17
- package/src/InputField/Select/Option.tsx +3 -3
- package/src/InputField/Select/index.tsx +4 -0
- package/src/InputField/Text/index.tsx +4 -2
- package/src/InputField/translatedLabels.ts +4 -0
- package/src/Listing/ActionBar/Pagination.tsx +10 -23
- package/src/Listing/ActionBar/PaginationActions.tsx +1 -10
- package/src/Listing/ActionBar/index.tsx +1 -1
- package/src/Listing/Cell/DataCell.tsx +6 -6
- package/src/Listing/Cell/EllipsisTypography.tsx +10 -32
- package/src/Listing/Cell/index.tsx +57 -89
- package/src/Listing/Checkbox.tsx +8 -20
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +17 -14
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +5 -9
- package/src/Listing/Header/ListingHeader.tsx +2 -5
- package/src/Listing/Header/_internals/Label.tsx +1 -17
- package/src/Listing/Row/EmptyRow.tsx +2 -6
- package/src/Listing/Row/Row.tsx +7 -36
- package/src/Listing/index.stories.tsx +1 -0
- package/src/Listing/index.tsx +26 -26
- package/src/Listing/useStyleTable.ts +58 -32
- package/src/ListingPage/index.stories.tsx +1 -0
- package/src/Module/index.tsx +8 -2
- package/src/MultiSelectEntries/index.stories.tsx +1 -0
- package/src/MultiSelectEntries/index.tsx +1 -1
- package/src/Pagination/Pagination.cypress.spec.tsx +137 -0
- package/src/Pagination/Pagination.stories.tsx +46 -0
- package/src/Pagination/Pagination.styles.ts +56 -0
- package/src/Pagination/Pagination.tsx +146 -0
- package/src/Pagination/index.ts +3 -0
- package/src/Pagination/utils.ts +7 -0
- package/src/SortableItems/index.stories.tsx +2 -2
- package/src/StoryBookThemeProvider/index.tsx +3 -1
- package/src/ThemeProvider/base.css +49 -0
- package/src/ThemeProvider/index.tsx +21 -47
- package/src/ThemeProvider/palettes.ts +5 -3
- package/src/ThemeProvider/tailwindcss.css +230 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +9 -11
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +1 -0
- package/src/TimePeriods/DateTimePickerInput.tsx +3 -1
- package/src/api/customFetch.ts +0 -9
- package/src/api/models.ts +9 -0
- package/src/api/useBulkResponse.ts +58 -0
- package/src/api/useGraphQuery/index.ts +108 -12
- package/src/components/Avatar/Avatar.stories.tsx +1 -0
- package/src/components/Button/Button.module.css +38 -0
- package/src/components/Button/Button.stories.tsx +25 -0
- package/src/components/Button/Button.tsx +2 -5
- package/src/components/CrudPage/Actions/Actions.styles.ts +15 -1
- package/src/components/CrudPage/Actions/Actions.tsx +7 -4
- package/src/components/CrudPage/Actions/Search.tsx +15 -14
- package/src/components/CrudPage/CrudPage.stories.tsx +1 -0
- package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
- package/src/components/DataTable/DataTable.stories.tsx +1 -0
- package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +1 -0
- package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +3 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
- package/src/components/DataTable/Item/DataTableItem.stories.tsx +1 -0
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +1 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +4 -3
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +15 -10
- package/src/components/Form/FormActions.tsx +21 -12
- package/src/components/Header/PageHeader/PageHeader.styles.ts +5 -5
- package/src/components/Layout/AreaIndicator.tsx +4 -6
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +1 -1
- package/src/components/Layout/PageLayout/PageLayout.tsx +9 -3
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +5 -3
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +5 -3
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -3
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +17 -17
- package/src/components/Menu/Button/MenuButton.tsx +6 -6
- package/src/components/Menu/MenuDivider.tsx +1 -5
- package/src/components/Menu/MenuItem.tsx +1 -5
- package/src/components/Menu/MenuItems.tsx +5 -4
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +1 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +4 -1
- package/src/components/Modal/Modal.stories.tsx +21 -0
- package/src/components/Modal/Modal.styles.ts +1 -19
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/components/Modal/ModalBody.tsx +6 -4
- package/src/components/Modal/ModalHeader.tsx +9 -5
- package/src/components/Modal/modal.module.css +16 -0
- package/src/components/Tabs/Tab.styles.ts +0 -6
- package/src/components/Tabs/Tabs.tsx +37 -15
- package/src/index.ts +4 -0
- package/src/queryParameters/url/index.ts +7 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/useLocale/index.ts +9 -0
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +38 -0
- package/src/utils/useLocaleDateTimeFormat/index.ts +4 -2
- package/src/utils/usePluralizedTranslation.ts +2 -3
- package/src/Listing/Cell/DataCell.styles.ts +0 -27
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +0 -71
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +0 -26
- package/src/Listing/Header/ListingHeader.styles.ts +0 -16
- package/src/Listing/Listing.styles.ts +0 -78
- package/src/Listing/Row/EmptyRow.styles.ts +0 -14
- package/src/components/Button/Button.styles.ts +0 -44
- package/src/components/Layout/AreaIndicator.styles.ts +0 -33
- package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
- package/src/components/Menu/Menu.styles.ts +0 -68
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useAtomValue } from 'jotai';
|
|
2
|
-
import { equals } from 'ramda';
|
|
2
|
+
import { equals, mergeDeepRight } from 'ramda';
|
|
3
3
|
import { CSSInterpolation } from 'tss-react';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
ButtonProps,
|
|
7
7
|
InputBaseProps,
|
|
8
8
|
ThemeProvider as MuiThemeProvider,
|
|
9
|
+
PaletteOptions,
|
|
9
10
|
StyledEngineProvider,
|
|
10
11
|
Theme,
|
|
11
12
|
createTheme
|
|
@@ -21,6 +22,7 @@ import RobotoLightWoff2 from '../fonts/roboto-light-webfont.woff2';
|
|
|
21
22
|
import RobotoMediumWoff2 from '../fonts/roboto-medium-webfont.woff2';
|
|
22
23
|
import RobotoRegularWoff2 from '../fonts/roboto-regular-webfont.woff2';
|
|
23
24
|
|
|
25
|
+
import { GlobalStyles } from '@mui/system';
|
|
24
26
|
import { ReactNode, useMemo } from 'react';
|
|
25
27
|
import { getPalette } from './palettes';
|
|
26
28
|
|
|
@@ -146,46 +148,6 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
146
148
|
},
|
|
147
149
|
MuiCssBaseline: {
|
|
148
150
|
styleOverrides: (theme) => `
|
|
149
|
-
::-webkit-scrollbar {
|
|
150
|
-
height: ${theme.spacing(1)};
|
|
151
|
-
width: ${theme.spacing(1)};
|
|
152
|
-
background-color: transparent;
|
|
153
|
-
}
|
|
154
|
-
::-webkit-scrollbar-thumb {
|
|
155
|
-
background-color: ${
|
|
156
|
-
equals(mode, 'dark')
|
|
157
|
-
? theme.palette.divider
|
|
158
|
-
: theme.palette.text.disabled
|
|
159
|
-
};
|
|
160
|
-
border-radius: ${theme.spacing(0.5)};
|
|
161
|
-
}
|
|
162
|
-
::-webkit-scrollbar-thumb:hover {
|
|
163
|
-
background-color: ${theme.palette.primary.main};
|
|
164
|
-
}
|
|
165
|
-
* {
|
|
166
|
-
scrollbar-color: ${
|
|
167
|
-
equals(mode, 'dark')
|
|
168
|
-
? theme.palette.divider
|
|
169
|
-
: theme.palette.text.disabled
|
|
170
|
-
} ${theme.palette.background.default};
|
|
171
|
-
scrollbar-width: thin;
|
|
172
|
-
}
|
|
173
|
-
html {
|
|
174
|
-
margin: 0;
|
|
175
|
-
padding: 0;
|
|
176
|
-
width: 100%;
|
|
177
|
-
height: 100%;
|
|
178
|
-
text-rendering: optimizeLegibility;
|
|
179
|
-
}
|
|
180
|
-
body {
|
|
181
|
-
background-color: ${theme.palette.background.paper};
|
|
182
|
-
height: 100%;
|
|
183
|
-
padding: 0;
|
|
184
|
-
width: 100%;
|
|
185
|
-
}
|
|
186
|
-
#root {
|
|
187
|
-
background-color: ${theme.palette.background.paper};
|
|
188
|
-
}
|
|
189
151
|
@font-face {
|
|
190
152
|
font-family: 'Roboto';
|
|
191
153
|
font-style: normal;
|
|
@@ -210,6 +172,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
210
172
|
font-weight: 700;
|
|
211
173
|
src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
|
|
212
174
|
}
|
|
175
|
+
body {
|
|
176
|
+
background-color: ${theme.palette.background.paper};
|
|
177
|
+
}
|
|
213
178
|
`
|
|
214
179
|
},
|
|
215
180
|
MuiInputBase: {
|
|
@@ -293,18 +258,27 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
293
258
|
|
|
294
259
|
interface Props {
|
|
295
260
|
children: ReactNode;
|
|
261
|
+
overrideTheme?: {
|
|
262
|
+
light: Partial<PaletteOptions>;
|
|
263
|
+
dark: Partial<PaletteOptions>;
|
|
264
|
+
};
|
|
296
265
|
}
|
|
297
266
|
|
|
298
|
-
const ThemeProvider = ({ children }: Props): JSX.Element => {
|
|
267
|
+
const ThemeProvider = ({ children, overrideTheme }: Props): JSX.Element => {
|
|
299
268
|
const { themeMode } = useAtomValue(userAtom);
|
|
300
269
|
|
|
301
|
-
const theme = useMemo(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
270
|
+
const theme = useMemo(() => {
|
|
271
|
+
const overrideThemeByMode = overrideTheme?.[themeMode || 'light'];
|
|
272
|
+
return createTheme(
|
|
273
|
+
mergeDeepRight(getTheme(themeMode || ThemeMode.light), {
|
|
274
|
+
palette: overrideThemeByMode || {}
|
|
275
|
+
})
|
|
276
|
+
);
|
|
277
|
+
}, [themeMode, overrideTheme]);
|
|
305
278
|
|
|
306
279
|
return (
|
|
307
|
-
<StyledEngineProvider injectFirst>
|
|
280
|
+
<StyledEngineProvider injectFirst enableCssLayer>
|
|
281
|
+
<GlobalStyles styles="@layer theme,base,mui,components,utilities;" />
|
|
308
282
|
<MuiThemeProvider theme={theme}>
|
|
309
283
|
<CssBaseline />
|
|
310
284
|
{children}
|
|
@@ -211,7 +211,7 @@ export const lightPalette: PaletteOptions = {
|
|
|
211
211
|
default: '#696969'
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
|
-
border: '#
|
|
214
|
+
border: '#EDEDED',
|
|
215
215
|
description: '#4A4A4A',
|
|
216
216
|
title: '#000000'
|
|
217
217
|
}
|
|
@@ -295,7 +295,9 @@ export const lightPalette: PaletteOptions = {
|
|
|
295
295
|
},
|
|
296
296
|
warning: {
|
|
297
297
|
contrastText: '#000',
|
|
298
|
-
main: '#FD9B27'
|
|
298
|
+
main: '#FD9B27',
|
|
299
|
+
light: '#FCC481',
|
|
300
|
+
dark: '#FC7E00'
|
|
299
301
|
}
|
|
300
302
|
};
|
|
301
303
|
|
|
@@ -353,7 +355,7 @@ export const darkPalette: PaletteOptions = {
|
|
|
353
355
|
default: '#696969'
|
|
354
356
|
}
|
|
355
357
|
},
|
|
356
|
-
border: '#
|
|
358
|
+
border: '#666666',
|
|
357
359
|
description: '#bdbdbd',
|
|
358
360
|
title: '#fff'
|
|
359
361
|
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "./base.css"; /* Base styles: scrollbar, html, body, #root */
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
5
|
+
|
|
6
|
+
@theme {
|
|
7
|
+
/* Typography */
|
|
8
|
+
--font-body: Roboto, Arial, serif;
|
|
9
|
+
|
|
10
|
+
/* Spacing system */
|
|
11
|
+
--spacing: 4px;
|
|
12
|
+
|
|
13
|
+
--spacing-0: calc(var(--spacing) * 0);
|
|
14
|
+
--spacing-1: calc(var(--spacing) * 1);
|
|
15
|
+
--spacing-2: calc(var(--spacing) * 2);
|
|
16
|
+
--spacing-3: calc(var(--spacing) * 3);
|
|
17
|
+
--spacing-4: calc(var(--spacing) * 4);
|
|
18
|
+
--spacing-5: calc(var(--spacing) * 5);
|
|
19
|
+
--spacing-6: calc(var(--spacing) * 6);
|
|
20
|
+
--spacing-7: calc(var(--spacing) * 7);
|
|
21
|
+
--spacing-8: calc(var(--spacing) * 8);
|
|
22
|
+
--spacing-9: calc(var(--spacing) * 9);
|
|
23
|
+
--spacing-10: calc(var(--spacing) * 10);
|
|
24
|
+
|
|
25
|
+
/* =============
|
|
26
|
+
COLOR SYSTEM
|
|
27
|
+
============= */
|
|
28
|
+
|
|
29
|
+
/* Action colors */
|
|
30
|
+
--color-action-acknowledged: #745f35;
|
|
31
|
+
--color-action-acknowledged-background: #dfd2b9;
|
|
32
|
+
--color-action-in-flapping: #064a3f;
|
|
33
|
+
--color-action-in-flapping-background: #d8f3ef;
|
|
34
|
+
--color-action-activated-opacity: 0.12;
|
|
35
|
+
--color-action-active: #666666;
|
|
36
|
+
--color-action-disabled: #999999;
|
|
37
|
+
--color-action-disabled-background: rgba(0, 0, 0, 0.12);
|
|
38
|
+
--color-action-focus: #dadada;
|
|
39
|
+
--color-action-focus-opacity: 0.12;
|
|
40
|
+
--color-action-hover: rgba(0, 0, 0, 0.06);
|
|
41
|
+
--color-action-hover-opacity: 0.06;
|
|
42
|
+
--color-action-in-downtime: #512980;
|
|
43
|
+
--color-action-in-downtime-background: #e5d8f3;
|
|
44
|
+
--color-action-selected: rgba(102, 102, 102, 0.3);
|
|
45
|
+
--color-action-selected-opacity: 0.3;
|
|
46
|
+
|
|
47
|
+
/* Background colors */
|
|
48
|
+
--color-background-default: #f4f4f4;
|
|
49
|
+
--color-background-listing-header: #666666;
|
|
50
|
+
--color-background-panel: #ededed;
|
|
51
|
+
--color-background-panel-groups: #f5f5f5;
|
|
52
|
+
--color-background-paper: #ffffff;
|
|
53
|
+
--color-background-tooltip: #434e58;
|
|
54
|
+
--color-background-widget: #f8f8f8;
|
|
55
|
+
|
|
56
|
+
/* Chip colors */
|
|
57
|
+
--color-chip-error: #ff6666;
|
|
58
|
+
--color-chip-info: #1588d1;
|
|
59
|
+
--color-chip-neutral: #6da4e4;
|
|
60
|
+
--color-chip-success: #88b922;
|
|
61
|
+
--color-chip-warning: #fd9b27;
|
|
62
|
+
|
|
63
|
+
/* Utility colors */
|
|
64
|
+
--color-divider: #e3e3e3;
|
|
65
|
+
--color-error-main: #ff4a4a;
|
|
66
|
+
|
|
67
|
+
/* Header colors */
|
|
68
|
+
--color-header-page-action-background-active: #1975d10f;
|
|
69
|
+
--color-header-page-action-background-default: #ffffff00;
|
|
70
|
+
--color-header-page-action-color-active: #1976d2;
|
|
71
|
+
--color-header-page-action-color-default: #696969;
|
|
72
|
+
--color-header-page-border: #ededed;
|
|
73
|
+
--color-header-page-description: #4a4a4a;
|
|
74
|
+
--color-header-page-title: #000000;
|
|
75
|
+
--color-header-info-main: #1588d1;
|
|
76
|
+
--color-header-layout-body-background: #f6f6f6;
|
|
77
|
+
--color-header-layout-header-background: #ffffff;
|
|
78
|
+
--color-header-layout-header-border: #e3e3e3;
|
|
79
|
+
--color-header-menu-background: #ffffff;
|
|
80
|
+
--color-header-menu-button-background-active: #ecf4fd;
|
|
81
|
+
--color-header-menu-button-background-default: transparent;
|
|
82
|
+
--color-header-menu-button-background-hover: #d2e4f9;
|
|
83
|
+
--color-header-menu-button-color-active: #3e85d5;
|
|
84
|
+
--color-header-menu-button-color-default: #8c98a6;
|
|
85
|
+
--color-header-menu-button-color-hover: #6f7b8a;
|
|
86
|
+
--color-header-menu-divider-border: #cad0d8;
|
|
87
|
+
--color-header-menu-item-background-active: #ecf4fd;
|
|
88
|
+
--color-header-menu-item-background-default: transparent;
|
|
89
|
+
--color-header-menu-item-background-hover: #eaedf0;
|
|
90
|
+
--color-header-menu-item-color-active: #3e85d5;
|
|
91
|
+
--color-header-menu-item-color-default: #1b2127;
|
|
92
|
+
--color-header-menu-item-color-hover: #101418;
|
|
93
|
+
|
|
94
|
+
/* State colors */
|
|
95
|
+
--color-pending-main: #1ebeb3;
|
|
96
|
+
|
|
97
|
+
/* Primary & Secondary colors */
|
|
98
|
+
--color-primary-main: #2e68aa;
|
|
99
|
+
--color-primary-light: #cde7fc;
|
|
100
|
+
--color-primary-dark: #255891;
|
|
101
|
+
--color-secondary-main: #c772d6;
|
|
102
|
+
--color-secondary-light: #e5a5f0;
|
|
103
|
+
--color-secondary-dark: #ac28c1;
|
|
104
|
+
|
|
105
|
+
/* Status colors */
|
|
106
|
+
--color-status-background-error: #ff6666;
|
|
107
|
+
--color-status-background-none: --alpha(#2e68aa / 10%);
|
|
108
|
+
--color-status-background-pending: #1ebeb3;
|
|
109
|
+
--color-status-background-success: #88b922;
|
|
110
|
+
--color-stauts-background-unknown: #e3e3e3;
|
|
111
|
+
--color-status-background-warning: #fd9b27;
|
|
112
|
+
--color-success-main: #88b922;
|
|
113
|
+
|
|
114
|
+
/* Text colors */
|
|
115
|
+
--color-text-disabled: #999999;
|
|
116
|
+
--color-text-primary: #000000;
|
|
117
|
+
--color-text-secondary: #666666;
|
|
118
|
+
--color-warning-main: #fd9b27;
|
|
119
|
+
--color-warning-light: #fcc481;
|
|
120
|
+
--color-warning-dark: #fc7e00;
|
|
121
|
+
|
|
122
|
+
/* Base colors */
|
|
123
|
+
--color-white: #ffffff;
|
|
124
|
+
--color-black: #000000;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@layer base {
|
|
128
|
+
@variant dark {
|
|
129
|
+
--color-action-acknowledged: #dfd2b9;
|
|
130
|
+
--color-action-acknowledged-background: #745f35;
|
|
131
|
+
--color-action-in-flapping: #d8f3ef;
|
|
132
|
+
--color-action-in-flapping-background: #064a3f;
|
|
133
|
+
--color-action-activated-opacity: 0.3;
|
|
134
|
+
--color-action-active: #b5b5b5;
|
|
135
|
+
--color-action-disabled: #999999;
|
|
136
|
+
--color-action-disabled-background: rgba(0, 0, 0, 0.12);
|
|
137
|
+
--color-action-focus: #6d6d6d;
|
|
138
|
+
--color-action-focus-opacity: 0.3;
|
|
139
|
+
--color-action-hover: rgba(255, 255, 255, 0.16);
|
|
140
|
+
--color-action-hover-opacity: 0.16;
|
|
141
|
+
--color-action-in-downtime: #e5d8f3;
|
|
142
|
+
--color-action-in-downtime-background: #512980;
|
|
143
|
+
--color-action-selected: rgba(255, 255, 255, 0.5);
|
|
144
|
+
--color-action-selected-opacity: 0.5;
|
|
145
|
+
--color-background-default: #4a4a4a;
|
|
146
|
+
--color-background-listing-header: #666666;
|
|
147
|
+
--color-background-panel: #4a4a4a;
|
|
148
|
+
--color-background-panel-groups: #252525;
|
|
149
|
+
--color-background-paper: #212121;
|
|
150
|
+
--color-background-tooltip: #aab4c0;
|
|
151
|
+
--color-background-widget: #2e2e2e;
|
|
152
|
+
--color-chip-error: #d60101;
|
|
153
|
+
--color-chip-info: #1ca9f4;
|
|
154
|
+
--color-chip-neutral: #434e5b;
|
|
155
|
+
--color-chip-success: #5f8118;
|
|
156
|
+
--color-chip-warning: #c55400;
|
|
157
|
+
--color-divider: #666666;
|
|
158
|
+
--color-error-main: #d60101;
|
|
159
|
+
--color-header-page-action-background-active: #1975d10f;
|
|
160
|
+
--color-header-page-action-background-default: #ffffff00;
|
|
161
|
+
--color-header-page-action-color-active: #1976d2;
|
|
162
|
+
--color-header-page-action-color-default: #696969;
|
|
163
|
+
--color-header-page-border: #666666;
|
|
164
|
+
--color-header-page-description: #bdbdbd;
|
|
165
|
+
--color-header-page-title: #ffffff;
|
|
166
|
+
--color-header-info-main: #1ca9f4;
|
|
167
|
+
--color-header-layout-body-background: #f6f6f6;
|
|
168
|
+
--color-header-layout-header-background: #ffffff;
|
|
169
|
+
--color-header-layout-header-border: #e3e3e3;
|
|
170
|
+
--color-header-menu-background: #101418;
|
|
171
|
+
--color-header-menu-button-background-active: #071d37;
|
|
172
|
+
--color-header-menu-button-background-default: transparent;
|
|
173
|
+
--color-header-menu-button-background-hover: #1b2127;
|
|
174
|
+
--color-header-menu-button-color-active: #205593;
|
|
175
|
+
--color-header-menu-button-color-default: #596573;
|
|
176
|
+
--color-header-menu-button-color-hover: #6f7b8a;
|
|
177
|
+
--color-header-menu-divider-border: #2f3741;
|
|
178
|
+
--color-header-menu-item-background-active: #071d37;
|
|
179
|
+
--color-header-menu-item-background-default: transparent;
|
|
180
|
+
--color-header-menu-item-background-hover: #1b2127;
|
|
181
|
+
--color-header-menu-item-color-active: #3e85d5;
|
|
182
|
+
--color-header-menu-item-color-default: #f9fafb;
|
|
183
|
+
--color-header-menu-item-color-hover: #ffffff;
|
|
184
|
+
--color-pending-main: #118077;
|
|
185
|
+
--color-primary-main: #6eaff8;
|
|
186
|
+
--color-primary-light: #8bbff9;
|
|
187
|
+
--color-primary-dark: #4974a5;
|
|
188
|
+
--color-secondary-main: #7c1fa2;
|
|
189
|
+
--color-status-background-error: #d60101;
|
|
190
|
+
--color-status-background-none: --alpha(#2e68aa / 10%);
|
|
191
|
+
--color-status-background-pending: #118077;
|
|
192
|
+
--color-status-background-success: #5f8118;
|
|
193
|
+
--color-stauts-background-unknown: #666666;
|
|
194
|
+
--color-status-background-warning: #c55400;
|
|
195
|
+
--color-success-main: #5f8118;
|
|
196
|
+
--color-text-disabled: #666666;
|
|
197
|
+
--color-text-primary: #ffffff;
|
|
198
|
+
--color-text-secondary: #cccccc;
|
|
199
|
+
--color-warning-main: #c55400;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@layer components {
|
|
204
|
+
.flex-column {
|
|
205
|
+
@apply flex flex-col gap-1;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.flex-row {
|
|
209
|
+
@apply flex flex-row gap-1;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.flex-column-center {
|
|
213
|
+
@apply flex flex-col items-center;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.flex-column-start {
|
|
217
|
+
@apply flex flex-col items-start;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.flex-column-end {
|
|
221
|
+
@apply flex flex-col items-end;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
#root {
|
|
226
|
+
transition-duration: var(--default-transition-duration);
|
|
227
|
+
transition-property:
|
|
228
|
+
color, background-color, border-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter;
|
|
229
|
+
transition-timing-function: var(--default-transition-timing-function);
|
|
230
|
+
}
|
|
@@ -10,8 +10,6 @@ import { Typography } from '@mui/material';
|
|
|
10
10
|
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
11
11
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
12
12
|
|
|
13
|
-
import { userAtom } from '@centreon/ui-context';
|
|
14
|
-
|
|
15
13
|
import DateTimePickerInput from '../../DateTimePickerInput';
|
|
16
14
|
import { isInvalidDate } from '../../helpers';
|
|
17
15
|
import {
|
|
@@ -20,6 +18,7 @@ import {
|
|
|
20
18
|
} from '../../models';
|
|
21
19
|
import { errorTimePeriodAtom } from '../../timePeriodsAtoms';
|
|
22
20
|
|
|
21
|
+
import { useLocale } from '../../../utils';
|
|
23
22
|
import ErrorText from './ErrorText';
|
|
24
23
|
import {
|
|
25
24
|
PickersStartEndDateDirection,
|
|
@@ -96,11 +95,10 @@ const PickersStartEndDate = ({
|
|
|
96
95
|
changeDate,
|
|
97
96
|
rangeStartDate,
|
|
98
97
|
rangeEndDate,
|
|
99
|
-
direction = PickersStartEndDateDirection.column
|
|
98
|
+
direction = PickersStartEndDateDirection.column,
|
|
99
|
+
className
|
|
100
100
|
}: PickersStartEndDateProps): JSX.Element => {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const { locale } = useAtomValue(userAtom);
|
|
101
|
+
const locale = useLocale();
|
|
104
102
|
const error = useAtomValue(errorTimePeriodAtom);
|
|
105
103
|
const isError = error || isInvalidDate({ endDate, startDate });
|
|
106
104
|
|
|
@@ -109,16 +107,16 @@ const PickersStartEndDate = ({
|
|
|
109
107
|
const maxEnd = rangeEndDate?.max;
|
|
110
108
|
const minEnd = rangeEndDate?.min || startDate;
|
|
111
109
|
|
|
112
|
-
const
|
|
113
|
-
? classes.verticalDirection
|
|
114
|
-
: classes.horizontalDirection;
|
|
110
|
+
const isColumn = equals(direction, PickersStartEndDateDirection.column);
|
|
115
111
|
|
|
116
112
|
return (
|
|
117
113
|
<LocalizationProvider
|
|
118
114
|
adapterLocale={locale.substring(0, 2)}
|
|
119
115
|
dateAdapter={AdapterDayjs}
|
|
120
116
|
>
|
|
121
|
-
<div
|
|
117
|
+
<div
|
|
118
|
+
className={`flex ${isColumn ? 'flex-col justify-center' : 'flex-row items-center py-2 px-4'} gap-2 ${className}`}
|
|
119
|
+
>
|
|
122
120
|
<PickerDateWithLabel
|
|
123
121
|
changeDate={changeDate}
|
|
124
122
|
date={startDate}
|
|
@@ -144,7 +142,7 @@ const PickersStartEndDate = ({
|
|
|
144
142
|
{isError && (
|
|
145
143
|
<ErrorText
|
|
146
144
|
message="The end date must be greater than the start date"
|
|
147
|
-
style=
|
|
145
|
+
style="text-center"
|
|
148
146
|
/>
|
|
149
147
|
)}
|
|
150
148
|
</LocalizationProvider>
|
|
@@ -13,6 +13,7 @@ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
|
13
13
|
|
|
14
14
|
import { userAtom } from '@centreon/ui-context';
|
|
15
15
|
|
|
16
|
+
import { useLocale } from '../utils';
|
|
16
17
|
import { CustomTimePeriodProperty } from './models';
|
|
17
18
|
|
|
18
19
|
interface ChangeDateProps {
|
|
@@ -50,6 +51,7 @@ const DateTimePickerInput = ({
|
|
|
50
51
|
'@media (min-width: 1024px) or (pointer: fine)';
|
|
51
52
|
|
|
52
53
|
const user = useAtomValue(userAtom);
|
|
54
|
+
const localeToUse = useLocale();
|
|
53
55
|
|
|
54
56
|
const isUTC = equals(timezone ?? user.timezone, 'UTC');
|
|
55
57
|
|
|
@@ -72,7 +74,7 @@ const DateTimePickerInput = ({
|
|
|
72
74
|
|
|
73
75
|
return (
|
|
74
76
|
<LocalizationProvider
|
|
75
|
-
adapterLocale={(locale ??
|
|
77
|
+
adapterLocale={(locale ?? localeToUse).substring(0, 2)}
|
|
76
78
|
dateAdapter={AdapterDayjs}
|
|
77
79
|
dateLibInstance={dayjs}
|
|
78
80
|
>
|
package/src/api/customFetch.ts
CHANGED
|
@@ -95,15 +95,6 @@ export const customFetch = <T>({
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
if (equals(response.status, 207)) {
|
|
99
|
-
return {
|
|
100
|
-
data: data.results,
|
|
101
|
-
isError: false,
|
|
102
|
-
message: '',
|
|
103
|
-
statusCode: response.status
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
98
|
if (decoder) {
|
|
108
99
|
return decoder.decodeToPromise(data).catch((error: string) => {
|
|
109
100
|
catchError({
|
package/src/api/models.ts
CHANGED
|
@@ -8,3 +8,12 @@ export interface Listing<TEntity> {
|
|
|
8
8
|
meta: ListingMeta;
|
|
9
9
|
result: Array<TEntity>;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export interface ListingMap<TEntity> {
|
|
13
|
+
content: Array<TEntity>;
|
|
14
|
+
totalPages: number;
|
|
15
|
+
totalElements: number;
|
|
16
|
+
size: number;
|
|
17
|
+
number: number;
|
|
18
|
+
numberOfElements: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
complement,
|
|
3
|
+
includes,
|
|
4
|
+
isEmpty,
|
|
5
|
+
isNil,
|
|
6
|
+
last,
|
|
7
|
+
length,
|
|
8
|
+
prop,
|
|
9
|
+
propEq,
|
|
10
|
+
split
|
|
11
|
+
} from 'ramda';
|
|
12
|
+
import useSnackbar from '../Snackbar/useSnackbar';
|
|
13
|
+
|
|
14
|
+
const useBulkResponse = () => {
|
|
15
|
+
const { showSuccessMessage, showErrorMessage, showWarningMessage } =
|
|
16
|
+
useSnackbar();
|
|
17
|
+
|
|
18
|
+
const handleBulkResponse = ({
|
|
19
|
+
data,
|
|
20
|
+
labelSuccess,
|
|
21
|
+
labelWarning,
|
|
22
|
+
labelFailed,
|
|
23
|
+
items
|
|
24
|
+
}) => {
|
|
25
|
+
const successfullResponses =
|
|
26
|
+
data?.filter(propEq(204, 'status')) || isNil(data);
|
|
27
|
+
|
|
28
|
+
const failedResponses = data?.filter(complement(propEq(204, 'status')));
|
|
29
|
+
|
|
30
|
+
const failedResponsesIds = failedResponses
|
|
31
|
+
?.map(prop('href'))
|
|
32
|
+
?.map((item: string) =>
|
|
33
|
+
Number.parseInt(last(split('/', item || '')) as string, 10)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (isEmpty(successfullResponses)) {
|
|
37
|
+
showErrorMessage(labelFailed);
|
|
38
|
+
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (length(successfullResponses) < length(data)) {
|
|
43
|
+
const failedResponsesNames = items
|
|
44
|
+
?.filter((item) => includes(item.id, failedResponsesIds))
|
|
45
|
+
.map((item) => item.name);
|
|
46
|
+
|
|
47
|
+
showWarningMessage(`${labelWarning}: ${failedResponsesNames.join(', ')}`);
|
|
48
|
+
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
showSuccessMessage(labelSuccess);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return handleBulkResponse;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default useBulkResponse;
|