@centreon/ui 25.7.0 → 25.7.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.7.0",
3
+ "version": "25.7.2",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -12,10 +12,10 @@
12
12
  "test": "jest",
13
13
  "test:storybook:local": "test-storybook --url http://127.0.0.1:9001",
14
14
  "test:ci": "jest --silent --reporter=jest-junit",
15
- "cypress:ui": "cypress open --component --browser=chrome",
16
- "cypress:run:updateSnapshots": "cypress run --component --browser=chrome --env updateSnapshots=true",
17
- "cypress:run:coverage": "cypress run --component --browser=chrome --env codeCoverageTasksRegistered=true",
18
- "cypress:run": "cypress run --component --browser=chrome",
15
+ "cypress:ui": "cypress open --component --browser=chromium",
16
+ "cypress:run:updateSnapshots": "cypress run --component --browser=chromium --env updateSnapshots=true",
17
+ "cypress:run:coverage": "cypress run --component --browser=chromium --env codeCoverageTasksRegistered=true",
18
+ "cypress:run": "cypress run --component --browser=chromium",
19
19
  "cypress:install": "cypress install",
20
20
  "cypress:cli": "./cypress/scripts/cypress-cli.sh",
21
21
  "tokens:transform": "TS_NODE_PROJECT=tsconfig.node.json ts-node style-dictionary.transform.ts",
@@ -138,8 +138,6 @@ describe('Bar chart', () => {
138
138
  cy.contains(':40 AM').should('be.visible');
139
139
 
140
140
  cy.findByTestId('stacked-bar-3-0-0.16196').should('be.visible');
141
-
142
- cy.makeSnapshot();
143
141
  });
144
142
 
145
143
  it(`displays bar chart ${orientation}ly with a mix of stacked and non-stacked data centered in zero`, () => {
@@ -4,9 +4,11 @@ import {
4
4
  always,
5
5
  cond,
6
6
  equals,
7
+ flatten,
7
8
  gt,
8
9
  gte,
9
10
  head,
11
+ isEmpty,
10
12
  isNil,
11
13
  last,
12
14
  length,
@@ -220,20 +222,26 @@ export const getFormattedAxisValues = ({
220
222
  lines,
221
223
  threshold
222
224
  }: GetFormattedAxisValuesProps): Array<string> => {
223
- const metricId = (lines.find(({ unit }) => equals(unit, axisUnit)) as Line)
224
- ?.metric_id;
225
+ const filteredMetrics = lines.filter(({ unit }) => equals(unit, axisUnit));
225
226
 
226
- if (isNil(metricId)) {
227
+ if (isEmpty(filteredMetrics)) {
227
228
  return [];
228
229
  }
229
- const formattedData = timeSeries.map((data) =>
230
- formatMetricValue({
231
- value: data[metricId],
232
- unit: axisUnit,
233
- base
234
- })
230
+
231
+ const metricIds = pluck('metric_id', filteredMetrics);
232
+
233
+ const formattedData = metricIds.map((metricId) =>
234
+ timeSeries.map((data) =>
235
+ formatMetricValue({
236
+ value: data[metricId],
237
+ unit: axisUnit,
238
+ base
239
+ })
240
+ )
235
241
  );
236
242
 
243
+ const flattenedFormattedData = flatten(formattedData);
244
+
237
245
  const formattedThresholdValues = equals(thresholdUnit, axisUnit)
238
246
  ? threshold.map(({ value }) =>
239
247
  formatMetricValue({
@@ -244,7 +252,7 @@ export const getFormattedAxisValues = ({
244
252
  ) || []
245
253
  : [];
246
254
 
247
- return formattedData
255
+ return flattenedFormattedData
248
256
  .concat(formattedThresholdValues)
249
257
  .filter((v) => v) as Array<string>;
250
258
  };
@@ -0,0 +1,20 @@
1
+ import { SvgIconProps } from '@mui/material';
2
+ import { ReactElement } from 'react';
3
+ import BaseIcon from './BaseIcon';
4
+
5
+ const icon = (
6
+ <g transform="translate(2 2)">
7
+ <path
8
+ d="M19.468,8.107,17.2,6.8l2.264-1.307a.8.8,0,0,0-.8-1.386L16.4,5.414V2.8a.8.8,0,1,0-1.6,0V5.414L12.54,4.107a.8.8,0,1,0-.8,1.386L14,6.8,11.74,8.107a.8.8,0,1,0,.8,1.386L14.8,8.186V10.8a.8.8,0,1,0,1.6,0V8.186l2.264,1.307a.789.789,0,0,0,.4.107.8.8,0,0,0,.4-1.493"
9
+ transform="translate(-1.868)"
10
+ />
11
+ <path
12
+ d="M5.2,20.4a3.2,3.2,0,1,1,3.2-3.2,3.2,3.2,0,0,1-3.2,3.2m0-4.8a1.6,1.6,0,1,0,1.6,1.6,1.6,1.6,0,0,0-1.6-1.6"
13
+ transform="translate(0 -2.4)"
14
+ />
15
+ </g>
16
+ );
17
+
18
+ export const RegexIcon = (props: SvgIconProps): ReactElement => (
19
+ <BaseIcon {...props} Icon={icon} dataTestId="RegexIcon" />
20
+ );
package/src/Icon/index.ts CHANGED
@@ -8,3 +8,4 @@ export { HostGroupIcon } from './HostGroupIcon';
8
8
  export { ServiceGroupIcon } from './ServiceGroupIcon';
9
9
  export { MetaServiceIcon } from './MetaServiceIcon';
10
10
  export { ContainerIcon } from './ContainerIcon';
11
+ export { RegexIcon } from './RegexIcon';
@@ -19,6 +19,7 @@ export interface ConfirmationModalProps<TAtom> {
19
19
  onCancel?: (atomData: Awaited<TAtom> | null) => void;
20
20
  onClose?: (atomData: Awaited<TAtom> | null) => void;
21
21
  onConfirm?: (atomData: Awaited<TAtom> | null) => void;
22
+ size?: 'small' | 'medium' | 'large' | 'xlarge' | 'fullscreen';
22
23
  }
23
24
 
24
25
  interface GetLabelProps<TAtom> {
@@ -39,7 +40,8 @@ export const ConfirmationModal = <TAtom,>({
39
40
  onClose,
40
41
  hasCloseButton = true,
41
42
  isDanger,
42
- disabled
43
+ disabled,
44
+ size
43
45
  }: ConfirmationModalProps<TAtom>): JSX.Element => {
44
46
  const [atomData, setAtomData] = useAtom<TAtom | null>(atom);
45
47
 
@@ -72,6 +74,7 @@ export const ConfirmationModal = <TAtom,>({
72
74
  hasCloseButton={hasCloseButton}
73
75
  open={Boolean(atomData)}
74
76
  onClose={closeModal}
77
+ size={size}
75
78
  >
76
79
  <Modal.Header>{formattedLabels.title}</Modal.Header>
77
80
  <Modal.Body>{formattedLabels.description}</Modal.Body>