Skip to content

Commit a80a7dd

Browse files
author
Marco
committed
Merge branch 'main' into datasetfix
2 parents 84d80be + c5b27e5 commit a80a7dd

File tree

8 files changed

+41
-23
lines changed

8 files changed

+41
-23
lines changed

components/webui/client/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ const EslintConfig = [
3535
// TypeBox imports
3636
"Decode",
3737
"Encode",
38+
"Type.Literal",
39+
"Type.Optional",
3840
"Type.Transform",
3941
"Type.Union",
40-
"Type.Literal",
4142
"Value.Parse",
4243
],
4344
},

components/webui/client/src/api/query/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import axios, {
22
AxiosProgressEvent,
33
AxiosResponse,
44
} from "axios";
5+
import {Nullable} from "src/typings/common";
56

67
import {
78
ExtractStreamResp,
@@ -10,7 +11,7 @@ import {
1011

1112

1213
interface SubmitExtractStreamJobProps {
13-
dataset: string;
14+
dataset: Nullable<string>;
1415
extractJobType: QUERY_JOB_TYPE;
1516
streamId: string;
1617
logEventIdx: number;

components/webui/client/src/components/VirtualTable/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,15 @@ const VirtualTable = <RecordType extends object = Record<string, unknown>>({
2323
...tableProps
2424
}: VirtualTableProps<RecordType>) => {
2525
const containerRef = useRef<HTMLDivElement>(null);
26-
const scrollNodeRef = useRef<HTMLElement>(null);
2726

2827
const handleKeyDown = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {
2928
if (null === containerRef.current) {
3029
return;
3130
}
3231

33-
const scrollNode = scrollNodeRef.current;
34-
if (null === scrollNode) {
35-
scrollNodeRef.current = containerRef.current.querySelector<HTMLElement>(
36-
VIRTUAL_TABLE_HOLDER_SELECTOR
37-
);
38-
}
32+
const scrollNode = containerRef.current.querySelector<HTMLElement>(
33+
VIRTUAL_TABLE_HOLDER_SELECTOR
34+
);
3935

4036
if (null === scrollNode) {
4137
return;

components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ const TimeRangeInput = () => {
4646
return;
4747
}
4848

49-
updateTimeRange(dates);
49+
// Treat range picker selection as UTC by dropping any timezone offset supplied by antd.
50+
updateTimeRange([
51+
dates[0].utc(true),
52+
dates[1].utc(true),
53+
]);
5054
};
5155

5256
return (
@@ -68,8 +72,8 @@ const TimeRangeInput = () => {
6872
onChange={handleSelectChange}/>
6973
{timeRangeOption === TIME_RANGE_OPTION.CUSTOM && (
7074
<DatePicker.RangePicker
75+
allowClear={true}
7176
className={styles["rangePicker"] || ""}
72-
showNow={true}
7377
showTime={true}
7478
size={"large"}
7579
value={timeRange}

components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ const LogViewerLink = ({
3535
const {token} = theme.useToken();
3636
const cachedDataset = useSearchStore((state) => state.cachedDataset);
3737

38+
const searchParams = new URLSearchParams({
39+
type: encodeURIComponent(STREAM_TYPE),
40+
streamId: encodeURIComponent(streamId),
41+
logEventIdx: encodeURIComponent(logEventIdx),
42+
});
43+
44+
if (null !== cachedDataset) {
45+
searchParams.append("dataset", cachedDataset);
46+
}
47+
3848
return (
3949
<Tooltip title={"Open file"}>
4050
<Typography.Text>
@@ -44,11 +54,7 @@ const LogViewerLink = ({
4454
target={"_blank"}
4555
to={{
4656
pathname: "/streamFile",
47-
search:
48-
`?type=${encodeURIComponent(STREAM_TYPE)}` +
49-
`&streamId=${encodeURIComponent(streamId)}` +
50-
`&logEventIdx=${encodeURIComponent(logEventIdx)}` +
51-
`&dataset=${encodeURIComponent(cachedDataset)}`,
57+
search: `?${searchParams.toString()}`,
5258
}}
5359
>
5460
<LinkOutlined/>

components/webui/client/src/pages/SearchPage/SearchState/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import dayjs from "dayjs";
2+
import {Nullable} from "src/typings/common";
23
import {create} from "zustand";
34

45
import {TimelineConfig} from "../../../components/ResultsTimeline/typings";
@@ -16,7 +17,7 @@ import {SEARCH_UI_STATE} from "./typings";
1617
*/
1718
const SEARCH_STATE_DEFAULT = Object.freeze({
1819
aggregationJobId: null,
19-
cachedDataset: "",
20+
cachedDataset: null,
2021
numSearchResultsTable: 0,
2122
numSearchResultsTimeline: 0,
2223
queryIsCaseSensitive: false,
@@ -40,7 +41,7 @@ interface SearchState {
4041
* dataset so modifications to the selector do not change dataset used in extract stream job for
4142
* log viewer links.
4243
*/
43-
cachedDataset: string;
44+
cachedDataset: Nullable<string>;
4445

4546
/**
4647
* The number of search table results.

components/webui/client/src/typings/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const ExtractJobSearchParams = Type.Object({
4949
),
5050
streamId: Type.String(),
5151
logEventIdx: Type.Number(),
52-
dataset: Type.String(),
52+
dataset: Type.Optional(Type.String()),
5353
});
5454

5555
interface ExtractStreamResp {

components/webui/client/src/ui/QueryStatus.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,26 @@ const QueryStatus = () => {
6565
return;
6666
}
6767

68+
const {
69+
dataset,
70+
type,
71+
logEventIdx,
72+
streamId,
73+
} = parseResult;
74+
6875
submitExtractStreamJob({
69-
dataset: parseResult.dataset,
76+
dataset: "undefined" === typeof dataset ?
77+
null :
78+
dataset,
7079

7180
// `parseResult.type` must be valid key since parsed using with typebox type
7281
// `ExtractJobSearchParams`.
73-
extractJobType: EXTRACT_JOB_TYPE[parseResult.type as keyof typeof EXTRACT_JOB_TYPE],
74-
logEventIdx: parseResult.logEventIdx,
82+
extractJobType: EXTRACT_JOB_TYPE[type as keyof typeof EXTRACT_JOB_TYPE],
83+
logEventIdx: logEventIdx,
7584
onUploadProgress: () => {
7685
setQueryState(QUERY_LOADING_STATE.WAITING);
7786
},
78-
streamId: parseResult.streamId,
87+
streamId: streamId,
7988
})
8089
.then(({data}) => {
8190
setQueryState(QUERY_LOADING_STATE.LOADING);

0 commit comments

Comments
 (0)