@scality/core-ui 0.166.0 → 0.167.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/.storybook/preview.js +6 -4
- package/README.md +27 -80
- package/dist/components/barchart/BarChart.component.d.ts +5 -0
- package/dist/components/barchart/BarChart.component.d.ts.map +1 -1
- package/dist/components/barchart/BarChart.component.js +5 -0
- package/dist/components/button/Button.component.d.ts +2 -1
- package/dist/components/button/Button.component.d.ts.map +1 -1
- package/dist/components/button/Button.component.js +2 -1
- package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegend.js +7 -13
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +1 -2
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegendWrapper.js +4 -9
- package/dist/components/icon/Icon.component.d.ts +9 -11
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +2 -0
- package/dist/components/linetemporalchart/ChartUtil.d.ts +3 -2
- package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -1
- package/dist/components/linetemporalchart/ChartUtil.js +24 -20
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts +4 -0
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts.map +1 -1
- package/dist/components/linetemporalchart/LineTemporalChart.component.js +4 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/index.d.ts +1 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -11
- package/dist/next.d.ts +1 -0
- package/dist/next.d.ts.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +16 -37
- package/src/lib/components/barchart/BarChart.component.tsx +5 -0
- package/src/lib/components/button/Button.component.tsx +2 -1
- package/src/lib/components/chartlegend/ChartLegend.test.tsx +17 -0
- package/src/lib/components/chartlegend/ChartLegend.tsx +6 -12
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +5 -13
- package/src/lib/components/icon/Icon.component.tsx +12 -1
- package/src/lib/components/linetemporalchart/ChartUtil.test.ts +23 -35
- package/src/lib/components/linetemporalchart/ChartUtil.ts +32 -26
- package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +19 -15
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +5 -5
- package/src/lib/components/selectv2/selectv2.test.tsx +1 -1
- package/src/lib/components/toast/useMutationsHandler.test.tsx +22 -32
- package/src/lib/index.ts +6 -11
- package/src/lib/next.ts +1 -0
- package/stories/barchart.stories.tsx +1 -1
- package/stories/card.stories.tsx +7 -5
- package/stories/controls.ts +19 -20
- package/stories/linecharttemporal.stories.tsx +1 -1
- package/stories/linetimeseriechart.stories.tsx +49 -0
- package/stories/navbar.stories.tsx +103 -0
- package/stories/tabsv2.stories.tsx +51 -56
- package/dist/components/areachart/AreaChart.component.d.ts +0 -13
- package/dist/components/areachart/AreaChart.component.d.ts.map +0 -1
- package/dist/components/areachart/AreaChart.component.js +0 -27
- package/dist/components/chips/Chips.component.d.ts +0 -21
- package/dist/components/chips/Chips.component.d.ts.map +0 -1
- package/dist/components/chips/Chips.component.js +0 -105
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts +0 -10
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts.map +0 -1
- package/dist/components/cloudprogressbar/CloudProgressBar.component.js +0 -38
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts +0 -9
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts.map +0 -1
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.js +0 -44
- package/dist/components/linechart/LineChart.component.d.ts +0 -21
- package/dist/components/linechart/LineChart.component.d.ts.map +0 -1
- package/dist/components/linechart/LineChart.component.js +0 -109
- package/dist/components/multiselect/MultiSelect.component.d.ts +0 -28
- package/dist/components/multiselect/MultiSelect.component.d.ts.map +0 -1
- package/dist/components/multiselect/MultiSelect.component.js +0 -73
- package/dist/components/select/Select.component.d.ts +0 -14
- package/dist/components/select/Select.component.d.ts.map +0 -1
- package/dist/components/select/Select.component.js +0 -71
- package/dist/components/spacedbox/SpacedBox.d.ts +0 -34
- package/dist/components/spacedbox/SpacedBox.d.ts.map +0 -1
- package/dist/components/spacedbox/SpacedBox.js +0 -64
- package/dist/components/sparkline/SparkLine.component.d.ts +0 -18
- package/dist/components/sparkline/SparkLine.component.d.ts.map +0 -1
- package/dist/components/sparkline/SparkLine.component.js +0 -148
- package/dist/components/vegachart/VegaChart.component.d.ts +0 -13
- package/dist/components/vegachart/VegaChart.component.d.ts.map +0 -1
- package/dist/components/vegachart/VegaChart.component.js +0 -120
- package/plopfile.js +0 -38
- package/src/lib/components/areachart/AreaChart.component.tsx +0 -49
- package/src/lib/components/chips/Chips.component.tsx +0 -169
- package/src/lib/components/cloudprogressbar/CloudProgressBar.component.tsx +0 -105
- package/src/lib/components/collapsiblepanel/CollapsiblePanel.component.tsx +0 -77
- package/src/lib/components/linechart/LineChart.component.tsx +0 -152
- package/src/lib/components/multiselect/MultiSelect.component.tsx +0 -158
- package/src/lib/components/select/Select.component.tsx +0 -98
- package/src/lib/components/spacedbox/SpacedBox.ts +0 -116
- package/src/lib/components/sparkline/SparkLine.component.tsx +0 -176
- package/src/lib/components/vegachart/VegaChart.component.tsx +0 -146
- package/stories/areachart.stories.tsx +0 -120
- package/stories/chips.stories.tsx +0 -107
- package/stories/cloudprogressbar.stories.tsx +0 -93
- package/stories/collapsiblepanel.stories.tsx +0 -57
- package/stories/data/areachart.ts +0 -122
- package/stories/data/sparklinechart.ts +0 -164
- package/stories/linechart.stories.tsx +0 -319
- package/stories/multiselect.stories.tsx +0 -126
- package/stories/select.stories.tsx +0 -52
- package/stories/sparkline.stories.tsx +0 -85
- package/stories/vegachart.stories.tsx +0 -98
|
@@ -91,8 +91,8 @@ const TooltipInstanceValue = styled.div`
|
|
|
91
91
|
export type Serie = {
|
|
92
92
|
// the name of the resource
|
|
93
93
|
resource: string;
|
|
94
|
-
// the original data format from prometheus
|
|
95
|
-
data: [number, string | null][];
|
|
94
|
+
// the original data format from prometheus, extend the value to include number type.
|
|
95
|
+
data: [number, number | string | null][];
|
|
96
96
|
// it's mandatory to display tooltip label in the tooltip
|
|
97
97
|
getTooltipLabel: (metricPrefix?: string, resource?: string) => string;
|
|
98
98
|
// the name of the metric prefix with read, write, in, out
|
|
@@ -259,7 +259,7 @@ export function LineTimeSerieChart({
|
|
|
259
259
|
// Initialize an object to hold data points by timestamp
|
|
260
260
|
const dataPointsByTime: Record<
|
|
261
261
|
number,
|
|
262
|
-
{ timestamp: number } & Record<string,
|
|
262
|
+
{ timestamp: number } & Record<string, number | null>
|
|
263
263
|
> = {};
|
|
264
264
|
const seriesToProcess =
|
|
265
265
|
yAxisType === 'symmetrical' && isSymmetricalSeries(normalizedSeries)
|
|
@@ -285,8 +285,8 @@ export function LineTimeSerieChart({
|
|
|
285
285
|
// Convert object to array for Recharts
|
|
286
286
|
return Object.values(dataPointsByTime).sort(
|
|
287
287
|
(
|
|
288
|
-
a: { timestamp: number } & Record<string,
|
|
289
|
-
b: { timestamp: number } & Record<string,
|
|
288
|
+
a: { timestamp: number } & Record<string, number | null>,
|
|
289
|
+
b: { timestamp: number } & Record<string, number | null>,
|
|
290
290
|
) => (a.timestamp as number) - (b.timestamp as number),
|
|
291
291
|
);
|
|
292
292
|
}, [series, startingTimeStamp, duration, interval, yAxisType]);
|
|
@@ -69,7 +69,7 @@ describe('SelectV2', () => {
|
|
|
69
69
|
it('should throw error if <Option/> is outside <Select/>', () => {
|
|
70
70
|
// mock console.error as this is the only way to silent expected error thrown by the component
|
|
71
71
|
const consoleErrorFn = jest.spyOn(console, 'error').mockImplementation(() => jest.fn());
|
|
72
|
-
expect(() => render(<Option value="Option 1" />)).
|
|
72
|
+
expect(() => render(<Option value="Option 1" />)).toThrow();
|
|
73
73
|
consoleErrorFn.mockRestore();
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderHook, waitFor } from '@testing-library/react';
|
|
2
2
|
import { useToast } from './ToastProvider';
|
|
3
3
|
import { useMutationsHandler } from './useMutationsHandler';
|
|
4
4
|
|
|
@@ -68,7 +68,7 @@ describe('useMutationsHandler', () => {
|
|
|
68
68
|
showToast,
|
|
69
69
|
}));
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
renderHook(() =>
|
|
72
72
|
useMutationsHandler({
|
|
73
73
|
mainMutation,
|
|
74
74
|
dependantMutations,
|
|
@@ -77,10 +77,8 @@ describe('useMutationsHandler', () => {
|
|
|
77
77
|
}),
|
|
78
78
|
);
|
|
79
79
|
|
|
80
|
-
await
|
|
81
|
-
|
|
82
|
-
expect(onMainMutationSuccess).toHaveBeenCalled();
|
|
83
|
-
});
|
|
80
|
+
await waitFor(() => {
|
|
81
|
+
expect(onMainMutationSuccess).toHaveBeenCalled();
|
|
84
82
|
});
|
|
85
83
|
});
|
|
86
84
|
|
|
@@ -91,7 +89,7 @@ describe('useMutationsHandler', () => {
|
|
|
91
89
|
showToast,
|
|
92
90
|
}));
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
renderHook(() =>
|
|
95
93
|
useMutationsHandler({
|
|
96
94
|
mainMutation,
|
|
97
95
|
dependantMutations,
|
|
@@ -99,13 +97,11 @@ describe('useMutationsHandler', () => {
|
|
|
99
97
|
}),
|
|
100
98
|
);
|
|
101
99
|
|
|
102
|
-
await
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
message: 'message',
|
|
108
|
-
});
|
|
100
|
+
await waitFor(() => {
|
|
101
|
+
expect(showToast).toHaveBeenCalledWith({
|
|
102
|
+
open: true,
|
|
103
|
+
status: 'success',
|
|
104
|
+
message: 'message',
|
|
109
105
|
});
|
|
110
106
|
});
|
|
111
107
|
});
|
|
@@ -131,7 +127,7 @@ describe('useMutationsHandler', () => {
|
|
|
131
127
|
},
|
|
132
128
|
] as const;
|
|
133
129
|
|
|
134
|
-
|
|
130
|
+
renderHook(() =>
|
|
135
131
|
useMutationsHandler({
|
|
136
132
|
mainMutation,
|
|
137
133
|
dependantMutations: mutationsWithError,
|
|
@@ -139,13 +135,11 @@ describe('useMutationsHandler', () => {
|
|
|
139
135
|
}),
|
|
140
136
|
);
|
|
141
137
|
|
|
142
|
-
await
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
message: 'message',
|
|
148
|
-
});
|
|
138
|
+
await waitFor(() => {
|
|
139
|
+
expect(showToast).toHaveBeenCalledWith({
|
|
140
|
+
open: true,
|
|
141
|
+
status: 'error',
|
|
142
|
+
message: 'message',
|
|
149
143
|
});
|
|
150
144
|
});
|
|
151
145
|
});
|
|
@@ -171,7 +165,7 @@ describe('useMutationsHandler', () => {
|
|
|
171
165
|
showToast,
|
|
172
166
|
}));
|
|
173
167
|
|
|
174
|
-
|
|
168
|
+
renderHook(() =>
|
|
175
169
|
useMutationsHandler({
|
|
176
170
|
mainMutation,
|
|
177
171
|
dependantMutations: otherMutations,
|
|
@@ -180,10 +174,8 @@ describe('useMutationsHandler', () => {
|
|
|
180
174
|
}),
|
|
181
175
|
);
|
|
182
176
|
|
|
183
|
-
await
|
|
184
|
-
|
|
185
|
-
expect(onAllMutationsSuccess).toHaveBeenCalled();
|
|
186
|
-
});
|
|
177
|
+
await waitFor(() => {
|
|
178
|
+
expect(onAllMutationsSuccess).toHaveBeenCalled();
|
|
187
179
|
});
|
|
188
180
|
});
|
|
189
181
|
|
|
@@ -220,7 +212,7 @@ describe('useMutationsHandler', () => {
|
|
|
220
212
|
showToast,
|
|
221
213
|
}));
|
|
222
214
|
|
|
223
|
-
|
|
215
|
+
renderHook(() =>
|
|
224
216
|
useMutationsHandler({
|
|
225
217
|
mainMutation: firstMutation,
|
|
226
218
|
dependantMutations: otherMutations,
|
|
@@ -229,10 +221,8 @@ describe('useMutationsHandler', () => {
|
|
|
229
221
|
}),
|
|
230
222
|
);
|
|
231
223
|
|
|
232
|
-
await
|
|
233
|
-
|
|
234
|
-
expect(onAllMutationsSuccess).not.toHaveBeenCalled();
|
|
235
|
-
});
|
|
224
|
+
await waitFor(() => {
|
|
225
|
+
expect(onAllMutationsSuccess).not.toHaveBeenCalled();
|
|
236
226
|
});
|
|
237
227
|
});
|
|
238
228
|
});
|
package/src/lib/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { Banner } from './components/banner/Banner.component';
|
|
2
2
|
export { Breadcrumb } from './components/breadcrumb/Breadcrumb.component';
|
|
3
|
-
export { Button } from './components/button/Button.component';
|
|
4
3
|
export { Checkbox } from './components/checkbox/Checkbox.component';
|
|
5
|
-
export { Chips } from './components/chips/Chips.component';
|
|
6
4
|
export { Dropdown } from './components/dropdown/Dropdown.component';
|
|
7
5
|
export {
|
|
8
6
|
LOADER_SIZE,
|
|
@@ -21,22 +19,18 @@ export { Modal } from './components/modal/Modal.component';
|
|
|
21
19
|
export { Navbar } from './components/navbar/Navbar.component';
|
|
22
20
|
export { Notifications } from './components/notifications/Notifications.component';
|
|
23
21
|
export { SearchInput } from './components/searchinput/SearchInput.component';
|
|
24
|
-
|
|
22
|
+
|
|
25
23
|
export { Sidebar } from './components/sidebar/Sidebar.component';
|
|
26
24
|
export { Steppers } from './components/steppers/Steppers.component';
|
|
27
25
|
export { Toggle } from './components/toggle/Toggle.component';
|
|
28
26
|
export { Tooltip } from './components/tooltip/Tooltip.component';
|
|
29
|
-
|
|
30
|
-
export { VegaChart } from './components/vegachart/VegaChart.component';
|
|
31
|
-
export { LineChart } from './components/linechart/LineChart.component';
|
|
27
|
+
|
|
32
28
|
export { ProgressBar } from './components/progressbar/ProgressBar.component';
|
|
33
29
|
export { TextArea } from './components/textarea/TextArea.component';
|
|
34
|
-
|
|
35
|
-
export { Sparkline } from './components/sparkline/SparkLine.component';
|
|
30
|
+
|
|
36
31
|
export { BarChart } from './components/barchart/BarChart.component';
|
|
37
32
|
export { CircularProgressBar } from './components/circularprogressbar/CircularProgressBar.component';
|
|
38
|
-
|
|
39
|
-
export { CollapsiblePanel } from './components/collapsiblepanel/CollapsiblePanel.component';
|
|
33
|
+
|
|
40
34
|
export { LateralNavbarLayout } from './components/lateralnavbarlayout/LateralNavbarLayout.component';
|
|
41
35
|
export { GlobalHealthBar } from './components/globalhealthbar/GlobalHealthBar.component';
|
|
42
36
|
export { ConstrainedText } from './components/constrainedtext/Constrainedtext.component';
|
|
@@ -48,7 +42,7 @@ export { ErrorPage404 } from './components/error-pages/ErrorPage404.component';
|
|
|
48
42
|
export { ErrorPage500 } from './components/error-pages/ErrorPage500.component';
|
|
49
43
|
export { ErrorPageAuth } from './components/error-pages/ErrorPageAuth.component';
|
|
50
44
|
export { TextBadge } from './components/textbadge/TextBadge.component';
|
|
51
|
-
|
|
45
|
+
|
|
52
46
|
export { Layout as Layout2 } from './components/layout/v2';
|
|
53
47
|
export { TwoPanelLayout } from './components/layout/v2/panels';
|
|
54
48
|
export { AppContainer } from './components/layout/v2/AppContainer';
|
|
@@ -82,3 +76,4 @@ export { InfoMessage } from './components/infomessage/InfoMessage.component';
|
|
|
82
76
|
export { InputList } from './components/inputlist/InputList.component';
|
|
83
77
|
export { InlineInput } from './components/inlineinput/InlineInput';
|
|
84
78
|
export { UnsuccessfulResult } from './components/UnsuccessfulResult.component';
|
|
79
|
+
export { CoreUITheme } from './style/theme';
|
package/src/lib/next.ts
CHANGED
|
@@ -25,3 +25,4 @@ export { ChartTooltip } from './components/barchartv2/ChartTooltip';
|
|
|
25
25
|
export { ChartLegendWrapper } from './components/chartlegend/ChartLegendWrapper';
|
|
26
26
|
export { ChartLegend } from './components/chartlegend/ChartLegend';
|
|
27
27
|
export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
|
|
28
|
+
export { CoreUITheme } from './style/theme';
|
|
@@ -111,7 +111,7 @@ const horizontalBarChartArgs = {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
export default {
|
|
114
|
-
title: 'Components/
|
|
114
|
+
title: 'Components/Deprecated/Charts/BarChart',
|
|
115
115
|
component: BarChart,
|
|
116
116
|
decorators: [
|
|
117
117
|
(story: Component) => <SyncedCursorCharts>{story()}</SyncedCursorCharts>,
|
package/stories/card.stories.tsx
CHANGED
|
@@ -7,12 +7,14 @@ import {
|
|
|
7
7
|
CardBodyContainer,
|
|
8
8
|
} from '../src/lib/components/card/Card.component';
|
|
9
9
|
import { CircularProgressBar } from '../src/lib/components/circularprogressbar/CircularProgressBar.component';
|
|
10
|
-
import { Text
|
|
11
|
-
import {
|
|
10
|
+
import { Text } from './common';
|
|
11
|
+
import { coreUIAvailableThemes } from '../src/lib/style/theme';
|
|
12
12
|
import { action } from '@storybook/addon-actions';
|
|
13
13
|
|
|
14
14
|
// RGB color in theme provoke an error, excludes from control options
|
|
15
|
-
const colors = Object.keys(
|
|
15
|
+
const colors = Object.keys(coreUIAvailableThemes.darkRebrand).filter(
|
|
16
|
+
(color) => !/RGB/.test(color),
|
|
17
|
+
);
|
|
16
18
|
|
|
17
19
|
export default {
|
|
18
20
|
title: 'Components/Data Display/Card',
|
|
@@ -43,8 +45,8 @@ const Row = styled.div`
|
|
|
43
45
|
`;
|
|
44
46
|
const defaultBody = (
|
|
45
47
|
<CircularProgressBar
|
|
46
|
-
color={
|
|
47
|
-
backgroundColor={
|
|
48
|
+
color={coreUIAvailableThemes.darkRebrand.buttonSecondary}
|
|
49
|
+
backgroundColor={coreUIAvailableThemes.darkRebrand.textPrimary}
|
|
48
50
|
radius={30}
|
|
49
51
|
strokeWidth={5}
|
|
50
52
|
percent={60}
|
package/stories/controls.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { iconTable } from
|
|
1
|
+
import { iconTable } from '../src/lib/components/icon/Icon.component';
|
|
2
2
|
|
|
3
3
|
export const iconOptions = Object.keys(iconTable);
|
|
4
4
|
|
|
5
5
|
export const sizesOptions = ['smaller', 'small', 'base', 'large', 'larger'];
|
|
6
6
|
|
|
7
7
|
export const placementOptions = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
'top',
|
|
9
|
+
'bottom',
|
|
10
|
+
'left',
|
|
11
|
+
'top-start',
|
|
12
|
+
'top-end',
|
|
13
|
+
'right',
|
|
14
|
+
'right-start',
|
|
15
|
+
'right-end',
|
|
16
|
+
'bottom-end',
|
|
17
|
+
'bottom-start',
|
|
18
|
+
'left-start',
|
|
19
|
+
'left-end',
|
|
20
|
+
];
|
|
21
21
|
export const localeArgtype = {
|
|
22
22
|
control: { type: 'radio' },
|
|
23
23
|
options: ['en', 'fr'],
|
|
@@ -40,9 +40,8 @@ export const variantsOptions = [
|
|
|
40
40
|
'backgroundLevel1',
|
|
41
41
|
];
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
tooltip: {
|
|
43
|
+
export const tooltipArgTypes = {
|
|
44
|
+
tooltip: {
|
|
46
45
|
description:
|
|
47
46
|
"Object with 'overlay','placement' and 'overlayStyle' properties",
|
|
48
47
|
control: false,
|
|
@@ -53,7 +52,7 @@ export const tooltipArgTypes = {
|
|
|
53
52
|
options: placementOptions,
|
|
54
53
|
},
|
|
55
54
|
tooltipOverlayStyle: {
|
|
56
|
-
control:'object',
|
|
55
|
+
control: 'object',
|
|
57
56
|
description: 'Object of CSS properties',
|
|
58
|
-
}
|
|
59
|
-
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -10,7 +10,7 @@ import { Wrapper } from './common';
|
|
|
10
10
|
import { dataLineChartV2, dataLineChartV2_readwrite } from './data/linechart';
|
|
11
11
|
import { defaultRenderTooltipSerie } from '../src/lib/components/linetemporalchart/tooltip';
|
|
12
12
|
export default {
|
|
13
|
-
title: 'Components/
|
|
13
|
+
title: 'Components/Deprecated/Charts/LineTemporalChart',
|
|
14
14
|
component: LineTemporalChart,
|
|
15
15
|
decorators: [
|
|
16
16
|
(story) => (
|
|
@@ -380,6 +380,31 @@ const prometheusData5 = [
|
|
|
380
380
|
[1740492000, '19859.90'],
|
|
381
381
|
];
|
|
382
382
|
|
|
383
|
+
// Data with irregular intervals but gaps under 2 intervals (less than 24 minutes)
|
|
384
|
+
// Sample frequency is 720 seconds (12 minutes), so 2 intervals = 1440 seconds (24 minutes)
|
|
385
|
+
const irregularIntervalData = [
|
|
386
|
+
[1740405600, '47.55'], // Base timestamp
|
|
387
|
+
[1740406200, '53.01'], // +600 seconds (10 minutes) - under 2 intervals
|
|
388
|
+
[1740407100, '40.19'], // +900 seconds (15 minutes) - under 2 intervals
|
|
389
|
+
[1740408000, '59.19'], // +900 seconds (15 minutes) - under 2 intervals
|
|
390
|
+
[1740409100, '62.50'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
391
|
+
[1740410300, '57.45'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
392
|
+
[1740411000, '45.19'], // +700 seconds (11.7 minutes) - under 2 intervals
|
|
393
|
+
[1740412200, '58.62'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
394
|
+
[1740413000, '53.08'], // +800 seconds (13.3 minutes) - under 2 intervals
|
|
395
|
+
[1740414300, '64.91'], // +1300 seconds (21.7 minutes) - under 2 intervals
|
|
396
|
+
[1740415100, '81.23'], // +800 seconds (13.3 minutes) - under 2 intervals
|
|
397
|
+
[1740416400, '64.82'], // +1300 seconds (21.7 minutes) - under 2 intervals
|
|
398
|
+
[1740417200, '67.17'], // +800 seconds (13.3 minutes) - under 2 intervals
|
|
399
|
+
[1740418500, '55.23'], // +1300 seconds (21.7 minutes) - under 2 intervals
|
|
400
|
+
[1740419400, '47.92'], // +900 seconds (15 minutes) - under 2 intervals
|
|
401
|
+
[1740420600, '72.11'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
402
|
+
[1740421500, '61.91'], // +900 seconds (15 minutes) - under 2 intervals
|
|
403
|
+
[1740422700, '51.07'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
404
|
+
[1740423800, '39.50'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
405
|
+
[1740424900, '46.92'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
406
|
+
];
|
|
407
|
+
|
|
383
408
|
export const PercentageChartExample: Story = {
|
|
384
409
|
args: {
|
|
385
410
|
series: [
|
|
@@ -488,3 +513,27 @@ export const AutoUnitChartExample: Story = {
|
|
|
488
513
|
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
489
514
|
},
|
|
490
515
|
};
|
|
516
|
+
|
|
517
|
+
export const IrregularIntervalsExample: Story = {
|
|
518
|
+
args: {
|
|
519
|
+
series: [
|
|
520
|
+
{
|
|
521
|
+
data: irregularIntervalData,
|
|
522
|
+
resource: 'ip-10-160-122-207.eu-north-1.compute.internal',
|
|
523
|
+
metricPrefix: 'instance:10.160.122.207:9100',
|
|
524
|
+
getTooltipLabel: (prefix, resource) => `${resource}`,
|
|
525
|
+
},
|
|
526
|
+
],
|
|
527
|
+
title: 'Irregular intervals data',
|
|
528
|
+
height: 200,
|
|
529
|
+
startingTimeStamp: irregularIntervalData[0][0],
|
|
530
|
+
isLoading: false,
|
|
531
|
+
isLegendHidden: false,
|
|
532
|
+
helpText:
|
|
533
|
+
'Data points with irregular timestamps, but all gaps are less than 2 intervals (24 minutes). No missing data points are added.',
|
|
534
|
+
yAxisType: 'percentage',
|
|
535
|
+
yAxisTitle: '',
|
|
536
|
+
interval: SAMPLE_FREQUENCY_LAST_TWENTY_FOUR_HOURS,
|
|
537
|
+
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
538
|
+
},
|
|
539
|
+
};
|
|
@@ -11,6 +11,7 @@ const tabs = [
|
|
|
11
11
|
render: (
|
|
12
12
|
<InlineInput
|
|
13
13
|
id="instanceName"
|
|
14
|
+
// @ts-ignore
|
|
14
15
|
changeMutation={{
|
|
15
16
|
isLoading: false,
|
|
16
17
|
mutate: () => {},
|
|
@@ -174,3 +175,105 @@ export const NavbarWithOnlyLinkTabs = {
|
|
|
174
175
|
tabs: linkTabs,
|
|
175
176
|
},
|
|
176
177
|
};
|
|
178
|
+
|
|
179
|
+
export const NavbarDropdownShowcase = {
|
|
180
|
+
args: {
|
|
181
|
+
rightActions: [
|
|
182
|
+
{
|
|
183
|
+
type: 'dropdown',
|
|
184
|
+
text: 'Language',
|
|
185
|
+
variant: 'secondary',
|
|
186
|
+
size: 'default',
|
|
187
|
+
items: [
|
|
188
|
+
{
|
|
189
|
+
label: 'English',
|
|
190
|
+
name: 'EN',
|
|
191
|
+
onClick: action('English selected'),
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
label: 'Français',
|
|
195
|
+
name: 'FR',
|
|
196
|
+
onClick: action('French selected'),
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
label: 'Español',
|
|
200
|
+
name: 'ES',
|
|
201
|
+
onClick: action('Spanish selected'),
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
type: 'dropdown',
|
|
207
|
+
text: 'Help',
|
|
208
|
+
icon: <i className="fas fa-question-circle" />,
|
|
209
|
+
variant: 'outline',
|
|
210
|
+
size: 'default',
|
|
211
|
+
items: [
|
|
212
|
+
{
|
|
213
|
+
label: 'Documentation',
|
|
214
|
+
onClick: action('Documentation clicked'),
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
label: 'Tutorials',
|
|
218
|
+
onClick: action('Tutorials clicked'),
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
label: 'Contact Support',
|
|
222
|
+
onClick: action('Contact Support clicked'),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
label: 'Release Notes',
|
|
226
|
+
onClick: action('Release Notes clicked'),
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: 'dropdown',
|
|
232
|
+
icon: <i className="fas fa-user" />,
|
|
233
|
+
variant: 'primary',
|
|
234
|
+
size: 'default',
|
|
235
|
+
caret: false,
|
|
236
|
+
items: [
|
|
237
|
+
{
|
|
238
|
+
label: 'Profile Settings',
|
|
239
|
+
onClick: action('Profile clicked'),
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
label: 'Preferences',
|
|
243
|
+
onClick: action('Preferences clicked'),
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
label: 'API Keys',
|
|
247
|
+
onClick: action('API Keys clicked'),
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
label: 'Log out',
|
|
251
|
+
onClick: action('Logout clicked'),
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
tabs: [
|
|
257
|
+
{
|
|
258
|
+
selected: true,
|
|
259
|
+
title: 'Dashboard',
|
|
260
|
+
link: <a href="/dashboard">Dashboard</a>,
|
|
261
|
+
onClick: action('Dashboard clicked'),
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
selected: false,
|
|
265
|
+
title: 'Analytics',
|
|
266
|
+
link: <a href="/analytics">Analytics</a>,
|
|
267
|
+
onClick: action('Analytics clicked'),
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
parameters: {
|
|
272
|
+
docs: {
|
|
273
|
+
description: {
|
|
274
|
+
story:
|
|
275
|
+
'This story showcases different dropdown variants within the navbar. The dropdowns use the new ButtonV2 styling with variants: secondary, outline, and primary. Notice how the different variants provide visual hierarchy and the icon-only dropdown uses caret: false for a cleaner look.',
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
};
|
|
@@ -3,12 +3,13 @@ import { TextBadge } from '../src/lib/components/textbadge/TextBadge.component';
|
|
|
3
3
|
import { Tabs, Tab } from '../src/lib/components/tabsv2/Tabsv2.component';
|
|
4
4
|
import { Wrapper, Title } from './common';
|
|
5
5
|
import { BrowserRouter } from 'react-router-dom';
|
|
6
|
-
import {
|
|
6
|
+
import { coreUIAvailableThemes } from '../src/lib/style/theme';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { useLocation } from 'react-router';
|
|
9
|
+
import { spacing } from '../src/lib';
|
|
9
10
|
|
|
10
11
|
const Content = styled.div`
|
|
11
|
-
padding: ${spacing.
|
|
12
|
+
padding: ${spacing.r24};
|
|
12
13
|
color: ${(props) => props.theme.textPrimary};
|
|
13
14
|
height: 100%;
|
|
14
15
|
`;
|
|
@@ -55,13 +56,13 @@ const generateTab = (n = 10, selectedIndex = 0) => {
|
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
const customTabStyle = {
|
|
58
|
-
activeTabColor:
|
|
59
|
-
activeTabSeparator:
|
|
60
|
-
tabLineColor:
|
|
61
|
-
inactiveTabColor:
|
|
62
|
-
tabContentColor:
|
|
63
|
-
separatorColor:
|
|
64
|
-
tabHoverColor:
|
|
59
|
+
activeTabColor: coreUIAvailableThemes.darkRebrand.selectedActive,
|
|
60
|
+
activeTabSeparator: coreUIAvailableThemes.darkRebrand.statusHealthy,
|
|
61
|
+
tabLineColor: coreUIAvailableThemes.darkRebrand.backgroundLevel3,
|
|
62
|
+
inactiveTabColor: coreUIAvailableThemes.darkRebrand.highlight,
|
|
63
|
+
tabContentColor: coreUIAvailableThemes.darkRebrand.buttonPrimary,
|
|
64
|
+
separatorColor: coreUIAvailableThemes.darkRebrand.statusCritical,
|
|
65
|
+
tabHoverColor: coreUIAvailableThemes.darkRebrand.statusHealthy,
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
const DefaultTabsDetails = (props) => {
|
|
@@ -87,52 +88,46 @@ const DefaultTabsDetails = (props) => {
|
|
|
87
88
|
<Title>
|
|
88
89
|
{location.pathname} / {location.search}
|
|
89
90
|
</Title>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<Content>Properties Content</Content>
|
|
131
|
-
</Tab>
|
|
132
|
-
</Tabs>
|
|
133
|
-
)}
|
|
134
|
-
/>
|
|
135
|
-
</MemoryRouter>
|
|
91
|
+
|
|
92
|
+
<Tabs {...props}>
|
|
93
|
+
<Tab path="/path" label="Users" withoutPadding>
|
|
94
|
+
<Content>Users Content</Content>
|
|
95
|
+
</Tab>
|
|
96
|
+
<Tab
|
|
97
|
+
path="/path1"
|
|
98
|
+
query={{
|
|
99
|
+
tab: 'group',
|
|
100
|
+
}}
|
|
101
|
+
label="Groups"
|
|
102
|
+
>
|
|
103
|
+
{details()}
|
|
104
|
+
</Tab>
|
|
105
|
+
<Tab
|
|
106
|
+
path="/path1"
|
|
107
|
+
query={{
|
|
108
|
+
tab: 'role',
|
|
109
|
+
}}
|
|
110
|
+
label="Roles"
|
|
111
|
+
withoutPadding
|
|
112
|
+
>
|
|
113
|
+
<Content>Roles content</Content>
|
|
114
|
+
</Tab>
|
|
115
|
+
<Tab
|
|
116
|
+
path="/path1"
|
|
117
|
+
query={{
|
|
118
|
+
tab: 'policies',
|
|
119
|
+
}}
|
|
120
|
+
label="Policies"
|
|
121
|
+
>
|
|
122
|
+
<Content>Policies content</Content>
|
|
123
|
+
</Tab>
|
|
124
|
+
<Tab path="/path4" label="Storage Location">
|
|
125
|
+
<Content>Storage Location Content</Content>
|
|
126
|
+
</Tab>
|
|
127
|
+
<Tab path="/path5" label="Properties">
|
|
128
|
+
<Content>Properties Content</Content>
|
|
129
|
+
</Tab>
|
|
130
|
+
</Tabs>
|
|
136
131
|
</>
|
|
137
132
|
);
|
|
138
133
|
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
id: string;
|
|
3
|
-
data: Array<Record<string, any>>;
|
|
4
|
-
xAxis: Record<string, any>;
|
|
5
|
-
yAxis: Array<Record<string, any>>;
|
|
6
|
-
color?: Record<string, any>;
|
|
7
|
-
areas: Array<Record<string, any>>;
|
|
8
|
-
width?: number;
|
|
9
|
-
height?: number;
|
|
10
|
-
};
|
|
11
|
-
declare function AreaChart({ id, data, xAxis, yAxis, color, height, width, areas, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export { AreaChart };
|
|
13
|
-
//# sourceMappingURL=AreaChart.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AreaChart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/areachart/AreaChart.component.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,iBAAS,SAAS,CAAC,EACjB,EAAE,EACF,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAY,EACZ,KAAY,EACZ,KAAU,EACV,GAAG,IAAI,EACR,EAAE,KAAK,2CAuBP;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|