@wso2/oxygen-ui 0.17.0 → 0.19.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/.ai/AGENTS.md +2 -1
- package/.ai/components.md +219 -0
- package/.claude/components.md +219 -0
- package/.claude/skills/oxygen-component/SKILL.md +86 -0
- package/.claude/skills/oxygen-form/SKILL.md +8 -0
- package/.claude/skills/oxygen-layout/SKILL.md +1 -0
- package/dist/components/DrawerPanel/DrawerPanel.d.ts +98 -0
- package/dist/components/DrawerPanel/DrawerPanelActions.d.ts +44 -0
- package/dist/components/DrawerPanel/DrawerPanelBody.d.ts +42 -0
- package/dist/components/DrawerPanel/DrawerPanelCloseButton.d.ts +44 -0
- package/dist/components/DrawerPanel/DrawerPanelExpandButton.d.ts +46 -0
- package/dist/components/DrawerPanel/DrawerPanelFooter.d.ts +41 -0
- package/dist/components/DrawerPanel/DrawerPanelHeader.d.ts +44 -0
- package/dist/components/DrawerPanel/DrawerPanelTitle.d.ts +45 -0
- package/dist/components/DrawerPanel/context.d.ts +42 -0
- package/dist/components/DrawerPanel/index.d.ts +35 -0
- package/dist/components/FullScreenWizard/FullScreenWizard.d.ts +85 -0
- package/dist/components/FullScreenWizard/FullScreenWizardContent.d.ts +70 -0
- package/dist/components/FullScreenWizard/FullScreenWizardFooter.d.ts +59 -0
- package/dist/components/FullScreenWizard/FullScreenWizardHeader.d.ts +59 -0
- package/dist/components/FullScreenWizard/FullScreenWizardPreview.d.ts +61 -0
- package/dist/components/FullScreenWizard/FullScreenWizardProgress.d.ts +61 -0
- package/dist/components/FullScreenWizard/context.d.ts +71 -0
- package/dist/components/FullScreenWizard/index.d.ts +33 -0
- package/dist/components/FullScreenWizard/useWizardSteps.d.ts +85 -0
- package/dist/components/ListingCard/ListingCard.d.ts +92 -0
- package/dist/components/ListingCard/index.d.ts +2 -0
- package/dist/components/LogViewer/LogFilterChip.d.ts +31 -0
- package/dist/components/LogViewer/LogLevelMarker.d.ts +16 -0
- package/dist/components/LogViewer/LogViewer.d.ts +178 -0
- package/dist/components/LogViewer/LogViewerControls.d.ts +121 -0
- package/dist/components/LogViewer/LogViewerDetails.d.ts +11 -0
- package/dist/components/LogViewer/LogViewerSearch.d.ts +42 -0
- package/dist/components/LogViewer/LogViewerStream.d.ts +132 -0
- package/dist/components/LogViewer/LogViewerToolbar.d.ts +56 -0
- package/dist/components/LogViewer/columns.d.ts +17 -0
- package/dist/components/LogViewer/context.d.ts +81 -0
- package/dist/components/LogViewer/download.d.ts +14 -0
- package/dist/components/LogViewer/filters.d.ts +11 -0
- package/dist/components/LogViewer/index.d.ts +8 -0
- package/dist/components/LogViewer/timestamps.d.ts +26 -0
- package/dist/components/LogViewer/types.d.ts +163 -0
- package/dist/components/Sidebar/Sidebar.d.ts +2 -0
- package/dist/components/Sidebar/SidebarCollapseToggle.d.ts +50 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/TextField/TextField.d.ts +28 -0
- package/dist/components/TextField/index.d.ts +2 -0
- package/dist/components/TrialBadge/TrialBadge.d.ts +192 -0
- package/dist/components/TrialBadge/index.d.ts +2 -0
- package/dist/components/index.d.ts +13 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6612 -3133
- package/dist/index.js.map +4 -4
- package/dist/styles/OxygenThemeBase.d.ts +12 -0
- package/package.json +2 -2
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PaperProps } from '@mui/material/Paper';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import { LogViewerCount, LogViewerDownload, LogViewerRefresh, LogViewerSort, LogViewerTimeZone } from './LogViewerControls';
|
|
5
|
+
import LogViewerSearch from './LogViewerSearch';
|
|
6
|
+
import LogViewerStream from './LogViewerStream';
|
|
7
|
+
import LogViewerToolbar from './LogViewerToolbar';
|
|
8
|
+
import type { LogEntry, LogColumn, LogFilterDefinition, LogFilterValue, LogFilterValues, LogLevel, LogSort, LogTimeZone, LogViewerOrder } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Props for the LogViewer component. The root holds the data and the state of the viewer; what its
|
|
11
|
+
* parts look like and say is set on the parts (`LogViewer.Toolbar`, `LogViewer.Stream` and the
|
|
12
|
+
* controls in the toolbar). The props it does not define itself, such as `className` and `data-*`,
|
|
13
|
+
* go to the outer element.
|
|
14
|
+
*/
|
|
15
|
+
export interface LogViewerProps extends Omit<PaperProps, 'children' | 'onCopy' | 'sx'> {
|
|
16
|
+
/**
|
|
17
|
+
* Entries, newest first, in the order a log is read from its source. The viewer reverses them
|
|
18
|
+
* itself when the reader chooses oldest first.
|
|
19
|
+
*/
|
|
20
|
+
entries: LogEntry[];
|
|
21
|
+
/**
|
|
22
|
+
* The columns of each entry, under a heading row. A column is `{ id, label, width, render, text,
|
|
23
|
+
* filterId, sortable }`; `time` and `level` are built in. The heading of a column holds its sort
|
|
24
|
+
* control (`sortable`) and its filter (`filterId`, an id from `filters`), so such a filter is not
|
|
25
|
+
* also shown in the toolbar. When the columns do not fit, the list scrolls sideways.
|
|
26
|
+
*/
|
|
27
|
+
columns: LogColumn[];
|
|
28
|
+
/**
|
|
29
|
+
* Hides the heading row, for a log that reads as one line per entry. The row stays in the table,
|
|
30
|
+
* visually hidden, so assistive technology still announces each cell under its column, which is why
|
|
31
|
+
* the columns should have labels. Its sort and filter controls are not offered: the filters appear in
|
|
32
|
+
* the toolbar instead, and `LogViewer.Sort` switches the order.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
hideHeading?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The parts of the viewer, top to bottom: usually a `LogViewer.Toolbar` and a `LogViewer.Stream`.
|
|
38
|
+
* Leave it out for a viewer with just the stream.
|
|
39
|
+
*/
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Which end of the list holds the newest entries. Older entries load at the other end. Set it
|
|
43
|
+
* to control the order; leave it out and the viewer keeps the order itself, starting at
|
|
44
|
+
* `defaultOrder`.
|
|
45
|
+
*/
|
|
46
|
+
order?: LogViewerOrder;
|
|
47
|
+
/**
|
|
48
|
+
* The order the viewer starts in when `order` is not set.
|
|
49
|
+
* @default 'newest-first'
|
|
50
|
+
*/
|
|
51
|
+
defaultOrder?: LogViewerOrder;
|
|
52
|
+
/**
|
|
53
|
+
* Called when the reader switches the order.
|
|
54
|
+
*/
|
|
55
|
+
onOrderChange?: (order: LogViewerOrder) => void;
|
|
56
|
+
/**
|
|
57
|
+
* True while the first page is loading.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* True while older entries are loading. Optional: when `onLoadOlder` returns its request's
|
|
63
|
+
* promise, the viewer shows the load button as busy while the promise is pending. Set this when
|
|
64
|
+
* `onLoadOlder` does not return the promise, or to show the busy state from elsewhere.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
loadingOlder?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* True when entries older than the loaded ones can still be loaded.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
hasMoreOlder?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Called when older entries are wanted: when the reader scrolls toward the older end, or uses
|
|
75
|
+
* the load older button. It is not called while loading or when `hasMoreOlder` is false, and
|
|
76
|
+
* not again until the request finishes. Return the request's promise, so the viewer knows when it
|
|
77
|
+
* finishes and shows the button as busy meanwhile; or set `loadingOlder` while it runs. With neither,
|
|
78
|
+
* the viewer cannot tell when the request ends, so it asks again only after the entries change: a
|
|
79
|
+
* request that fails without a promise or `loadingOlder` leaves the button unable to ask again.
|
|
80
|
+
*/
|
|
81
|
+
onLoadOlder?: () => void | Promise<unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* The time zone timestamps are shown in. Set it to control the zone; leave it out and the viewer
|
|
84
|
+
* keeps the zone itself, starting at `defaultTimeZone`. Copied and downloaded lines always carry
|
|
85
|
+
* the zone, as ISO 8601.
|
|
86
|
+
*/
|
|
87
|
+
timeZone?: LogTimeZone;
|
|
88
|
+
/**
|
|
89
|
+
* The time zone the viewer starts in when `timeZone` is not set.
|
|
90
|
+
* @default 'utc'
|
|
91
|
+
*/
|
|
92
|
+
defaultTimeZone?: LogTimeZone;
|
|
93
|
+
/**
|
|
94
|
+
* Called when the reader switches the time zone.
|
|
95
|
+
*/
|
|
96
|
+
onTimeZoneChange?: (timeZone: LogTimeZone) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Filters of the viewer, in order, as buttons in the toolbar or in a column heading, with a chip
|
|
99
|
+
* for each applied value. The viewer only displays them and reports changes; it never filters
|
|
100
|
+
* the entries itself.
|
|
101
|
+
*/
|
|
102
|
+
filters?: LogFilterDefinition[];
|
|
103
|
+
/**
|
|
104
|
+
* The applied filters, keyed by filter id. The viewer does not keep this state.
|
|
105
|
+
*/
|
|
106
|
+
filterValues?: LogFilterValues;
|
|
107
|
+
/**
|
|
108
|
+
* Called with a filter's id and its new value when the reader picks a value (`null` when the
|
|
109
|
+
* reader clears it). Apply the change to your data here.
|
|
110
|
+
*/
|
|
111
|
+
onFilterChange?: (id: string, value: LogFilterValue) => void;
|
|
112
|
+
/**
|
|
113
|
+
* The column the entries are sorted by, when it is not the time. Sorting by the time is the
|
|
114
|
+
* `order` of the viewer. The viewer does not sort: load the entries already sorted, in
|
|
115
|
+
* `onSortChange`. While this is set, entries are shown in the order given.
|
|
116
|
+
*/
|
|
117
|
+
sort?: LogSort | null;
|
|
118
|
+
/**
|
|
119
|
+
* Called when the reader sorts by a column other than the time, or clears that sort with
|
|
120
|
+
* `null`. Reorder or reload the entries here.
|
|
121
|
+
*/
|
|
122
|
+
onSortChange?: (sort: LogSort | null) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Error shown above the list.
|
|
125
|
+
*/
|
|
126
|
+
error?: React.ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* Called when the reader uses the Try again button, which the error shows when this is set.
|
|
129
|
+
* Start the request that failed again.
|
|
130
|
+
*/
|
|
131
|
+
onRetry?: () => void;
|
|
132
|
+
/**
|
|
133
|
+
* Warning shown above the list.
|
|
134
|
+
*/
|
|
135
|
+
warning?: React.ReactNode;
|
|
136
|
+
/**
|
|
137
|
+
* Called after an entry's Copy button is used, with whether the text was copied. Use it to show
|
|
138
|
+
* feedback.
|
|
139
|
+
*/
|
|
140
|
+
onCopy?: (entry: LogEntry, copied: boolean) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Gives the link to one entry, such as a URL that opens the page on that entry. Each entry shows a
|
|
143
|
+
* Copy link button when this returns a link. The viewer cannot build the URL, because it does not
|
|
144
|
+
* know your routes.
|
|
145
|
+
*/
|
|
146
|
+
getEntryLink?: (entry: LogEntry) => string | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Called after an entry's Copy link button is used, with whether the link was copied. Use it to
|
|
149
|
+
* show feedback.
|
|
150
|
+
*/
|
|
151
|
+
onCopyLink?: (entry: LogEntry, copied: boolean) => void;
|
|
152
|
+
/**
|
|
153
|
+
* The entry to mark and scroll into view, such as the one a shared link points at. Load the page
|
|
154
|
+
* of entries that holds it, then set its id here.
|
|
155
|
+
*/
|
|
156
|
+
highlightedEntryId?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Text of the markers for entry levels. Give only the levels you change.
|
|
159
|
+
* @default { trace: 'Trace', debug: 'Debug', info: 'Info', warn: 'Warn', error: 'Error', fatal: 'Fatal' }
|
|
160
|
+
*/
|
|
161
|
+
levelLabels?: Partial<Record<LogLevel, string>>;
|
|
162
|
+
/**
|
|
163
|
+
* Custom styles for the root element.
|
|
164
|
+
*/
|
|
165
|
+
sx?: SxProps<Theme>;
|
|
166
|
+
}
|
|
167
|
+
interface LogViewerComponent extends React.ForwardRefExoticComponent<LogViewerProps & React.RefAttributes<HTMLDivElement>> {
|
|
168
|
+
Toolbar: typeof LogViewerToolbar;
|
|
169
|
+
Stream: typeof LogViewerStream;
|
|
170
|
+
Search: typeof LogViewerSearch;
|
|
171
|
+
TimeZone: typeof LogViewerTimeZone;
|
|
172
|
+
Sort: typeof LogViewerSort;
|
|
173
|
+
Download: typeof LogViewerDownload;
|
|
174
|
+
Refresh: typeof LogViewerRefresh;
|
|
175
|
+
Count: typeof LogViewerCount;
|
|
176
|
+
}
|
|
177
|
+
declare const LogViewer: LogViewerComponent;
|
|
178
|
+
export default LogViewer;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import IconButton from '@mui/material/IconButton';
|
|
3
|
+
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import type { LogEntry } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Props for LogViewer.Count. The rest of the props go to the text element.
|
|
8
|
+
*/
|
|
9
|
+
export interface LogViewerCountProps extends Omit<React.ComponentProps<typeof Typography>, 'children'> {
|
|
10
|
+
/**
|
|
11
|
+
* Text of the count, for the number of loaded entries. Use it to add a unit or a note such as the
|
|
12
|
+
* time zone.
|
|
13
|
+
* @default (count) => `${count} entries`
|
|
14
|
+
*/
|
|
15
|
+
label?: (count: number) => string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* LogViewer.Count - The number of loaded entries, as small quiet text. In the toolbar it goes before the
|
|
19
|
+
* applied filter chips, or after the search when there are none, wherever it is placed among the other
|
|
20
|
+
* controls. It passes `className`, `data-*` and other
|
|
21
|
+
* text props to its element, and forwards its `ref` to it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LogViewerCount: React.ForwardRefExoticComponent<Omit<LogViewerCountProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
24
|
+
/**
|
|
25
|
+
* Props for LogViewer.TimeZone. The rest of the props go to the switch.
|
|
26
|
+
*/
|
|
27
|
+
export interface LogViewerTimeZoneProps extends Omit<React.ComponentProps<typeof ToggleButtonGroup>, 'children' | 'value' | 'exclusive' | 'onChange' | 'aria-label'> {
|
|
28
|
+
/**
|
|
29
|
+
* Accessible name of the switch.
|
|
30
|
+
* @default 'Time zone'
|
|
31
|
+
*/
|
|
32
|
+
label?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Text of the UTC choice.
|
|
35
|
+
* @default 'UTC'
|
|
36
|
+
*/
|
|
37
|
+
utcLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Text of the local time choice.
|
|
40
|
+
* @default 'Local'
|
|
41
|
+
*/
|
|
42
|
+
localLabel?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* LogViewer.TimeZone - The UTC and Local switch. It changes the zone timestamps are shown in; set
|
|
46
|
+
* `timeZone` and `onTimeZoneChange` on the LogViewer to control it. It passes `className`, `data-*` and
|
|
47
|
+
* other switch props to its element, and forwards its `ref` to it.
|
|
48
|
+
*/
|
|
49
|
+
export declare const LogViewerTimeZone: React.ForwardRefExoticComponent<Omit<LogViewerTimeZoneProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
/**
|
|
51
|
+
* Props for LogViewer.Sort. The rest of the props go to the button.
|
|
52
|
+
*/
|
|
53
|
+
export interface LogViewerSortProps extends Omit<React.ComponentProps<typeof IconButton>, 'children' | 'onClick' | 'aria-label'> {
|
|
54
|
+
/**
|
|
55
|
+
* Accessible name and tooltip while the newest entries are first.
|
|
56
|
+
* @default 'Sorted newest first. Switch to oldest first'
|
|
57
|
+
*/
|
|
58
|
+
newestFirstLabel?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Accessible name and tooltip while the oldest entries are first.
|
|
61
|
+
* @default 'Sorted oldest first. Switch to newest first'
|
|
62
|
+
*/
|
|
63
|
+
oldestFirstLabel?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* LogViewer.Sort - A button that switches between newest first and oldest first. It is not shown
|
|
67
|
+
* when the `time` column is sortable, because that column's heading does the same, unless the
|
|
68
|
+
* heading is hidden. It passes `className`, `data-*` and other button props to the button, and forwards
|
|
69
|
+
* its `ref` to it.
|
|
70
|
+
*/
|
|
71
|
+
export declare const LogViewerSort: React.ForwardRefExoticComponent<Omit<LogViewerSortProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
72
|
+
/**
|
|
73
|
+
* Props for LogViewer.Download. The rest of the props go to the button.
|
|
74
|
+
*/
|
|
75
|
+
export interface LogViewerDownloadProps extends Omit<React.ComponentProps<typeof IconButton>, 'children' | 'onClick' | 'aria-label'> {
|
|
76
|
+
/**
|
|
77
|
+
* Accessible name and tooltip. Use a function to say what the download holds: it receives the
|
|
78
|
+
* number of loaded entries and whether older ones are still to load.
|
|
79
|
+
* @default 'Download the N loaded entries', with 'Older entries are not included' added while
|
|
80
|
+
* older entries remain
|
|
81
|
+
*/
|
|
82
|
+
label?: string | ((info: {
|
|
83
|
+
count: number;
|
|
84
|
+
hasMoreOlder: boolean;
|
|
85
|
+
}) => string);
|
|
86
|
+
/**
|
|
87
|
+
* Replaces the default download, which saves the loaded entries, in the order shown, as a text
|
|
88
|
+
* file with one line per entry. Called with the loaded entries in the order shown.
|
|
89
|
+
*/
|
|
90
|
+
onDownload?: (entries: LogEntry[]) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Name of the file the default download saves.
|
|
93
|
+
* @default 'logs.log'
|
|
94
|
+
*/
|
|
95
|
+
fileName?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* LogViewer.Download - A button that saves the loaded entries. It is disabled while there are none.
|
|
99
|
+
* It passes `className`, `data-*` and other button props to the button, and forwards its `ref` to it.
|
|
100
|
+
*/
|
|
101
|
+
export declare const LogViewerDownload: React.ForwardRefExoticComponent<Omit<LogViewerDownloadProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
102
|
+
/**
|
|
103
|
+
* Props for LogViewer.Refresh. The rest of the props go to the button.
|
|
104
|
+
*/
|
|
105
|
+
export interface LogViewerRefreshProps extends Omit<React.ComponentProps<typeof IconButton>, 'children' | 'onClick' | 'aria-label'> {
|
|
106
|
+
/**
|
|
107
|
+
* Called when the button is used.
|
|
108
|
+
*/
|
|
109
|
+
onRefresh?: () => void;
|
|
110
|
+
/**
|
|
111
|
+
* Accessible name and tooltip.
|
|
112
|
+
* @default 'Refresh'
|
|
113
|
+
*/
|
|
114
|
+
label?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* LogViewer.Refresh - A button that asks the page to load the entries again. It is disabled while
|
|
118
|
+
* the first page loads. It passes `className`, `data-*` and other button props to the button, and
|
|
119
|
+
* forwards its `ref` to it.
|
|
120
|
+
*/
|
|
121
|
+
export declare const LogViewerRefresh: React.ForwardRefExoticComponent<Omit<LogViewerRefreshProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface LogViewerDetailsProps {
|
|
3
|
+
details: Record<string, unknown>;
|
|
4
|
+
expandLabel?: string;
|
|
5
|
+
collapseLabel?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Default expanded view of an entry: one labelled row per field.
|
|
9
|
+
*/
|
|
10
|
+
declare const LogViewerDetails: React.FC<LogViewerDetailsProps>;
|
|
11
|
+
export default LogViewerDetails;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SearchBarBaseProps } from '../SearchBar/SearchBarBase';
|
|
3
|
+
/**
|
|
4
|
+
* Props for LogViewer.Search. The rest of the props go to the search field.
|
|
5
|
+
*/
|
|
6
|
+
export interface LogViewerSearchProps extends Omit<SearchBarBaseProps, 'value' | 'onChange' | 'placeholder' | 'endAdornment' | 'onKeyDown'> {
|
|
7
|
+
/**
|
|
8
|
+
* The search text the page holds. The box keeps what the reader types, and shows this value when
|
|
9
|
+
* your page changes it, for example to clear the search.
|
|
10
|
+
* @default ''
|
|
11
|
+
*/
|
|
12
|
+
value?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Called with the search text once typing pauses, at once on Enter, and when the reader clears
|
|
15
|
+
* the box. The viewer does not search: apply the text to your data here.
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (value: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Placeholder, which is also the accessible name.
|
|
20
|
+
* @default 'Search logs'
|
|
21
|
+
*/
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Accessible name of the clear button.
|
|
25
|
+
* @default 'Clear search'
|
|
26
|
+
*/
|
|
27
|
+
clearLabel?: string;
|
|
28
|
+
/**
|
|
29
|
+
* How long typing must pause, in milliseconds, before `onChange` is called. Use 0 to report
|
|
30
|
+
* every change.
|
|
31
|
+
* @default 300
|
|
32
|
+
*/
|
|
33
|
+
debounceMs?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* LogViewer.Search - The search box of a LogViewer, for its toolbar. The text is reported once typing pauses, or at once on Enter or
|
|
37
|
+
* when cleared, so a page that searches on a server does not send a request for every key. It is
|
|
38
|
+
* never disabled while the page loads, because that would take the focus away mid-typing. It passes
|
|
39
|
+
* `className`, `data-*` and other search field props to its field, and forwards its `ref` to it.
|
|
40
|
+
*/
|
|
41
|
+
declare const LogViewerSearch: React.ForwardRefExoticComponent<Omit<LogViewerSearchProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export default LogViewerSearch;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { BoxProps } from '@mui/material/Box';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import type { LogEntry } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the LogViewer.Stream component. The rest of the props go to the root element.
|
|
7
|
+
*/
|
|
8
|
+
export interface LogViewerStreamProps extends Omit<BoxProps, 'children' | 'maxHeight' | 'onScroll' | 'onWheel'> {
|
|
9
|
+
/**
|
|
10
|
+
* Replaces the default expanded view (a list of `details` fields) of an entry.
|
|
11
|
+
*/
|
|
12
|
+
renderDetails?: (entry: LogEntry) => React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Largest height of the list, in pixels, before it scrolls.
|
|
15
|
+
* @default 640
|
|
16
|
+
*/
|
|
17
|
+
maxHeight?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Distance, in pixels, from the older end at which scrolling loads older entries.
|
|
20
|
+
* @default 72
|
|
21
|
+
*/
|
|
22
|
+
scrollTriggerPx?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Title of the empty state, shown when there are no entries, nothing is loading and there is no
|
|
25
|
+
* error. The layout is the same in every product; only the words are yours.
|
|
26
|
+
* @default 'No logs found'
|
|
27
|
+
*/
|
|
28
|
+
emptyTitle?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Description under the title of the empty state, such as what the reader can try next. Nothing
|
|
31
|
+
* is shown when omitted.
|
|
32
|
+
*/
|
|
33
|
+
emptyDescription?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Title of the empty state while the time range filter has no range, which is when nothing has been asked for yet.
|
|
36
|
+
* @default 'Select a time range'
|
|
37
|
+
*/
|
|
38
|
+
noRangeTitle?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Description under the title while the time range filter has no range.
|
|
41
|
+
* @default 'Choose a time range to load logs.'
|
|
42
|
+
*/
|
|
43
|
+
noRangeDescription?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Text of the retry button of the error.
|
|
46
|
+
* @default 'Try again'
|
|
47
|
+
*/
|
|
48
|
+
retryLabel?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Text of the load older button.
|
|
51
|
+
* @default 'Load older logs'
|
|
52
|
+
*/
|
|
53
|
+
loadOlderLabel?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Text shown at the older end when there is nothing older to load.
|
|
56
|
+
* @default 'No older logs'
|
|
57
|
+
*/
|
|
58
|
+
noMoreOlderLabel?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Text shown at the newer end. Nothing is shown when omitted.
|
|
61
|
+
*/
|
|
62
|
+
newestLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Text of each entry's Copy button.
|
|
65
|
+
* @default 'Copy'
|
|
66
|
+
*/
|
|
67
|
+
copyLabel?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Text of each entry's Copy link button.
|
|
70
|
+
* @default 'Copy link'
|
|
71
|
+
*/
|
|
72
|
+
copyLinkLabel?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Text that replaces the Copy and Copy link labels for a moment after the copy succeeded.
|
|
75
|
+
* @default 'Copied'
|
|
76
|
+
*/
|
|
77
|
+
copiedLabel?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Accessible name of the button that opens or closes an entry.
|
|
80
|
+
* @default ({ open }) => (open ? 'Hide details' : 'Show details')
|
|
81
|
+
*/
|
|
82
|
+
detailsToggleLabel?: (info: {
|
|
83
|
+
open: boolean;
|
|
84
|
+
}) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Accessible name of the region that holds an opened entry's details. It receives the entry.
|
|
87
|
+
* @default (entry) => `Details for ${entry.id}`
|
|
88
|
+
*/
|
|
89
|
+
detailsLabel?: (entry: LogEntry) => string;
|
|
90
|
+
/**
|
|
91
|
+
* Accessible name of the button that opens a collapsed object or list in the default details.
|
|
92
|
+
* @default 'Expand'
|
|
93
|
+
*/
|
|
94
|
+
expandNodeLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Accessible name of the button that closes an open object or list in the default details.
|
|
97
|
+
* @default 'Collapse'
|
|
98
|
+
*/
|
|
99
|
+
collapseNodeLabel?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Accessible name of a sort control in a column heading.
|
|
102
|
+
* @default (label) => `Sort by ${label}`
|
|
103
|
+
*/
|
|
104
|
+
sortColumnLabel?: (label: string) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Accessible name of a filter control in a column heading.
|
|
107
|
+
* @default (label) => `Filter by ${label}`
|
|
108
|
+
*/
|
|
109
|
+
filterColumnLabel?: (label: string) => string;
|
|
110
|
+
/**
|
|
111
|
+
* Accessible name of the loading indicator.
|
|
112
|
+
* @default 'Loading logs'
|
|
113
|
+
*/
|
|
114
|
+
loadingLabel?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Accessible name of the scrolling list.
|
|
117
|
+
* @default 'Log stream'
|
|
118
|
+
*/
|
|
119
|
+
label?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Custom styles for the root element.
|
|
122
|
+
*/
|
|
123
|
+
sx?: SxProps<Theme>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* LogViewer.Stream - The scrolling list of entries, with its loading, empty and error states.
|
|
127
|
+
*
|
|
128
|
+
* Older entries load when the reader scrolls toward the older end, or uses the button there. Only
|
|
129
|
+
* movement toward that end loads, so the list does not load just because it starts at the top.
|
|
130
|
+
*/
|
|
131
|
+
declare const LogViewerStream: React.ForwardRefExoticComponent<Omit<LogViewerStreamProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
132
|
+
export default LogViewerStream;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { BoxProps } from '@mui/material/Box';
|
|
3
|
+
/**
|
|
4
|
+
* Props for LogViewer.Toolbar. The rest of the props go to the root element.
|
|
5
|
+
*/
|
|
6
|
+
export interface LogViewerToolbarProps extends Omit<BoxProps, 'children'> {
|
|
7
|
+
/**
|
|
8
|
+
* The controls of the toolbar: `LogViewer.Search`, `LogViewer.TimeZone`, `LogViewer.Sort`,
|
|
9
|
+
* `LogViewer.Download`, `LogViewer.Refresh` and `LogViewer.Count`. Include the ones you want. The
|
|
10
|
+
* layout is the same in every product: the filters and the search are on the left, and the other
|
|
11
|
+
* controls are on the right, in the order given. The count goes before the applied filter chips,
|
|
12
|
+
* or after the search when there are none.
|
|
13
|
+
*/
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Accessible name of the toolbar.
|
|
17
|
+
* @default 'Log toolbar'
|
|
18
|
+
*/
|
|
19
|
+
label?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible name of the group of applied filter chips.
|
|
22
|
+
* @default 'Applied filters'
|
|
23
|
+
*/
|
|
24
|
+
appliedFiltersLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Shows a removable chip below the toolbar for each applied filter, with a button that removes them all. Without the chips, the
|
|
27
|
+
* reader can no longer see which filters are active at a glance, so turn them off only when
|
|
28
|
+
* the page shows that some other way.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
showFilterChips?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The action of an applied filter's chip, which reopens the filter. It receives the filter's label.
|
|
34
|
+
* The chip's accessible name is the text it shows, then this: `Status: Failed, Change status filter`.
|
|
35
|
+
* @default (name) => `Change ${name} filter`, with the name in lower case
|
|
36
|
+
*/
|
|
37
|
+
changeFilterLabel?: (name: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Accessible name of the remove icon of an applied filter's chip. It receives the filter's label.
|
|
40
|
+
* @default (name) => `Remove ${name} filter`, with the name in lower case
|
|
41
|
+
*/
|
|
42
|
+
removeFilterLabel?: (name: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Text of the button that removes every applied filter. It is shown with the chips, when more than one is applied.
|
|
45
|
+
* @default 'Clear all'
|
|
46
|
+
*/
|
|
47
|
+
clearAllLabel?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* LogViewer.Toolbar - The filters of the viewer, the chips of the applied ones, and the controls
|
|
51
|
+
* given as children. Filters that a column heading holds are not shown here as buttons, only as
|
|
52
|
+
* chips. Place it above `LogViewer.Stream`. It passes `className`, `sx`, `data-*` and other props to
|
|
53
|
+
* its root element, and forwards its `ref` to it.
|
|
54
|
+
*/
|
|
55
|
+
declare const LogViewerToolbar: React.ForwardRefExoticComponent<Omit<LogViewerToolbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
export default LogViewerToolbar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LogColumn } from './types';
|
|
2
|
+
/** The face the entries are set in. */
|
|
3
|
+
export declare const MONOSPACE = "'Consolas', 'Monaco', 'Courier New', monospace";
|
|
4
|
+
/**
|
|
5
|
+
* The width of a column as a CSS length, or `undefined` when the column takes a share of what is
|
|
6
|
+
* left. Used for the `<col>` of the table, which sizes its columns.
|
|
7
|
+
*/
|
|
8
|
+
export declare const columnWidth: (column: LogColumn) => string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The narrowest width the columns, their gaps and the row padding fit in, as a CSS length. A list
|
|
11
|
+
* narrower than this scrolls sideways, and its heading row scrolls with it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const columnsMinWidth: (columns: LogColumn[]) => string;
|
|
14
|
+
/**
|
|
15
|
+
* The heading of a column: its label, or the standard one for the built-in columns.
|
|
16
|
+
*/
|
|
17
|
+
export declare const columnLabel: (column: LogColumn) => string;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { LogColumn, LogEntry, LogFilterDefinition, LogFilterValue, LogFilterValues, LogLevel, LogSort, LogTimeZone, LogViewerOrder } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Context value shared by the parts of a LogViewer. It holds the data and the state the root
|
|
5
|
+
* LogViewer owns; what the parts look like (their words and sizes) is set on the parts.
|
|
6
|
+
*/
|
|
7
|
+
export interface LogViewerContextValue {
|
|
8
|
+
/** Entries in display order. */
|
|
9
|
+
entries: LogEntry[];
|
|
10
|
+
/** Number of entries loaded. */
|
|
11
|
+
count: number;
|
|
12
|
+
/** Which end of the list holds the newest entries. */
|
|
13
|
+
order: LogViewerOrder;
|
|
14
|
+
/** Switches between newest first and oldest first. */
|
|
15
|
+
toggleOrder: () => void;
|
|
16
|
+
/** True while the first page is loading. */
|
|
17
|
+
loading: boolean;
|
|
18
|
+
/** True while older entries are loading. */
|
|
19
|
+
loadingOlder: boolean;
|
|
20
|
+
/** True when entries older than the loaded ones can still be loaded. */
|
|
21
|
+
hasMoreOlder: boolean;
|
|
22
|
+
/** Asks for older entries. */
|
|
23
|
+
onLoadOlder?: () => void | Promise<unknown>;
|
|
24
|
+
/** Error shown above the list. */
|
|
25
|
+
error?: React.ReactNode;
|
|
26
|
+
/** Tries again after an error. The error shows a button for it when set. */
|
|
27
|
+
onRetry?: () => void;
|
|
28
|
+
/** Warning shown above the list. */
|
|
29
|
+
warning?: React.ReactNode;
|
|
30
|
+
/** The time zone timestamps are shown in. */
|
|
31
|
+
timeZone: LogTimeZone;
|
|
32
|
+
/** Switches the time zone. */
|
|
33
|
+
setTimeZone: (timeZone: LogTimeZone) => void;
|
|
34
|
+
/** The columns of each entry. */
|
|
35
|
+
columns: LogColumn[];
|
|
36
|
+
/** True when the heading row is visually hidden and its sort and filter controls are not offered. */
|
|
37
|
+
hideHeading: boolean;
|
|
38
|
+
/** The filters the viewer shows. */
|
|
39
|
+
filters: LogFilterDefinition[];
|
|
40
|
+
/**
|
|
41
|
+
* True when there is a time range filter, no range is applied to it, and nothing is loaded. The viewer then asks
|
|
42
|
+
* for a range instead of saying that no logs were found.
|
|
43
|
+
*/
|
|
44
|
+
awaitingRange: boolean;
|
|
45
|
+
/** The applied filters, keyed by filter id. */
|
|
46
|
+
filterValues: LogFilterValues;
|
|
47
|
+
/** Called with a filter's id and its new value. */
|
|
48
|
+
onFilterChange?: (id: string, value: LogFilterValue) => void;
|
|
49
|
+
/** The column the entries are sorted by, when it is not the time. */
|
|
50
|
+
sort: LogSort | null;
|
|
51
|
+
/** Called when the reader sorts by a column other than the time. */
|
|
52
|
+
onSortChange?: (sort: LogSort | null) => void;
|
|
53
|
+
/**
|
|
54
|
+
* The time range picker that is open, if any: the id of its filter and the element it is placed
|
|
55
|
+
* under (`null` for the filter's own button). A chip or a column heading opens a picker through
|
|
56
|
+
* this, so each filter is drawn once, in the heading or in the toolbar.
|
|
57
|
+
*/
|
|
58
|
+
rangePicker: {
|
|
59
|
+
id: string;
|
|
60
|
+
anchor: HTMLElement | null;
|
|
61
|
+
} | null;
|
|
62
|
+
/** Opens the time range picker of a filter, under `anchor` (or under its own button when `null`). */
|
|
63
|
+
openRangePicker: (id: string, anchor: HTMLElement | null) => void;
|
|
64
|
+
/** Closes the open time range picker. */
|
|
65
|
+
closeRangePicker: () => void;
|
|
66
|
+
/** Called after a Copy button is used, with whether the text was copied. */
|
|
67
|
+
onCopy?: (entry: LogEntry, copied: boolean) => void;
|
|
68
|
+
/** Gives the link to one entry. Each entry shows a Copy link button when set. */
|
|
69
|
+
getEntryLink?: (entry: LogEntry) => string | undefined;
|
|
70
|
+
/** Called after a Copy link button is used, with whether the link was copied. */
|
|
71
|
+
onCopyLink?: (entry: LogEntry, copied: boolean) => void;
|
|
72
|
+
/** The entry to mark and scroll into view, such as the one a shared link points at. */
|
|
73
|
+
highlightedEntryId?: string;
|
|
74
|
+
/** The text each level is shown as. */
|
|
75
|
+
levelLabels: Record<LogLevel, string>;
|
|
76
|
+
}
|
|
77
|
+
export declare const LogViewerContext: React.Context<LogViewerContextValue | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the LogViewer context and throws when used outside a LogViewer.
|
|
80
|
+
*/
|
|
81
|
+
export declare const useLogViewerRequired: () => LogViewerContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LogColumn, LogEntry, LogLevel, LogTimeZone } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The plain text of an entry: its `copyText`, or the text of its columns joined by spaces. Entries
|
|
4
|
+
* with no text have none.
|
|
5
|
+
*/
|
|
6
|
+
export declare const entryText: (entry: LogEntry, columns: LogColumn[], timeZone: LogTimeZone, levelLabels: Record<LogLevel, string>) => string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* One line per entry that has text, in the order given.
|
|
9
|
+
*/
|
|
10
|
+
export declare const buildLogText: (entries: LogEntry[], columns: LogColumn[], timeZone: LogTimeZone, levelLabels: Record<LogLevel, string>) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Saves text as a file through the browser. Does nothing outside a browser.
|
|
13
|
+
*/
|
|
14
|
+
export declare const saveTextFile: (text: string, fileName: string) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TimeRange } from '../TimeRangeFilter';
|
|
2
|
+
import type { LogFilterValue } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* True when the value of a filter is a time range, which is the only filter value that is an object.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isRange: (value: LogFilterValue) => value is TimeRange;
|
|
7
|
+
/**
|
|
8
|
+
* True when a filter has a value to show: a time range, or a text that is not empty. An unset
|
|
9
|
+
* filter, or one set to an empty text, has none.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isApplied: (value: LogFilterValue) => boolean;
|