Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the indexes added to the tree #142

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
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
29 changes: 16 additions & 13 deletions public/components/SQLPage/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ export const TableView = ({ http, selectedItems, updateSQLQueries }: CustomView)
const [selectedChildNode, setSelectedChildNode] = useState<string | null>(null);
const [indexData, setIndexedData] = useState<string[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [indiciesData, setIndiciesData] = useState<string[]>([]);
const [indexFlyout, setIndexFlyout] = useState(<></>);

let indiciesData: string[] = [];
const resetFlyout = () => {
setIndexFlyout(<></>);
};
Expand Down Expand Up @@ -135,9 +134,13 @@ export const TableView = ({ http, selectedItems, updateSQLQueries }: CustomView)
};
getJobId(coverQuery, http, (id) => {
get_async_query_results(id, http, (data) => {
data = [].concat(...data);
indiciesData.concat(data);
setIndexedData(indiciesData);
const res = [].concat(data);
const final = indiciesData.concat(...res);
setIndexedData(final);
setChildLoadingStates((prevState) => ({
...prevState,
[nodeLabel1]: false,
}));
});
});
};
Expand All @@ -157,13 +160,8 @@ export const TableView = ({ http, selectedItems, updateSQLQueries }: CustomView)
get_async_query_results(id, http, (data) => {
if (data.length > 0) {
indiciesData.push(SKIPPING_INDEX);
callCoverQuery(nodeLabel1);

setChildLoadingStates((prevState) => ({
...prevState,
[nodeLabel1]: false,
}));
}
callCoverQuery(nodeLabel1);
});
});
};
Expand All @@ -177,6 +175,7 @@ export const TableView = ({ http, selectedItems, updateSQLQueries }: CustomView)
icon: <EuiIcon type="database" size="m" />,
id: 'element_' + index,
callback: () => {
setChildData([])
handleNodeClick(database);
},
isSelectable: true,
Expand All @@ -192,8 +191,12 @@ export const TableView = ({ http, selectedItems, updateSQLQueries }: CustomView)
id: `${database}_${table}`,
icon: <EuiIcon type="tableDensityCompact" size="s" />,
callback: () => {
setIndexedData([]);
setIndexedData([])
handleChildClick(table);
setChildLoadingStates((prevState) => ({
...prevState,
[selectedChildNode]: false,
}));
},
sSelectable: true,
isExpanded: true,
Expand All @@ -220,7 +223,7 @@ export const TableView = ({ http, selectedItems, updateSQLQueries }: CustomView)
<>
<EuiFlexGroup>
{isLoading ? (
<EuiFlexGroup alignItems="center" gutterSize='s'>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>Loading your databases</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLoadingSpinner size="m" />
Expand Down