@centreon/ui 25.10.0 → 25.10.2-dev-25-10-x.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 +1 -1
- package/src/Form/Inputs/Grid.tsx +2 -3
- package/src/Form/Section/navigateToSection.ts +6 -6
- package/src/Graph/BarChart/BarChart.stories.tsx +1 -42
- package/src/Graph/BarChart/BarChart.tsx +1 -1
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +1 -2
- package/src/Graph/Chart/Chart.cypress.spec.tsx +5 -24
- package/src/Graph/Chart/Chart.stories.tsx +1 -34
- package/src/Graph/Chart/Chart.tsx +2 -3
- package/src/Graph/Chart/Legend/index.tsx +2 -26
- package/src/Graph/Chart/models.ts +1 -6
- package/src/Graph/Chart/useChartData.ts +1 -1
- package/src/Graph/common/BaseChart/BaseChart.tsx +1 -6
- package/src/Graph/common/timeSeries/index.ts +9 -27
- package/src/Graph/common/utils.ts +4 -10
- package/src/InputField/Select/index.tsx +2 -1
- package/src/Module/index.tsx +2 -8
- package/src/ThemeProvider/index.tsx +46 -18
- package/src/ThemeProvider/tailwindcss.css +0 -26
- package/src/api/useGraphQuery/index.ts +2 -7
- package/src/components/Modal/Modal.styles.ts +2 -1
- package/src/components/Modal/ModalHeader.tsx +1 -5
- package/src/ThemeProvider/base.css +0 -49
package/package.json
CHANGED
package/src/Form/Inputs/Grid.tsx
CHANGED
|
@@ -21,9 +21,8 @@ const Grid = ({
|
|
|
21
21
|
<div
|
|
22
22
|
className={`${className} grid gap-3`}
|
|
23
23
|
style={{
|
|
24
|
-
gridTemplateColumns:
|
|
25
|
-
? grid?.gridTemplateColumns || undefined
|
|
26
|
-
: grid?.gridTemplateColumns ||
|
|
24
|
+
gridTemplateColumns:
|
|
25
|
+
className ? grid?.gridTemplateColumns || undefined : grid?.gridTemplateColumns ||
|
|
27
26
|
`repeat(${grid?.columns.length || 1}, 1fr)`,
|
|
28
27
|
alignItems: grid?.alignItems || 'flex-start'
|
|
29
28
|
}}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const useNavigateToSection = () => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
return (sectionName: string) => {
|
|
3
|
+
const section = document.querySelector(
|
|
4
|
+
`[data-section-group-form-id="${sectionName}"]`
|
|
5
|
+
);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
section?.scrollIntoView({ behavior: 'smooth' });
|
|
8
|
+
};
|
|
9
9
|
};
|
|
@@ -6,8 +6,6 @@ import dataPingService from '../mockedData/pingService.json';
|
|
|
6
6
|
import dataPingServiceMixedStacked from '../mockedData/pingServiceMixedStacked.json';
|
|
7
7
|
import dataPingServiceStacked from '../mockedData/pingServiceStacked.json';
|
|
8
8
|
|
|
9
|
-
import { ClickAwayListener } from '@mui/material';
|
|
10
|
-
import { useState } from 'react';
|
|
11
9
|
import BarChart from './BarChart';
|
|
12
10
|
|
|
13
11
|
const meta: Meta<typeof BarChart> = {
|
|
@@ -261,43 +259,4 @@ export const mixedStackedMinMax: Story = {
|
|
|
261
259
|
max: 20
|
|
262
260
|
},
|
|
263
261
|
render: Template
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
const LegendSecondaryClick = (args) => {
|
|
267
|
-
const [position, setPosition] = useState<Array<[number, number]> | null>(
|
|
268
|
-
null
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
return (
|
|
272
|
-
<>
|
|
273
|
-
<Template
|
|
274
|
-
{...args}
|
|
275
|
-
legend={{
|
|
276
|
-
secondaryClick: ({ position }) => setPosition(position)
|
|
277
|
-
}}
|
|
278
|
-
/>
|
|
279
|
-
{position && (
|
|
280
|
-
<ClickAwayListener onClickAway={() => setPosition(null)}>
|
|
281
|
-
<div
|
|
282
|
-
className="absolute py-1 px-2 rounded-sm bg-background-widget shadow-md"
|
|
283
|
-
style={{ left: position?.[0], top: position?.[1] }}
|
|
284
|
-
open={Boolean(position)}
|
|
285
|
-
onClose={() => setPosition(null)}
|
|
286
|
-
>
|
|
287
|
-
menu
|
|
288
|
-
</div>
|
|
289
|
-
</ClickAwayListener>
|
|
290
|
-
)}
|
|
291
|
-
</>
|
|
292
|
-
);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export const withLegendSecondaryClick: Story = {
|
|
296
|
-
args: defaultArgs,
|
|
297
|
-
render: (args) => (
|
|
298
|
-
<LegendSecondaryClick
|
|
299
|
-
{...args}
|
|
300
|
-
data={dataPingService as unknown as LineChartData}
|
|
301
|
-
/>
|
|
302
|
-
)
|
|
303
|
-
};
|
|
262
|
+
};
|
|
@@ -196,8 +196,7 @@ const ResponsiveBarChart = ({
|
|
|
196
196
|
displayLegend,
|
|
197
197
|
mode: legend?.mode,
|
|
198
198
|
placement: legend?.placement,
|
|
199
|
-
renderExtraComponent: legend?.renderExtraComponent
|
|
200
|
-
secondaryClick: legend?.secondaryClick
|
|
199
|
+
renderExtraComponent: legend?.renderExtraComponent
|
|
201
200
|
}}
|
|
202
201
|
legendRef={legendRef}
|
|
203
202
|
limitLegend={limitLegend}
|
|
@@ -180,7 +180,7 @@ describe('Line chart', () => {
|
|
|
180
180
|
cy.contains('06/18/2023').should('be.visible');
|
|
181
181
|
|
|
182
182
|
cy.contains('0.4 s').should('be.visible');
|
|
183
|
-
|
|
183
|
+
cy.contains('75.64%').should('be.visible');
|
|
184
184
|
|
|
185
185
|
cy.makeSnapshot();
|
|
186
186
|
});
|
|
@@ -532,7 +532,7 @@ describe('Line chart', () => {
|
|
|
532
532
|
|
|
533
533
|
checkGraphWidth();
|
|
534
534
|
cy.contains(':00 AM').should('be.visible');
|
|
535
|
-
cy.get('circle[cx="
|
|
535
|
+
cy.get('circle[cx="250.83333333333334"]').should('be.visible');
|
|
536
536
|
cy.get('circle[cy="251.79089393069725"]').should('be.visible');
|
|
537
537
|
|
|
538
538
|
cy.makeSnapshot();
|
|
@@ -591,7 +591,7 @@ describe('Line chart', () => {
|
|
|
591
591
|
cy.get('path.visx-area-closed')
|
|
592
592
|
.should('have.attr', 'stroke-dasharray')
|
|
593
593
|
.and('equals', '5 4');
|
|
594
|
-
cy.get('circle[cx="33.
|
|
594
|
+
cy.get('circle[cx="33.44444444444444"]').should('be.visible');
|
|
595
595
|
|
|
596
596
|
cy.makeSnapshot();
|
|
597
597
|
});
|
|
@@ -746,11 +746,9 @@ describe('Lines and bars', () => {
|
|
|
746
746
|
|
|
747
747
|
checkGraphWidth();
|
|
748
748
|
|
|
749
|
-
cy.get(
|
|
750
|
-
'path[d="M7.501377410468319,350.5553648585503 h56.51239669421488 h1v1 v23.44463514144968 a1,1 0 0 1 -1,1 h-56.51239669421488 a1,1 0 0 1 -1,-1 v-23.44463514144968 v-1h1z"]'
|
|
749
|
+
cy.get('path[d="M7.501377410468319,350.5553648585503 h56.51239669421488 h1v1 v23.44463514144968 a1,1 0 0 1 -1,1 h-56.51239669421488 a1,1 0 0 1 -1,-1 v-23.44463514144968 v-1h1z"]'
|
|
751
750
|
).should('be.visible');
|
|
752
|
-
cy.get(
|
|
753
|
-
'path[d="M24.05509641873278,201.58170928199803 h23.404958677685954 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,17.553719008264462 v113.86621756002336 v17.553719008264462h-17.553719008264462 h-23.404958677685954 h-17.553719008264462v-17.553719008264462 v-113.86621756002336 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,-17.553719008264462z"]'
|
|
751
|
+
cy.get('path[d="M24.05509641873278,201.58170928199803 h23.404958677685954 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,17.553719008264462 v113.86621756002336 v17.553719008264462h-17.553719008264462 h-23.404958677685954 h-17.553719008264462v-17.553719008264462 v-113.86621756002336 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,-17.553719008264462z"]'
|
|
754
752
|
).should('be.visible');
|
|
755
753
|
|
|
756
754
|
cy.makeSnapshot();
|
|
@@ -816,21 +814,4 @@ describe('Lines and bars', () => {
|
|
|
816
814
|
|
|
817
815
|
cy.makeSnapshot();
|
|
818
816
|
});
|
|
819
|
-
|
|
820
|
-
it('calls the secondary function when a metric is clicked in the legend', () => {
|
|
821
|
-
const secondaryClick = cy.stub().as('secondaryClick');
|
|
822
|
-
initialize({
|
|
823
|
-
data: dataPingServiceLines,
|
|
824
|
-
legend: {
|
|
825
|
-
mode: 'grid',
|
|
826
|
-
placement: 'bottom',
|
|
827
|
-
secondaryClick
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
checkGraphWidth();
|
|
832
|
-
|
|
833
|
-
cy.contains('Packet Loss').rightclick();
|
|
834
|
-
cy.get('@secondaryClick').should('have.been.called');
|
|
835
|
-
});
|
|
836
817
|
});
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
|
|
5
|
-
import { Button
|
|
5
|
+
import { Button } from '@mui/material';
|
|
6
6
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
7
7
|
import Switch from '@mui/material/Switch';
|
|
8
8
|
import Tooltip from '@mui/material/Tooltip';
|
|
@@ -758,36 +758,3 @@ export const linesAndBarsMinMaxForUnit: Story = {
|
|
|
758
758
|
/>
|
|
759
759
|
)
|
|
760
760
|
};
|
|
761
|
-
|
|
762
|
-
const LegendSecondaryClick = (args) => {
|
|
763
|
-
const [anchor, setAnchor] = useState<EventTarget | null>(null);
|
|
764
|
-
|
|
765
|
-
return (
|
|
766
|
-
<>
|
|
767
|
-
<WrapperChart
|
|
768
|
-
{...args}
|
|
769
|
-
legend={{
|
|
770
|
-
secondaryClick: ({ element }) => setAnchor(element)
|
|
771
|
-
}}
|
|
772
|
-
/>
|
|
773
|
-
<Menu
|
|
774
|
-
anchorEl={anchor}
|
|
775
|
-
open={Boolean(anchor)}
|
|
776
|
-
onClose={() => setAnchor(null)}
|
|
777
|
-
>
|
|
778
|
-
menu
|
|
779
|
-
</Menu>
|
|
780
|
-
</>
|
|
781
|
-
);
|
|
782
|
-
};
|
|
783
|
-
|
|
784
|
-
export const withLegendSecondaryClick: Story = {
|
|
785
|
-
argTypes,
|
|
786
|
-
args: argumentsData,
|
|
787
|
-
render: (args) => (
|
|
788
|
-
<LegendSecondaryClick
|
|
789
|
-
{...args}
|
|
790
|
-
data={dataPingService as unknown as LineChartData}
|
|
791
|
-
/>
|
|
792
|
-
)
|
|
793
|
-
};
|
|
@@ -277,8 +277,7 @@ const Chart = ({
|
|
|
277
277
|
legendHeight: legend?.height,
|
|
278
278
|
mode: legend?.mode,
|
|
279
279
|
placement: legend?.placement,
|
|
280
|
-
renderExtraComponent: legend?.renderExtraComponent
|
|
281
|
-
secondaryClick: legend?.secondaryClick
|
|
280
|
+
renderExtraComponent: legend?.renderExtraComponent
|
|
282
281
|
}}
|
|
283
282
|
legendRef={legendRef}
|
|
284
283
|
limitLegend={limitLegend}
|
|
@@ -395,4 +394,4 @@ const Chart = ({
|
|
|
395
394
|
);
|
|
396
395
|
};
|
|
397
396
|
|
|
398
|
-
export default Chart;
|
|
397
|
+
export default Chart;
|
|
@@ -26,11 +26,6 @@ interface Props extends Pick<LegendModel, 'placement' | 'mode'> {
|
|
|
26
26
|
setLinesGraph: Dispatch<SetStateAction<Array<Line> | null>>;
|
|
27
27
|
shouldDisplayLegendInCompactMode: boolean;
|
|
28
28
|
toggable?: boolean;
|
|
29
|
-
secondaryClick?: (props: {
|
|
30
|
-
element: EventTarget | null;
|
|
31
|
-
metricId: number | string;
|
|
32
|
-
position: [number, number];
|
|
33
|
-
}) => void;
|
|
34
29
|
}
|
|
35
30
|
|
|
36
31
|
const MainLegend = ({
|
|
@@ -43,8 +38,7 @@ const MainLegend = ({
|
|
|
43
38
|
shouldDisplayLegendInCompactMode,
|
|
44
39
|
placement,
|
|
45
40
|
height,
|
|
46
|
-
mode
|
|
47
|
-
secondaryClick
|
|
41
|
+
mode
|
|
48
42
|
}: Props): JSX.Element => {
|
|
49
43
|
const { classes, cx } = useStyles({
|
|
50
44
|
limitLegendRows: Boolean(limitLegend),
|
|
@@ -71,24 +65,7 @@ const MainLegend = ({
|
|
|
71
65
|
value
|
|
72
66
|
}) || 'N/A';
|
|
73
67
|
|
|
74
|
-
const
|
|
75
|
-
(metricId: number) =>
|
|
76
|
-
(event: MouseEvent): void => {
|
|
77
|
-
if (!secondaryClick) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
secondaryClick({
|
|
82
|
-
element: event.target,
|
|
83
|
-
metricId,
|
|
84
|
-
position: [event.pageX, event.pageY]
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const selectMetric = ({
|
|
89
|
-
event,
|
|
90
|
-
metric_id
|
|
91
|
-
}: { event: MouseEvent; metric_id: number }): void => {
|
|
68
|
+
const selectMetric = ({ event, metric_id }): void => {
|
|
92
69
|
if (!toggable) {
|
|
93
70
|
return;
|
|
94
71
|
}
|
|
@@ -150,7 +127,6 @@ const MainLegend = ({
|
|
|
150
127
|
onClick={(event): void => selectMetric({ event, metric_id })}
|
|
151
128
|
onMouseEnter={(): void => highlightLine(metric_id)}
|
|
152
129
|
onMouseLeave={(): void => clearHighlight()}
|
|
153
|
-
onContextMenu={contextMenuClick(metric_id)}
|
|
154
130
|
>
|
|
155
131
|
<LegendHeader
|
|
156
132
|
color={markerColor}
|
|
@@ -175,11 +175,6 @@ export interface LegendModel {
|
|
|
175
175
|
mode: 'grid' | 'list';
|
|
176
176
|
placement: 'bottom' | 'left' | 'right';
|
|
177
177
|
renderExtraComponent?: ReactNode;
|
|
178
|
-
secondaryClick?: (props: {
|
|
179
|
-
element: EventTarget | null;
|
|
180
|
-
metricId: number | string;
|
|
181
|
-
position: [number, number];
|
|
182
|
-
}) => void;
|
|
183
178
|
}
|
|
184
179
|
|
|
185
180
|
export interface GetDate {
|
|
@@ -198,4 +193,4 @@ export interface GraphTooltipData {
|
|
|
198
193
|
unit: string;
|
|
199
194
|
value: number;
|
|
200
195
|
}>;
|
|
201
|
-
}
|
|
196
|
+
}
|
|
@@ -19,10 +19,7 @@ interface Props {
|
|
|
19
19
|
header?: LineChartHeader;
|
|
20
20
|
height: number | null;
|
|
21
21
|
isHorizontal?: boolean;
|
|
22
|
-
legend: Pick<
|
|
23
|
-
LegendModel,
|
|
24
|
-
'renderExtraComponent' | 'placement' | 'mode' | 'secondaryClick'
|
|
25
|
-
> & {
|
|
22
|
+
legend: Pick<LegendModel, 'renderExtraComponent' | 'placement' | 'mode'> & {
|
|
26
23
|
displayLegend: boolean;
|
|
27
24
|
legendHeight?: number;
|
|
28
25
|
};
|
|
@@ -104,7 +101,6 @@ const BaseChart = ({
|
|
|
104
101
|
shouldDisplayLegendInCompactMode={
|
|
105
102
|
shouldDisplayLegendInCompactMode
|
|
106
103
|
}
|
|
107
|
-
secondaryClick={legend?.secondaryClick}
|
|
108
104
|
/>
|
|
109
105
|
</div>
|
|
110
106
|
)}
|
|
@@ -126,7 +122,6 @@ const BaseChart = ({
|
|
|
126
122
|
renderExtraComponent={legend.renderExtraComponent}
|
|
127
123
|
setLinesGraph={setLines}
|
|
128
124
|
shouldDisplayLegendInCompactMode={shouldDisplayLegendInCompactMode}
|
|
129
|
-
secondaryClick={legend?.secondaryClick}
|
|
130
125
|
/>
|
|
131
126
|
</div>
|
|
132
127
|
)}
|
|
@@ -593,15 +593,15 @@ const getYScalePerUnit = ({
|
|
|
593
593
|
return scalePerUnit;
|
|
594
594
|
};
|
|
595
595
|
|
|
596
|
-
const formatTime = (
|
|
597
|
-
return `${numeral(value).format('0.[00]a')}
|
|
596
|
+
const formatTime = (value: number): string => {
|
|
597
|
+
return `${numeral(value).format('0.[00]a')} ms`;
|
|
598
598
|
};
|
|
599
599
|
|
|
600
600
|
const registerMsUnitToNumeral = (): null => {
|
|
601
601
|
try {
|
|
602
602
|
numeral.register('format', 'milliseconds', {
|
|
603
603
|
format: (value) => {
|
|
604
|
-
return formatTime(
|
|
604
|
+
return formatTime(value);
|
|
605
605
|
},
|
|
606
606
|
regexps: {
|
|
607
607
|
format: /(ms)/,
|
|
@@ -618,27 +618,6 @@ const registerMsUnitToNumeral = (): null => {
|
|
|
618
618
|
|
|
619
619
|
registerMsUnitToNumeral();
|
|
620
620
|
|
|
621
|
-
const registerSecondsUnitToNumeral = (): null => {
|
|
622
|
-
try {
|
|
623
|
-
numeral.register('format', 'seconds', {
|
|
624
|
-
format: (value) => {
|
|
625
|
-
return formatTime({ value, unit: 's' });
|
|
626
|
-
},
|
|
627
|
-
regexps: {
|
|
628
|
-
format: /(s)/,
|
|
629
|
-
unformat: /(s)/
|
|
630
|
-
},
|
|
631
|
-
unformat: () => ''
|
|
632
|
-
});
|
|
633
|
-
|
|
634
|
-
return null;
|
|
635
|
-
} catch (_) {
|
|
636
|
-
return null;
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
|
|
640
|
-
registerSecondsUnitToNumeral();
|
|
641
|
-
|
|
642
621
|
const getBase1024 = ({ unit, base }): boolean => {
|
|
643
622
|
const base2Units = [
|
|
644
623
|
'B',
|
|
@@ -668,7 +647,6 @@ const formatMetricValue = ({
|
|
|
668
647
|
|
|
669
648
|
const formatSuffix = cond([
|
|
670
649
|
[equals('ms'), always(' ms')],
|
|
671
|
-
[equals('s'), always(' s')],
|
|
672
650
|
[T, always(base1024 ? ' ib' : 'a')]
|
|
673
651
|
])(unit);
|
|
674
652
|
|
|
@@ -693,6 +671,8 @@ const formatMetricValueWithUnit = ({
|
|
|
693
671
|
return null;
|
|
694
672
|
}
|
|
695
673
|
|
|
674
|
+
const base1024 = getBase1024({ base, unit });
|
|
675
|
+
|
|
696
676
|
if (isRaw) {
|
|
697
677
|
const unitText = equals('%', unit) ? unit : ` ${unit}`;
|
|
698
678
|
|
|
@@ -705,7 +685,9 @@ const formatMetricValueWithUnit = ({
|
|
|
705
685
|
|
|
706
686
|
const formattedMetricValue = formatMetricValue({ base, unit, value });
|
|
707
687
|
|
|
708
|
-
return
|
|
688
|
+
return base1024 || !unit || equals(unit, 'ms')
|
|
689
|
+
? formattedMetricValue
|
|
690
|
+
: `${formattedMetricValue} ${unit}`;
|
|
709
691
|
};
|
|
710
692
|
|
|
711
693
|
const bisectDate = bisector(identity).center;
|
|
@@ -784,4 +766,4 @@ export {
|
|
|
784
766
|
formatMetricValueWithUnit,
|
|
785
767
|
getYScaleUnit,
|
|
786
768
|
getYScalePerUnit
|
|
787
|
-
};
|
|
769
|
+
};
|
|
@@ -25,7 +25,7 @@ import { BarStyle } from '../BarChart/models';
|
|
|
25
25
|
import { margin } from '../Chart/common';
|
|
26
26
|
import { LineStyle } from '../Chart/models';
|
|
27
27
|
import { Threshold, Thresholds } from './models';
|
|
28
|
-
import {
|
|
28
|
+
import { formatMetricValue } from './timeSeries';
|
|
29
29
|
import { Line, TimeValue } from './timeSeries/models';
|
|
30
30
|
|
|
31
31
|
interface GetColorFromDataAndThresholdsProps {
|
|
@@ -234,7 +234,7 @@ export const getFormattedAxisValues = ({
|
|
|
234
234
|
|
|
235
235
|
const formattedData = metricIds.map((metricId) =>
|
|
236
236
|
timeSeries.map((data) =>
|
|
237
|
-
|
|
237
|
+
formatMetricValue({
|
|
238
238
|
value: data[metricId],
|
|
239
239
|
unit: axisUnit,
|
|
240
240
|
base
|
|
@@ -246,7 +246,7 @@ export const getFormattedAxisValues = ({
|
|
|
246
246
|
|
|
247
247
|
const formattedThresholdValues = equals(thresholdUnit, axisUnit)
|
|
248
248
|
? threshold.map(({ value }) =>
|
|
249
|
-
|
|
249
|
+
formatMetricValue({
|
|
250
250
|
value,
|
|
251
251
|
unit: axisUnit,
|
|
252
252
|
base
|
|
@@ -273,11 +273,5 @@ export const computeGElementMarginLeft = ({
|
|
|
273
273
|
export const computPixelsToShiftMouse = (xScale): number => {
|
|
274
274
|
const domain = xScale.domain();
|
|
275
275
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (!hoursDiffInGraph) {
|
|
279
|
-
return 0;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return Math.round(8 / hoursDiffInGraph);
|
|
276
|
+
return Math.round(8 / dayjs(domain[1]).diff(domain[0], 'h'));
|
|
283
277
|
};
|
|
@@ -96,6 +96,7 @@ const SelectField = ({
|
|
|
96
96
|
fullWidth={fullWidth}
|
|
97
97
|
size="small"
|
|
98
98
|
{...formControlProps}
|
|
99
|
+
|
|
99
100
|
>
|
|
100
101
|
{label && <InputLabel>{label}</InputLabel>}
|
|
101
102
|
<Select
|
|
@@ -150,4 +151,4 @@ const SelectField = ({
|
|
|
150
151
|
);
|
|
151
152
|
};
|
|
152
153
|
|
|
153
|
-
export default SelectField;
|
|
154
|
+
export default SelectField;
|
package/src/Module/index.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import { Provider as JotaiProvider, createStore } from 'jotai';
|
|
|
3
3
|
|
|
4
4
|
import { StylesProvider, createGenerateClassName } from '@mui/styles';
|
|
5
5
|
|
|
6
|
-
import { ThemeOptions } from '@mui/material';
|
|
7
6
|
import { QueryProvider, ThemeProvider } from '..';
|
|
8
7
|
import SnackbarProvider from '../Snackbar/SnackbarProvider';
|
|
9
8
|
|
|
@@ -13,10 +12,6 @@ export interface ModuleProps {
|
|
|
13
12
|
queryClient?: QueryClient;
|
|
14
13
|
seedName: string;
|
|
15
14
|
store: ReturnType<typeof createStore>;
|
|
16
|
-
overrideTheme?: {
|
|
17
|
-
light: Partial<ThemeOptions>;
|
|
18
|
-
dark: Partial<ThemeOptions>;
|
|
19
|
-
};
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
const Module = ({
|
|
@@ -24,8 +19,7 @@ const Module = ({
|
|
|
24
19
|
seedName,
|
|
25
20
|
maxSnackbars = 3,
|
|
26
21
|
store,
|
|
27
|
-
queryClient
|
|
28
|
-
overrideTheme
|
|
22
|
+
queryClient
|
|
29
23
|
}: ModuleProps): JSX.Element => {
|
|
30
24
|
const generateClassName = createGenerateClassName({
|
|
31
25
|
seed: seedName
|
|
@@ -35,7 +29,7 @@ const Module = ({
|
|
|
35
29
|
<QueryProvider queryClient={queryClient}>
|
|
36
30
|
<JotaiProvider store={store}>
|
|
37
31
|
<StylesProvider generateClassName={generateClassName}>
|
|
38
|
-
<ThemeProvider
|
|
32
|
+
<ThemeProvider>
|
|
39
33
|
<SnackbarProvider maxSnackbars={maxSnackbars}>
|
|
40
34
|
{children}
|
|
41
35
|
</SnackbarProvider>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useAtomValue } from 'jotai';
|
|
2
|
-
import { equals
|
|
2
|
+
import { equals } 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,
|
|
10
9
|
StyledEngineProvider,
|
|
11
10
|
Theme,
|
|
12
11
|
createTheme
|
|
@@ -148,6 +147,46 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
148
147
|
},
|
|
149
148
|
MuiCssBaseline: {
|
|
150
149
|
styleOverrides: (theme) => `
|
|
150
|
+
::-webkit-scrollbar {
|
|
151
|
+
height: ${theme.spacing(1)};
|
|
152
|
+
width: ${theme.spacing(1)};
|
|
153
|
+
background-color: transparent;
|
|
154
|
+
}
|
|
155
|
+
::-webkit-scrollbar-thumb {
|
|
156
|
+
background-color: ${
|
|
157
|
+
equals(mode, 'dark')
|
|
158
|
+
? theme.palette.divider
|
|
159
|
+
: theme.palette.text.disabled
|
|
160
|
+
};
|
|
161
|
+
border-radius: ${theme.spacing(0.5)};
|
|
162
|
+
}
|
|
163
|
+
::-webkit-scrollbar-thumb:hover {
|
|
164
|
+
background-color: ${theme.palette.primary.main};
|
|
165
|
+
}
|
|
166
|
+
* {
|
|
167
|
+
scrollbar-color: ${
|
|
168
|
+
equals(mode, 'dark')
|
|
169
|
+
? theme.palette.divider
|
|
170
|
+
: theme.palette.text.disabled
|
|
171
|
+
} ${theme.palette.background.default};
|
|
172
|
+
scrollbar-width: thin;
|
|
173
|
+
}
|
|
174
|
+
html {
|
|
175
|
+
margin: 0;
|
|
176
|
+
padding: 0;
|
|
177
|
+
width: 100%;
|
|
178
|
+
height: 100%;
|
|
179
|
+
text-rendering: optimizeLegibility;
|
|
180
|
+
}
|
|
181
|
+
body {
|
|
182
|
+
background-color: ${theme.palette.background.paper};
|
|
183
|
+
height: 100%;
|
|
184
|
+
padding: 0;
|
|
185
|
+
width: 100%;
|
|
186
|
+
}
|
|
187
|
+
#root {
|
|
188
|
+
background-color: ${theme.palette.background.paper};
|
|
189
|
+
}
|
|
151
190
|
@font-face {
|
|
152
191
|
font-family: 'Roboto';
|
|
153
192
|
font-style: normal;
|
|
@@ -172,9 +211,6 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
172
211
|
font-weight: 700;
|
|
173
212
|
src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
|
|
174
213
|
}
|
|
175
|
-
body {
|
|
176
|
-
background-color: ${theme.palette.background.paper};
|
|
177
|
-
}
|
|
178
214
|
`
|
|
179
215
|
},
|
|
180
216
|
MuiInputBase: {
|
|
@@ -258,23 +294,15 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
258
294
|
|
|
259
295
|
interface Props {
|
|
260
296
|
children: ReactNode;
|
|
261
|
-
overrideTheme?: {
|
|
262
|
-
light: Partial<PaletteOptions>;
|
|
263
|
-
dark: Partial<PaletteOptions>;
|
|
264
|
-
};
|
|
265
297
|
}
|
|
266
298
|
|
|
267
|
-
const ThemeProvider = ({ children
|
|
299
|
+
const ThemeProvider = ({ children }: Props): JSX.Element => {
|
|
268
300
|
const { themeMode } = useAtomValue(userAtom);
|
|
269
301
|
|
|
270
|
-
const theme = useMemo(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
palette: overrideThemeByMode || {}
|
|
275
|
-
})
|
|
276
|
-
);
|
|
277
|
-
}, [themeMode, overrideTheme]);
|
|
302
|
+
const theme = useMemo(
|
|
303
|
+
() => createTheme(getTheme(themeMode || ThemeMode.light)),
|
|
304
|
+
[themeMode]
|
|
305
|
+
);
|
|
278
306
|
|
|
279
307
|
return (
|
|
280
308
|
<StyledEngineProvider injectFirst enableCssLayer>
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
|
-
@import "./base.css"; /* Base styles: scrollbar, html, body, #root */
|
|
3
2
|
|
|
4
3
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
5
4
|
|
|
6
5
|
@theme {
|
|
7
|
-
/* Typography */
|
|
8
6
|
--font-body: Roboto, Arial, serif;
|
|
9
7
|
|
|
10
|
-
/* Spacing system */
|
|
11
8
|
--spacing: 4px;
|
|
12
9
|
|
|
13
10
|
--spacing-0: calc(var(--spacing) * 0);
|
|
@@ -22,11 +19,6 @@
|
|
|
22
19
|
--spacing-9: calc(var(--spacing) * 9);
|
|
23
20
|
--spacing-10: calc(var(--spacing) * 10);
|
|
24
21
|
|
|
25
|
-
/* =============
|
|
26
|
-
COLOR SYSTEM
|
|
27
|
-
============= */
|
|
28
|
-
|
|
29
|
-
/* Action colors */
|
|
30
22
|
--color-action-acknowledged: #745f35;
|
|
31
23
|
--color-action-acknowledged-background: #dfd2b9;
|
|
32
24
|
--color-action-in-flapping: #064a3f;
|
|
@@ -43,8 +35,6 @@
|
|
|
43
35
|
--color-action-in-downtime-background: #e5d8f3;
|
|
44
36
|
--color-action-selected: rgba(102, 102, 102, 0.3);
|
|
45
37
|
--color-action-selected-opacity: 0.3;
|
|
46
|
-
|
|
47
|
-
/* Background colors */
|
|
48
38
|
--color-background-default: #f4f4f4;
|
|
49
39
|
--color-background-listing-header: #666666;
|
|
50
40
|
--color-background-panel: #ededed;
|
|
@@ -52,19 +42,13 @@
|
|
|
52
42
|
--color-background-paper: #ffffff;
|
|
53
43
|
--color-background-tooltip: #434e58;
|
|
54
44
|
--color-background-widget: #f8f8f8;
|
|
55
|
-
|
|
56
|
-
/* Chip colors */
|
|
57
45
|
--color-chip-error: #ff6666;
|
|
58
46
|
--color-chip-info: #1588d1;
|
|
59
47
|
--color-chip-neutral: #6da4e4;
|
|
60
48
|
--color-chip-success: #88b922;
|
|
61
49
|
--color-chip-warning: #fd9b27;
|
|
62
|
-
|
|
63
|
-
/* Utility colors */
|
|
64
50
|
--color-divider: #e3e3e3;
|
|
65
51
|
--color-error-main: #ff4a4a;
|
|
66
|
-
|
|
67
|
-
/* Header colors */
|
|
68
52
|
--color-header-page-action-background-active: #1975d10f;
|
|
69
53
|
--color-header-page-action-background-default: #ffffff00;
|
|
70
54
|
--color-header-page-action-color-active: #1976d2;
|
|
@@ -90,19 +74,13 @@
|
|
|
90
74
|
--color-header-menu-item-color-active: #3e85d5;
|
|
91
75
|
--color-header-menu-item-color-default: #1b2127;
|
|
92
76
|
--color-header-menu-item-color-hover: #101418;
|
|
93
|
-
|
|
94
|
-
/* State colors */
|
|
95
77
|
--color-pending-main: #1ebeb3;
|
|
96
|
-
|
|
97
|
-
/* Primary & Secondary colors */
|
|
98
78
|
--color-primary-main: #2e68aa;
|
|
99
79
|
--color-primary-light: #cde7fc;
|
|
100
80
|
--color-primary-dark: #255891;
|
|
101
81
|
--color-secondary-main: #c772d6;
|
|
102
82
|
--color-secondary-light: #e5a5f0;
|
|
103
83
|
--color-secondary-dark: #ac28c1;
|
|
104
|
-
|
|
105
|
-
/* Status colors */
|
|
106
84
|
--color-status-background-error: #ff6666;
|
|
107
85
|
--color-status-background-none: --alpha(#2e68aa / 10%);
|
|
108
86
|
--color-status-background-pending: #1ebeb3;
|
|
@@ -110,16 +88,12 @@
|
|
|
110
88
|
--color-stauts-background-unknown: #e3e3e3;
|
|
111
89
|
--color-status-background-warning: #fd9b27;
|
|
112
90
|
--color-success-main: #88b922;
|
|
113
|
-
|
|
114
|
-
/* Text colors */
|
|
115
91
|
--color-text-disabled: #999999;
|
|
116
92
|
--color-text-primary: #000000;
|
|
117
93
|
--color-text-secondary: #666666;
|
|
118
94
|
--color-warning-main: #fd9b27;
|
|
119
95
|
--color-warning-light: #fcc481;
|
|
120
96
|
--color-warning-dark: #fc7e00;
|
|
121
|
-
|
|
122
|
-
/* Base colors */
|
|
123
97
|
--color-white: #ffffff;
|
|
124
98
|
--color-black: #000000;
|
|
125
99
|
}
|
|
@@ -36,7 +36,6 @@ interface UseMetricsQueryProps {
|
|
|
36
36
|
start?: string | null;
|
|
37
37
|
timePeriodType: number;
|
|
38
38
|
};
|
|
39
|
-
isEnabled?: boolean;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
interface UseMetricsQueryState {
|
|
@@ -102,8 +101,7 @@ const useGraphQuery = ({
|
|
|
102
101
|
refreshInterval = false,
|
|
103
102
|
refreshCount,
|
|
104
103
|
bypassQueryParams = false,
|
|
105
|
-
prefix
|
|
106
|
-
isEnabled = true
|
|
104
|
+
prefix
|
|
107
105
|
}: UseMetricsQueryProps): UseMetricsQueryState => {
|
|
108
106
|
const timePeriodToUse = equals(timePeriod?.timePeriodType, -1)
|
|
109
107
|
? {
|
|
@@ -160,10 +158,7 @@ const useGraphQuery = ({
|
|
|
160
158
|
refreshCount || 0
|
|
161
159
|
],
|
|
162
160
|
queryOptions: {
|
|
163
|
-
enabled:
|
|
164
|
-
areResourcesFullfilled(resources) &&
|
|
165
|
-
!isEmpty(definedMetrics) &&
|
|
166
|
-
isEnabled,
|
|
161
|
+
enabled: areResourcesFullfilled(resources) && !isEmpty(definedMetrics),
|
|
167
162
|
refetchInterval: refreshInterval,
|
|
168
163
|
suspense: false
|
|
169
164
|
},
|
|
@@ -16,11 +16,7 @@ const ModalHeader = ({
|
|
|
16
16
|
}: ModalHeaderProps & DialogTitleProps): ReactElement => {
|
|
17
17
|
return (
|
|
18
18
|
<div className={modalHeader}>
|
|
19
|
-
<MuiDialogTitle
|
|
20
|
-
className="p-0 font-bold text-2xl"
|
|
21
|
-
color="primary"
|
|
22
|
-
{...rest}
|
|
23
|
-
>
|
|
19
|
+
<MuiDialogTitle className="p-0 font-bold text-2xl" color="primary" {...rest}>
|
|
24
20
|
{children}
|
|
25
21
|
</MuiDialogTitle>
|
|
26
22
|
</div>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
@layer base {
|
|
2
|
-
::-webkit-scrollbar {
|
|
3
|
-
height: var(--spacing-2);
|
|
4
|
-
width: var(--spacing-2);
|
|
5
|
-
background-color: transparent;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
::-webkit-scrollbar-thumb {
|
|
9
|
-
background-color: var(--color-text-disabled);
|
|
10
|
-
border-radius: var(--spacing-1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
::-webkit-scrollbar-thumb:hover {
|
|
14
|
-
background-color: var(--color-primary-main);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
* {
|
|
18
|
-
scrollbar-color: var(--color-text-disabled) var(--color-background-default);
|
|
19
|
-
scrollbar-width: thin;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
html {
|
|
23
|
-
margin: 0;
|
|
24
|
-
padding: 0;
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
text-rendering: optimizeLegibility;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
body {
|
|
31
|
-
background-color: var(--color-background-paper);
|
|
32
|
-
height: 100%;
|
|
33
|
-
padding: 0;
|
|
34
|
-
width: 100%;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
#root {
|
|
38
|
-
background-color: var(--color-background-paper) !important;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@variant dark {
|
|
42
|
-
::-webkit-scrollbar-thumb {
|
|
43
|
-
background-color: var(--color-divider);
|
|
44
|
-
}
|
|
45
|
-
* {
|
|
46
|
-
scrollbar-color: var(--color-divider) var(--color-background-default);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|