@shipfox/react-ui 0.21.0 → 0.23.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/dist/components/dashboard/components/charts/bar-chart.d.ts +3 -2
- package/dist/components/dashboard/components/charts/bar-chart.js +13 -7
- package/dist/components/dashboard/components/charts/line-chart.d.ts +3 -2
- package/dist/components/dashboard/components/charts/line-chart.js +13 -7
- package/dist/components/dashboard/context/dashboard-context.d.ts +12 -8
- package/dist/components/dashboard/context/dashboard-context.js +42 -7
- package/dist/components/dashboard/context/index.d.ts +2 -2
- package/dist/components/dashboard/context/index.js +1 -1
- package/dist/components/dashboard/context/types.d.ts +9 -7
- package/dist/components/dashboard/index.d.ts +2 -4
- package/dist/components/dashboard/index.js +1 -2
- package/dist/components/dashboard/pages/analytics-page.js +41 -11
- package/dist/components/dashboard/pages/jobs-page.js +2 -4
- package/dist/components/dashboard/toolbar/filter-button.d.ts +6 -10
- package/dist/components/dashboard/toolbar/filter-button.js +109 -76
- package/dist/components/dashboard/toolbar/page-toolbar.d.ts +7 -19
- package/dist/components/dashboard/toolbar/page-toolbar.js +11 -99
- package/dist/components/dashboard/toolbar/toolbar-actions.js +3 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/interval-selector/hooks/index.d.ts +4 -0
- package/dist/components/interval-selector/hooks/index.js +5 -0
- package/dist/components/interval-selector/hooks/use-interval-selector-input.d.ts +30 -0
- package/dist/components/interval-selector/hooks/use-interval-selector-input.js +125 -0
- package/dist/components/interval-selector/hooks/use-interval-selector-navigation.d.ts +21 -0
- package/dist/components/interval-selector/hooks/use-interval-selector-navigation.js +58 -0
- package/dist/components/interval-selector/hooks/use-interval-selector.d.ts +25 -0
- package/dist/components/interval-selector/hooks/use-interval-selector.js +75 -0
- package/dist/components/interval-selector/index.d.ts +3 -0
- package/dist/components/interval-selector/index.js +4 -0
- package/dist/components/interval-selector/interval-selector-calendar.d.ts +7 -0
- package/dist/components/interval-selector/interval-selector-calendar.js +47 -0
- package/dist/components/interval-selector/interval-selector-input.d.ts +8 -0
- package/dist/components/interval-selector/interval-selector-input.js +34 -0
- package/dist/components/interval-selector/interval-selector-suggestions.d.ts +11 -0
- package/dist/components/interval-selector/interval-selector-suggestions.js +107 -0
- package/dist/components/interval-selector/interval-selector.d.ts +12 -0
- package/dist/components/interval-selector/interval-selector.js +56 -0
- package/dist/components/interval-selector/interval-selector.stories.js +232 -0
- package/dist/components/interval-selector/types.d.ts +19 -0
- package/dist/components/interval-selector/types.js +3 -0
- package/dist/components/interval-selector/utils/constants.d.ts +24 -0
- package/dist/components/interval-selector/utils/constants.js +129 -0
- package/dist/components/interval-selector/utils/format.d.ts +16 -0
- package/dist/components/interval-selector/utils/format.js +23 -0
- package/dist/components/interval-selector/utils/index.d.ts +3 -0
- package/dist/components/interval-selector/utils/index.js +4 -0
- package/dist/components/popover/popover.d.ts +3 -1
- package/dist/components/popover/popover.js +2 -1
- package/dist/styles.css +1 -1
- package/dist/utils/date.js +130 -22
- package/dist/utils/format/date.d.ts +1 -0
- package/dist/utils/format/date.js +11 -4
- package/package.json +2 -1
- package/dist/components/dashboard/filters/expression-filter-bar.d.ts +0 -42
- package/dist/components/dashboard/filters/expression-filter-bar.js +0 -80
- package/dist/components/dashboard/filters/index.d.ts +0 -6
- package/dist/components/dashboard/filters/index.js +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react';
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
import { type BarProps, type CartesianGridProps, BarChart as RechartsBarChart, type XAxisProps, type YAxisProps } from 'recharts';
|
|
3
3
|
import type { ChartColor } from './colors';
|
|
4
4
|
export type RechartsBarChartProps = ComponentProps<typeof RechartsBarChart>;
|
|
@@ -23,8 +23,9 @@ export interface BarChartProps {
|
|
|
23
23
|
};
|
|
24
24
|
className?: string;
|
|
25
25
|
title?: string;
|
|
26
|
+
action?: ReactNode;
|
|
26
27
|
barRadius?: [number, number, number, number];
|
|
27
28
|
maxBarSize?: number;
|
|
28
29
|
}
|
|
29
|
-
export declare function BarChart({ data, bars, height, xAxis, yAxis, grid, tooltip, className, title, barRadius, maxBarSize, }: BarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function BarChart({ data, bars, height, xAxis, yAxis, grid, tooltip, className, title, action, barRadius, maxBarSize, }: BarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
//# sourceMappingURL=bar-chart.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from '../../../../components/card/index.js';
|
|
2
|
+
import { Card, CardAction, CardContent, CardHeader, CardTitle } from '../../../../components/card/index.js';
|
|
3
3
|
import { EmptyState } from '../../../../components/empty-state/index.js';
|
|
4
4
|
import { Text } from '../../../../components/typography/index.js';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { Bar, CartesianGrid, BarChart as RechartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
7
7
|
import { ChartTooltipContent } from './chart-tooltip.js';
|
|
8
8
|
import { getChartColor, getHoverOpacity, normalizeTooltipPayload } from './utils.js';
|
|
9
|
-
export function BarChart({ data, bars, height = 200, xAxis, yAxis, grid, tooltip, className, title, barRadius = [
|
|
9
|
+
export function BarChart({ data, bars, height = 200, xAxis, yAxis, grid, tooltip, className, title, action, barRadius = [
|
|
10
10
|
0,
|
|
11
11
|
0,
|
|
12
12
|
0,
|
|
@@ -23,11 +23,17 @@ export function BarChart({ data, bars, height = 200, xAxis, yAxis, grid, tooltip
|
|
|
23
23
|
return /*#__PURE__*/ _jsxs(Card, {
|
|
24
24
|
className: className,
|
|
25
25
|
children: [
|
|
26
|
-
title && /*#__PURE__*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
(title || action) && /*#__PURE__*/ _jsxs(CardHeader, {
|
|
27
|
+
className: "flex flex-row items-center justify-between",
|
|
28
|
+
children: [
|
|
29
|
+
title && /*#__PURE__*/ _jsx(CardTitle, {
|
|
30
|
+
variant: "h4",
|
|
31
|
+
children: title
|
|
32
|
+
}),
|
|
33
|
+
action && /*#__PURE__*/ _jsx(CardAction, {
|
|
34
|
+
children: action
|
|
35
|
+
})
|
|
36
|
+
]
|
|
31
37
|
}),
|
|
32
38
|
/*#__PURE__*/ _jsxs(CardContent, {
|
|
33
39
|
children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react';
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
import { type CartesianGridProps, type LineProps, LineChart as RechartsLineChart, type XAxisProps, type YAxisProps } from 'recharts';
|
|
3
3
|
import type { ChartColor } from './colors';
|
|
4
4
|
export type RechartsLineChartProps = ComponentProps<typeof RechartsLineChart>;
|
|
@@ -23,6 +23,7 @@ export interface LineChartProps {
|
|
|
23
23
|
};
|
|
24
24
|
className?: string;
|
|
25
25
|
title?: string;
|
|
26
|
+
action?: ReactNode;
|
|
26
27
|
}
|
|
27
|
-
export declare function LineChart({ data, lines, height, xAxis, yAxis, grid, tooltip, className, title, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function LineChart({ data, lines, height, xAxis, yAxis, grid, tooltip, className, title, action, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
//# sourceMappingURL=line-chart.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from '../../../../components/card/index.js';
|
|
2
|
+
import { Card, CardAction, CardContent, CardHeader, CardTitle } from '../../../../components/card/index.js';
|
|
3
3
|
import { EmptyState } from '../../../../components/empty-state/index.js';
|
|
4
4
|
import { Text } from '../../../../components/typography/index.js';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { CartesianGrid, Line, LineChart as RechartsLineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
7
7
|
import { ChartTooltipContent } from './chart-tooltip.js';
|
|
8
8
|
import { getChartColor, getHoverOpacity, normalizeTooltipPayload } from './utils.js';
|
|
9
|
-
export function LineChart({ data, lines, height = 200, xAxis, yAxis, grid, tooltip, className, title }) {
|
|
9
|
+
export function LineChart({ data, lines, height = 200, xAxis, yAxis, grid, tooltip, className, title, action }) {
|
|
10
10
|
const [hoveredDataKey, setHoveredDataKey] = useState(undefined);
|
|
11
11
|
const visibleLines = lines.filter((line)=>!line.hide);
|
|
12
12
|
const hasData = data && data.length > 0 && visibleLines.length > 0;
|
|
@@ -18,11 +18,17 @@ export function LineChart({ data, lines, height = 200, xAxis, yAxis, grid, toolt
|
|
|
18
18
|
return /*#__PURE__*/ _jsxs(Card, {
|
|
19
19
|
className: className,
|
|
20
20
|
children: [
|
|
21
|
-
title && /*#__PURE__*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
(title || action) && /*#__PURE__*/ _jsxs(CardHeader, {
|
|
22
|
+
className: "flex flex-row items-center justify-between",
|
|
23
|
+
children: [
|
|
24
|
+
title && /*#__PURE__*/ _jsx(CardTitle, {
|
|
25
|
+
variant: "h4",
|
|
26
|
+
children: title
|
|
27
|
+
}),
|
|
28
|
+
action && /*#__PURE__*/ _jsx(CardAction, {
|
|
29
|
+
children: action
|
|
30
|
+
})
|
|
31
|
+
]
|
|
26
32
|
}),
|
|
27
33
|
/*#__PURE__*/ _jsxs(CardContent, {
|
|
28
34
|
children: [
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
* Dashboard Context Provider
|
|
3
3
|
*
|
|
4
4
|
* Provides centralized state management for dashboard components including
|
|
5
|
-
* search, filters, column visibility, time
|
|
5
|
+
* search, filters, column visibility, time interval, and sidebar navigation.
|
|
6
6
|
*/
|
|
7
|
+
import type { IntervalSelection } from '../../../components/interval-selector';
|
|
7
8
|
import { type ReactNode } from 'react';
|
|
8
|
-
import type { DashboardState, FilterOption, ResourceType,
|
|
9
|
+
import type { DashboardState, FilterOption, ResourceType, ResourceTypeOption, ViewColumn } from './types';
|
|
10
|
+
export declare const RESOURCE_TYPES: Array<ResourceType>;
|
|
11
|
+
export declare const RESOURCE_TYPE_LABELS: Record<ResourceType, string>;
|
|
12
|
+
export declare const RESOURCE_TYPE_OPTIONS: ResourceTypeOption[];
|
|
9
13
|
export interface DashboardProviderProps {
|
|
10
14
|
children: ReactNode;
|
|
11
15
|
/**
|
|
@@ -19,10 +23,10 @@ export interface DashboardProviderProps {
|
|
|
19
23
|
*/
|
|
20
24
|
initialFilters?: FilterOption[];
|
|
21
25
|
/**
|
|
22
|
-
* Initial time
|
|
23
|
-
* @default '
|
|
26
|
+
* Initial time interval selection
|
|
27
|
+
* @default { type: 'relative', duration: {days: 7} }
|
|
24
28
|
*/
|
|
25
|
-
|
|
29
|
+
initialSelection?: IntervalSelection;
|
|
26
30
|
/**
|
|
27
31
|
* Initial active sidebar item
|
|
28
32
|
* @default 'reliability'
|
|
@@ -30,7 +34,7 @@ export interface DashboardProviderProps {
|
|
|
30
34
|
initialActiveSidebarItem?: string;
|
|
31
35
|
/**
|
|
32
36
|
* Initial resource type
|
|
33
|
-
* @default 'ci
|
|
37
|
+
* @default 'ci.pipeline'
|
|
34
38
|
*/
|
|
35
39
|
initialResourceType?: ResourceType;
|
|
36
40
|
/**
|
|
@@ -46,12 +50,12 @@ export interface DashboardProviderProps {
|
|
|
46
50
|
*
|
|
47
51
|
* @example
|
|
48
52
|
* ```tsx
|
|
49
|
-
* <DashboardProvider
|
|
53
|
+
* <DashboardProvider initialInterval={intervalToNowFromDuration({days: 7})}>
|
|
50
54
|
* <AnalyticsContent />
|
|
51
55
|
* </DashboardProvider>
|
|
52
56
|
* ```
|
|
53
57
|
*/
|
|
54
|
-
export declare function DashboardProvider({ children, initialColumns, initialFilters,
|
|
58
|
+
export declare function DashboardProvider({ children, initialColumns, initialFilters, initialSelection, initialActiveSidebarItem, initialResourceType, columnMapping, }: DashboardProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
55
59
|
/**
|
|
56
60
|
* Hook to access dashboard context
|
|
57
61
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Dashboard Context Provider
|
|
3
3
|
*
|
|
4
4
|
* Provides centralized state management for dashboard components including
|
|
5
|
-
* search, filters, column visibility, time
|
|
5
|
+
* search, filters, column visibility, time interval, and sidebar navigation.
|
|
6
6
|
*/ import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
8
8
|
import { updateViewColumnsFromVisibility, viewColumnsToVisibilityState } from './utils.js';
|
|
@@ -85,6 +85,37 @@ const DashboardContext = /*#__PURE__*/ createContext(undefined);
|
|
|
85
85
|
checked: false
|
|
86
86
|
}
|
|
87
87
|
];
|
|
88
|
+
export const RESOURCE_TYPES = [
|
|
89
|
+
'ci.pipeline',
|
|
90
|
+
'ci.job',
|
|
91
|
+
'ci.step',
|
|
92
|
+
'test.run',
|
|
93
|
+
'test.suite',
|
|
94
|
+
'test.case'
|
|
95
|
+
];
|
|
96
|
+
export const RESOURCE_TYPE_LABELS = {
|
|
97
|
+
'ci.pipeline': 'CI Pipeline',
|
|
98
|
+
'ci.job': 'CI Job',
|
|
99
|
+
'ci.step': 'CI Step',
|
|
100
|
+
'test.run': 'Test Run',
|
|
101
|
+
'test.suite': 'Test Suite',
|
|
102
|
+
'test.case': 'Test Case'
|
|
103
|
+
};
|
|
104
|
+
export const RESOURCE_TYPE_OPTIONS = [
|
|
105
|
+
...RESOURCE_TYPES.map((type)=>({
|
|
106
|
+
id: type,
|
|
107
|
+
label: RESOURCE_TYPE_LABELS[type],
|
|
108
|
+
disabled: type.startsWith('test.')
|
|
109
|
+
}))
|
|
110
|
+
];
|
|
111
|
+
/**
|
|
112
|
+
* Default selection (relative: last 7 days)
|
|
113
|
+
*/ const DEFAULT_SELECTION = {
|
|
114
|
+
type: 'relative',
|
|
115
|
+
duration: {
|
|
116
|
+
days: 7
|
|
117
|
+
}
|
|
118
|
+
};
|
|
88
119
|
/**
|
|
89
120
|
* Dashboard Provider Component
|
|
90
121
|
*
|
|
@@ -92,19 +123,22 @@ const DashboardContext = /*#__PURE__*/ createContext(undefined);
|
|
|
92
123
|
*
|
|
93
124
|
* @example
|
|
94
125
|
* ```tsx
|
|
95
|
-
* <DashboardProvider
|
|
126
|
+
* <DashboardProvider initialInterval={intervalToNowFromDuration({days: 7})}>
|
|
96
127
|
* <AnalyticsContent />
|
|
97
128
|
* </DashboardProvider>
|
|
98
129
|
* ```
|
|
99
|
-
*/ export function DashboardProvider({ children, initialColumns = DEFAULT_COLUMNS, initialFilters = DEFAULT_FILTERS,
|
|
130
|
+
*/ export function DashboardProvider({ children, initialColumns = DEFAULT_COLUMNS, initialFilters = DEFAULT_FILTERS, initialSelection = DEFAULT_SELECTION, initialActiveSidebarItem = 'reliability', initialResourceType = 'ci.pipeline', columnMapping }) {
|
|
100
131
|
// State management
|
|
101
132
|
const [searchQuery, setSearchQuery] = useState('');
|
|
102
|
-
const [
|
|
133
|
+
const [selection, setSelection] = useState(initialSelection);
|
|
103
134
|
const [lastUpdated, setLastUpdated] = useState('13s ago');
|
|
104
135
|
const [columns, setColumns] = useState(initialColumns);
|
|
105
136
|
const [filters, setFilters] = useState(initialFilters);
|
|
106
137
|
const [activeSidebarItem, setActiveSidebarItem] = useState(initialActiveSidebarItem);
|
|
107
138
|
const [resourceType, setResourceType] = useState(initialResourceType);
|
|
139
|
+
const handleSelectionChange = useCallback((newSelection)=>{
|
|
140
|
+
setSelection(newSelection);
|
|
141
|
+
}, []);
|
|
108
142
|
// Compute column visibility state
|
|
109
143
|
const columnVisibility = useMemo(()=>viewColumnsToVisibilityState(columns, columnMapping), [
|
|
110
144
|
columns,
|
|
@@ -121,8 +155,8 @@ const DashboardContext = /*#__PURE__*/ createContext(undefined);
|
|
|
121
155
|
const value = useMemo(()=>({
|
|
122
156
|
searchQuery,
|
|
123
157
|
setSearchQuery,
|
|
124
|
-
|
|
125
|
-
|
|
158
|
+
selection,
|
|
159
|
+
setSelection: handleSelectionChange,
|
|
126
160
|
lastUpdated,
|
|
127
161
|
setLastUpdated,
|
|
128
162
|
columns,
|
|
@@ -137,7 +171,8 @@ const DashboardContext = /*#__PURE__*/ createContext(undefined);
|
|
|
137
171
|
setResourceType
|
|
138
172
|
}), [
|
|
139
173
|
searchQuery,
|
|
140
|
-
|
|
174
|
+
selection,
|
|
175
|
+
handleSelectionChange,
|
|
141
176
|
lastUpdated,
|
|
142
177
|
columns,
|
|
143
178
|
columnVisibility,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Dashboard Context exports
|
|
3
3
|
*/
|
|
4
4
|
export type { DashboardProviderProps } from './dashboard-context';
|
|
5
|
-
export { DashboardProvider, useDashboardContext } from './dashboard-context';
|
|
6
|
-
export type { DashboardState, FilterOption, ResourceType,
|
|
5
|
+
export { DashboardProvider, RESOURCE_TYPE_LABELS, RESOURCE_TYPE_OPTIONS, RESOURCE_TYPES, useDashboardContext, } from './dashboard-context';
|
|
6
|
+
export type { DashboardState, FilterOption, ResourceType, ResourceTypeOption, ViewColumn, } from './types';
|
|
7
7
|
export { DEFAULT_COLUMN_ID_TO_ACCESSOR_KEY, updateViewColumnsFromVisibility, viewColumnsToVisibilityState, } from './utils';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dashboard Context exports
|
|
3
|
-
*/ export { DashboardProvider, useDashboardContext } from './dashboard-context.js';
|
|
3
|
+
*/ export { DashboardProvider, RESOURCE_TYPE_LABELS, RESOURCE_TYPE_OPTIONS, RESOURCE_TYPES, useDashboardContext } from './dashboard-context.js';
|
|
4
4
|
export { DEFAULT_COLUMN_ID_TO_ACCESSOR_KEY, updateViewColumnsFromVisibility, viewColumnsToVisibilityState } from './utils.js';
|
|
5
5
|
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Shared types for dashboard components
|
|
3
3
|
*/
|
|
4
4
|
import type { VisibilityState } from '@tanstack/react-table';
|
|
5
|
+
import type { IntervalSelection } from '../../../components/interval-selector';
|
|
5
6
|
/**
|
|
6
7
|
* View column configuration for table visibility control
|
|
7
8
|
*/
|
|
@@ -18,22 +19,23 @@ export interface FilterOption {
|
|
|
18
19
|
label: string;
|
|
19
20
|
checked: boolean;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
* Time period option
|
|
23
|
-
*/
|
|
24
|
-
export type TimePeriod = '1hour' | '1day' | '2days' | '7days' | '30days';
|
|
22
|
+
export type ResourceType = 'ci.pipeline' | 'ci.job' | 'ci.step' | 'test.run' | 'test.suite' | 'test.case';
|
|
25
23
|
/**
|
|
26
24
|
* Resource type option
|
|
27
25
|
*/
|
|
28
|
-
export
|
|
26
|
+
export interface ResourceTypeOption {
|
|
27
|
+
id: ResourceType;
|
|
28
|
+
label: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
}
|
|
29
31
|
/**
|
|
30
32
|
* Dashboard context state
|
|
31
33
|
*/
|
|
32
34
|
export interface DashboardState {
|
|
33
35
|
searchQuery: string;
|
|
34
36
|
setSearchQuery: (query: string) => void;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
selection: IntervalSelection;
|
|
38
|
+
setSelection: (selection: IntervalSelection) => void;
|
|
37
39
|
lastUpdated: string;
|
|
38
40
|
setLastUpdated: (timestamp: string) => void;
|
|
39
41
|
columns: ViewColumn[];
|
|
@@ -7,12 +7,10 @@ export type { MobileSidebarProps } from './components/mobile-sidebar';
|
|
|
7
7
|
export { MobileSidebar } from './components/mobile-sidebar';
|
|
8
8
|
export type { SidebarNavItem, SidebarProps } from './components/sidebar';
|
|
9
9
|
export { defaultSidebarItems, Sidebar } from './components/sidebar';
|
|
10
|
-
export type { DashboardProviderProps, DashboardState, FilterOption, ResourceType,
|
|
11
|
-
export { DashboardProvider, DEFAULT_COLUMN_ID_TO_ACCESSOR_KEY, updateViewColumnsFromVisibility, useDashboardContext, viewColumnsToVisibilityState, } from './context';
|
|
10
|
+
export type { DashboardProviderProps, DashboardState, FilterOption, ResourceType, ViewColumn, } from './context';
|
|
11
|
+
export { DashboardProvider, DEFAULT_COLUMN_ID_TO_ACCESSOR_KEY, RESOURCE_TYPE_OPTIONS, updateViewColumnsFromVisibility, useDashboardContext, viewColumnsToVisibilityState, } from './context';
|
|
12
12
|
export type { DashboardProps } from './dashboard';
|
|
13
13
|
export { Dashboard } from './dashboard';
|
|
14
|
-
export type { ExpressionFilterBarProps, ResourceTypeOption } from './filters';
|
|
15
|
-
export { ExpressionFilterBar } from './filters';
|
|
16
14
|
export { AnalyticsPage, JobsPage } from './pages';
|
|
17
15
|
export type { TableWrapperProps } from './table';
|
|
18
16
|
export { TableWrapper } from './table';
|
|
@@ -3,9 +3,8 @@ export { DashboardAlert } from './components/dashboard-alert.js';
|
|
|
3
3
|
export { KpiCard, KpiCardsGroup } from './components/kpi-card.js';
|
|
4
4
|
export { MobileSidebar } from './components/mobile-sidebar.js';
|
|
5
5
|
export { defaultSidebarItems, Sidebar } from './components/sidebar.js';
|
|
6
|
-
export { DashboardProvider, DEFAULT_COLUMN_ID_TO_ACCESSOR_KEY, updateViewColumnsFromVisibility, useDashboardContext, viewColumnsToVisibilityState } from './context/index.js';
|
|
6
|
+
export { DashboardProvider, DEFAULT_COLUMN_ID_TO_ACCESSOR_KEY, RESOURCE_TYPE_OPTIONS, updateViewColumnsFromVisibility, useDashboardContext, viewColumnsToVisibilityState } from './context/index.js';
|
|
7
7
|
export { Dashboard } from './dashboard.js';
|
|
8
|
-
export { ExpressionFilterBar } from './filters/index.js';
|
|
9
8
|
export { AnalyticsPage, JobsPage } from './pages/index.js';
|
|
10
9
|
export { TableWrapper } from './table/index.js';
|
|
11
10
|
export { FilterButton, PageToolbar, ToolbarActions, ToolbarSearch, ViewDropdown } from './toolbar/index.js';
|
|
@@ -3,10 +3,11 @@ import { Button } from '../../../components/button/index.js';
|
|
|
3
3
|
import { CountUp } from '../../../components/count-up/count-up.js';
|
|
4
4
|
import { Icon } from '../../../components/icon/index.js';
|
|
5
5
|
import { SearchInline } from '../../../components/search/search-inline.js';
|
|
6
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../components/select/index.js';
|
|
6
7
|
import { jobColumns } from '../../../components/table/table.stories.columns.js';
|
|
7
8
|
import { jobsData } from '../../../components/table/table.stories.data.js';
|
|
8
9
|
import { useMediaQuery } from '../../../hooks/useMediaQuery.js';
|
|
9
|
-
import { useMemo } from 'react';
|
|
10
|
+
import { useMemo, useState } from 'react';
|
|
10
11
|
import { BarChart } from '../components/charts/bar-chart.js';
|
|
11
12
|
import { LineChart } from '../components/charts/line-chart.js';
|
|
12
13
|
import { DashboardAlert } from '../components/dashboard-alert.js';
|
|
@@ -14,7 +15,6 @@ import { KpiCardsGroup } from '../components/kpi-card.js';
|
|
|
14
15
|
import { MobileSidebar } from '../components/mobile-sidebar.js';
|
|
15
16
|
import { defaultSidebarItems, Sidebar } from '../components/sidebar.js';
|
|
16
17
|
import { useDashboardContext } from '../context/index.js';
|
|
17
|
-
import { ExpressionFilterBar } from '../filters/index.js';
|
|
18
18
|
import { TableWrapper } from '../table/index.js';
|
|
19
19
|
import { PageToolbar, ToolbarActions } from '../toolbar/index.js';
|
|
20
20
|
const performanceData = [
|
|
@@ -146,8 +146,9 @@ const kpiCards = [
|
|
|
146
146
|
}
|
|
147
147
|
];
|
|
148
148
|
export function AnalyticsPage() {
|
|
149
|
-
const { searchQuery, setSearchQuery,
|
|
149
|
+
const { searchQuery, setSearchQuery, columnVisibility, updateColumnVisibility, activeSidebarItem, setActiveSidebarItem } = useDashboardContext();
|
|
150
150
|
const isDesktop = useMediaQuery('(min-width: 1024px)');
|
|
151
|
+
const [performanceTimeRange, setPerformanceTimeRange] = useState('2h');
|
|
151
152
|
const pageTitle = useMemo(()=>{
|
|
152
153
|
const activeItem = defaultSidebarItems.find((item)=>item.id === activeSidebarItem);
|
|
153
154
|
return activeItem?.label || 'Reliability';
|
|
@@ -162,9 +163,7 @@ export function AnalyticsPage() {
|
|
|
162
163
|
children: [
|
|
163
164
|
/*#__PURE__*/ _jsx(PageToolbar, {
|
|
164
165
|
title: pageTitle,
|
|
165
|
-
|
|
166
|
-
onTimePeriodChange: setTimePeriod,
|
|
167
|
-
lastUpdated: lastUpdated,
|
|
166
|
+
onRefresh: ()=>undefined,
|
|
168
167
|
children: !isDesktop && /*#__PURE__*/ _jsx(MobileSidebar, {
|
|
169
168
|
items: defaultSidebarItems,
|
|
170
169
|
activeItemId: activeSidebarItem,
|
|
@@ -194,10 +193,6 @@ export function AnalyticsPage() {
|
|
|
194
193
|
onClick: ()=>undefined
|
|
195
194
|
}
|
|
196
195
|
}),
|
|
197
|
-
/*#__PURE__*/ _jsx(ExpressionFilterBar, {
|
|
198
|
-
value: resourceType,
|
|
199
|
-
onValueChange: setResourceType
|
|
200
|
-
}),
|
|
201
196
|
/*#__PURE__*/ _jsx(ToolbarActions, {}),
|
|
202
197
|
/*#__PURE__*/ _jsx(KpiCardsGroup, {
|
|
203
198
|
cards: kpiCards
|
|
@@ -247,7 +242,42 @@ export function AnalyticsPage() {
|
|
|
247
242
|
},
|
|
248
243
|
tooltip: {
|
|
249
244
|
labelFormatter: ()=>`Jul 22, 2025`
|
|
250
|
-
}
|
|
245
|
+
},
|
|
246
|
+
action: /*#__PURE__*/ _jsxs(Select, {
|
|
247
|
+
value: performanceTimeRange,
|
|
248
|
+
onValueChange: setPerformanceTimeRange,
|
|
249
|
+
children: [
|
|
250
|
+
/*#__PURE__*/ _jsx(SelectTrigger, {
|
|
251
|
+
"aria-label": "Time range",
|
|
252
|
+
className: "w-60",
|
|
253
|
+
children: /*#__PURE__*/ _jsx(SelectValue, {})
|
|
254
|
+
}),
|
|
255
|
+
/*#__PURE__*/ _jsxs(SelectContent, {
|
|
256
|
+
children: [
|
|
257
|
+
/*#__PURE__*/ _jsx(SelectItem, {
|
|
258
|
+
value: "1h",
|
|
259
|
+
children: "1h"
|
|
260
|
+
}),
|
|
261
|
+
/*#__PURE__*/ _jsx(SelectItem, {
|
|
262
|
+
value: "2h",
|
|
263
|
+
children: "2h"
|
|
264
|
+
}),
|
|
265
|
+
/*#__PURE__*/ _jsx(SelectItem, {
|
|
266
|
+
value: "6h",
|
|
267
|
+
children: "6h"
|
|
268
|
+
}),
|
|
269
|
+
/*#__PURE__*/ _jsx(SelectItem, {
|
|
270
|
+
value: "12h",
|
|
271
|
+
children: "12h"
|
|
272
|
+
}),
|
|
273
|
+
/*#__PURE__*/ _jsx(SelectItem, {
|
|
274
|
+
value: "24h",
|
|
275
|
+
children: "24h"
|
|
276
|
+
})
|
|
277
|
+
]
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
})
|
|
251
281
|
}),
|
|
252
282
|
/*#__PURE__*/ _jsx(BarChart, {
|
|
253
283
|
data: durationData,
|
|
@@ -9,7 +9,7 @@ import { useDashboardContext } from '../context/index.js';
|
|
|
9
9
|
import { TableWrapper } from '../table/index.js';
|
|
10
10
|
import { PageToolbar } from '../toolbar/index.js';
|
|
11
11
|
export function JobsPage() {
|
|
12
|
-
const { searchQuery, setSearchQuery,
|
|
12
|
+
const { searchQuery, setSearchQuery, columnVisibility, updateColumnVisibility } = useDashboardContext();
|
|
13
13
|
const filteredData = useMemo(()=>jobsData.filter((job)=>job.name.toLowerCase().includes(searchQuery.toLowerCase())), [
|
|
14
14
|
searchQuery
|
|
15
15
|
]);
|
|
@@ -18,9 +18,7 @@ export function JobsPage() {
|
|
|
18
18
|
children: [
|
|
19
19
|
/*#__PURE__*/ _jsx(PageToolbar, {
|
|
20
20
|
title: "Jobs",
|
|
21
|
-
|
|
22
|
-
onTimePeriodChange: setTimePeriod,
|
|
23
|
-
lastUpdated: lastUpdated
|
|
21
|
+
onRefresh: ()=>undefined
|
|
24
22
|
}),
|
|
25
23
|
/*#__PURE__*/ _jsx("div", {
|
|
26
24
|
className: "flex-1 px-12 pb-12 pt-4 md:px-24 md:pb-24 overflow-auto",
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import type { ResourceType } from '../context/types';
|
|
3
|
+
export interface FilterButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
value: ResourceType;
|
|
5
|
+
onValueChange: (value: ResourceType) => void;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
-
filters?: FilterOption[];
|
|
8
|
-
onFiltersChange?: (filters: FilterOption[]) => void;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function FilterButton({ filters: controlledFilters, onFiltersChange, className, }: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function FilterButton({ value, onValueChange, className, ...props }: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
8
|
//# sourceMappingURL=filter-button.d.ts.map
|