Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
004a12d
latest
Sep 2, 2025
7194d78
latest
Sep 4, 2025
d5fc91f
Merge branch 'main' into inputMona
Sep 4, 2025
dc79169
latest
Sep 4, 2025
52e83a3
latest
Sep 8, 2025
630a360
Merge branch 'main' into inputMona
davemarco Sep 8, 2025
aa3968c
latest
Sep 9, 2025
fb61505
latest
Sep 10, 2025
af4a2b0
latest
Sep 11, 2025
202d002
latest
Sep 11, 2025
6aa31be
latest
Sep 11, 2025
2cc9f2f
merge
Sep 11, 2025
e30211e
latest
Sep 11, 2025
a8daeb2
latest
Sep 11, 2025
148379c
latest
Sep 11, 2025
d8ec46c
latest
Sep 11, 2025
84a5840
latest
Sep 12, 2025
6c3a065
Merge branch 'main' into playout
davemarco Sep 12, 2025
8da8133
lint
Sep 12, 2025
cfae7cc
Merge branch 'playout' of https://github.com/davemarco/clp into playout
Sep 12, 2025
7a3b7f9
latest
Sep 12, 2025
8d41f91
latest
Sep 17, 2025
10f9a2d
latest
Sep 17, 2025
1f2a97d
Merge branch 'main' into playout
Sep 17, 2025
96b46a1
latest
Sep 17, 2025
7eb61ac
Merge branch 'main' into playout
davemarco Sep 17, 2025
847da48
latest
Sep 17, 2025
0631199
latest
Sep 17, 2025
96e8965
Merge branch 'playout' of https://github.com/davemarco/clp into playout
Sep 17, 2025
0db25b1
latest
Sep 17, 2025
a18abc3
Merge branch 'main' into playout
davemarco Sep 17, 2025
1a30f7e
latest
Sep 19, 2025
c4e7840
Merge branch 'main' into newFrom2
davemarco Sep 23, 2025
e6c8d93
latest
Sep 23, 2025
d9ee25e
Merge branch 'main' into newFrom2
davemarco Sep 23, 2025
edefa6e
Merge branch 'main' into newFrom2
hoophalab Sep 23, 2025
6b85632
Merge branch 'main' into newFrom2
davemarco Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import {useEffect} from "react";
import {useQuery} from "@tanstack/react-query";
import {message, Select, SelectProps} from "antd";
import useSearchStore from "../../SearchState/index";
import {SEARCH_UI_STATE} from "../../SearchState/typings";
import {fetchDatasetNames} from "./sql";

const DatasetSelect = (selectProps: SelectProps) => {
const dataset = useSearchStore((state) => state.selectDataset);
const updateDataset = useSearchStore((state) => state.updateSelectDataset);
const searchUiState = useSearchStore((state) => state.searchUiState);

const [messageApi, contextHolder] = message.useMessage();

const {data, isPending, isSuccess, error} = useQuery({
queryKey: ["datasets"],
queryFn: fetchDatasetNames,
});

useEffect(() => {
if (isSuccess) {
if ("undefined" !== typeof data[0] && null === dataset) {
updateDataset(data[0]);
}
}
}, [isSuccess, data, dataset, updateDataset]);

useEffect(() => {
if (error) {
messageApi.error({
key: "fetchError",
content: "Error fetching datasets.",
});
}
}, [error, messageApi]);

useEffect(() => {
if (isSuccess && 0 === data.length) {
messageApi.warning({
key: "noData",
content: "No data has been ingested. Please ingest data to search.",
});
updateDataset(null);
}
}, [data, isSuccess, messageApi, updateDataset]);

const handleDatasetChange = (value: string) => {
updateDataset(value);
};

return (
<>
{contextHolder}
<Select
loading={isPending}
options={(data || []).map((option) => ({label: option, value: option}))}
value={dataset}
size="middle"
disabled={
searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING ||
searchUiState === SEARCH_UI_STATE.QUERYING
}
onChange={handleDatasetChange}
{...selectProps}
/>
</>
);
};

export default DatasetSelect;
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import {useEffect} from "react";

import {useQuery} from "@tanstack/react-query";
import {
message,
Select,
} from "antd";

import InputLabel from "../../../../components/InputLabel";
import useSearchStore from "../../SearchState/index";
import {SEARCH_UI_STATE} from "../../SearchState/typings";
import styles from "./index.module.css";
import {fetchDatasetNames} from "./sql";
import DatasetSelect from "./DatasetSelect";


/**
Expand All @@ -19,80 +9,10 @@ import {fetchDatasetNames} from "./sql";
* @return
*/
const Dataset = () => {
const dataset = useSearchStore((state) => state.selectDataset);
const updateDataset = useSearchStore((state) => state.updateSelectDataset);
const searchUiState = useSearchStore((state) => state.searchUiState);

const [messageApi, contextHolder] = message.useMessage();

const {data, isPending, isSuccess, error} = useQuery({
queryKey: ["datasets"],
queryFn: fetchDatasetNames,
});

// Update the selected dataset to the first dataset in the response. The dataset is only
// updated if it isn't already set (i.e., on initial response).
useEffect(() => {
if (isSuccess) {
if ("undefined" !== typeof data[0] && null === dataset) {
updateDataset(data[0]);
}
}
}, [isSuccess,
data,
dataset,
updateDataset]);

// Display error message if the query fails since user querying is disabled if no datasets.
useEffect(() => {
if (error) {
messageApi.error({
key: "fetchError",
content: "Error fetching datasets.",
});
}
}, [error,
messageApi]);

// Display warning message if response empty since user querying is disabled if no
// datasets.
useEffect(() => {
if (isSuccess && 0 === data.length) {
messageApi.warning({
key: "noData",
content: "No data has been ingested. Please ingest data to search.",
});

// If all datasets were deleted, the dataset state must be reset to null to disable
// submit button since dataset option required to query clp-s.
updateDataset(null);
}
}, [data,
isSuccess,
messageApi,
updateDataset]);

const handleDatasetChange = (value: string) => {
updateDataset(value);
};

return (
<div className={styles["datasetContainer"]}>
{contextHolder}
<InputLabel>Dataset</InputLabel>
<Select
className={styles["select"] || ""}
loading={isPending}
options={(data || []).map((option) => ({label: option, value: option}))}
placeholder={"None"}
showSearch={true}
size={"middle"}
value={dataset}
disabled={
searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING ||
searchUiState === SEARCH_UI_STATE.QUERYING
}
onChange={handleDatasetChange}/>
<DatasetSelect className={styles["select"] || ""} />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import InputLabel from "../../../../../components/InputLabel";
import SqlInput from "../../../../../components/SqlInput";
import DatasetSelect from "../../Dataset/DatasetSelect";
import guidedGrid from "./index.module.css";


Expand All @@ -11,9 +11,11 @@ import guidedGrid from "./index.module.css";
const From = () => (
<div className={guidedGrid["from"]}>
<InputLabel>FROM</InputLabel>
<SqlInput
className={guidedGrid["noLeftBorderRadius"] || ""}
disabled={false}/>
<DatasetSelect
className={
`${guidedGrid["noLeftBorderRadiusSelect"]} ${
guidedGrid["widthSelect"]}`
}/>
</div>
);

Expand Down
Loading