-
Notifications
You must be signed in to change notification settings - Fork 92
feat(webui): Add drawer to display guided query and errors. #1421
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
231fbfb
latest
0c9f08c
Merge branch 'main' into rmlimit
davemarco ea35716
Merge branch 'main' into rmlimit
davemarco 0ec3324
merge
7e43349
latest
dfc1d9e
latest
e907b4a
latest
7be8b42
latest
9a31a11
latest
9251b6a
latest
9914748
latest
bbb9754
latest
12ef381
latest
76a57ca
latest
cb7a64f
Merge branch 'main' into drawer
hoophalab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ts/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/OpenQueryDrawerButton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import {EyeOutlined} from "@ant-design/icons"; | ||
| import { | ||
| Button, | ||
| theme, | ||
| Tooltip, | ||
| } from "antd"; | ||
|
|
||
| import useSearchStore from "../../SearchState"; | ||
| import usePrestoSearchState from "../../SearchState/Presto"; | ||
| import {SEARCH_UI_STATE} from "../../SearchState/typings"; | ||
|
|
||
|
|
||
| /** | ||
| * Renders a button that opens the query drawer. | ||
| * | ||
| * @return | ||
| */ | ||
|
hoophalab marked this conversation as resolved.
|
||
| const OpenQueryDrawerButton = () => { | ||
| const {token} = theme.useToken(); | ||
| const updateQueryDrawerOpen = usePrestoSearchState((s) => s.updateQueryDrawerOpen); | ||
| const searchUiState = useSearchStore((s) => s.searchUiState); | ||
|
|
||
| const tooltipText = | ||
| searchUiState === SEARCH_UI_STATE.FAILED ? | ||
| "See modified query and error" : | ||
| "See modified query"; | ||
|
|
||
| return ( | ||
| <Tooltip title={tooltipText}> | ||
| <Button | ||
| color={"default"} | ||
| size={"small"} | ||
| variant={"filled"} | ||
| icon={ | ||
| <EyeOutlined | ||
| style={{ | ||
| color: token.colorTextSecondary, | ||
| }}/> | ||
| } | ||
| onClick={() => { | ||
| updateQueryDrawerOpen(true); | ||
| }}/> | ||
|
hoophalab marked this conversation as resolved.
|
||
| </Tooltip> | ||
| ); | ||
| }; | ||
|
|
||
| export default OpenQueryDrawerButton; | ||
5 changes: 5 additions & 0 deletions
5
...nents/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/QueryDrawer.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 16px; | ||
| } |
86 changes: 86 additions & 0 deletions
86
components/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/QueryDrawer.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import { | ||
| Alert, | ||
| Drawer, | ||
| theme, | ||
| Typography, | ||
| } from "antd"; | ||
|
|
||
| import SqlEditor from "../../../../components/SqlEditor"; | ||
| import useSearchStore from "../../SearchState"; | ||
| import usePrestoSearchState from "../../SearchState/Presto"; | ||
| import {SEARCH_UI_STATE} from "../../SearchState/typings"; | ||
| import styles from "./QueryDrawer.module.css"; | ||
|
|
||
|
|
||
| const {Text} = Typography; | ||
|
|
||
| /** | ||
| * Renders the query details drawer, showing the modified SQL query and error (if any). | ||
| * | ||
| * @return | ||
| */ | ||
| const QueryDrawer = () => { | ||
| const {token} = theme.useToken(); | ||
| const queryDrawerOpen = usePrestoSearchState((s) => s.queryDrawerOpen); | ||
| const errorName = usePrestoSearchState((s) => s.errorName); | ||
| const errorMsg = usePrestoSearchState((s) => s.errorMsg); | ||
| const cachedGuidedSearchQueryString = | ||
| usePrestoSearchState((s) => s.cachedGuidedSearchQueryString); | ||
| const updateQueryDrawerOpen = usePrestoSearchState((s) => s.updateQueryDrawerOpen); | ||
| const searchUiState = useSearchStore((s) => s.searchUiState); | ||
| const searchJobId = useSearchStore((s) => s.searchJobId); | ||
|
|
||
| return ( | ||
| <Drawer | ||
| open={queryDrawerOpen} | ||
| placement={"right"} | ||
| title={`Query Details \n ${searchJobId ?? ""}`} | ||
|
hoophalab marked this conversation as resolved.
|
||
| styles={{ | ||
| body: {background: token.colorBgLayout}, | ||
| header: { | ||
| background: token.colorBgContainer, | ||
| }, | ||
| }} | ||
| onClose={() => { | ||
| updateQueryDrawerOpen(false); | ||
| }} | ||
| > | ||
| <div className={styles["container"]}> | ||
| <Text strong={true}> | ||
| {"Modified SQL Query: "} | ||
| </Text> | ||
| <div> | ||
| <SqlEditor | ||
| disabled={false} | ||
| height={"120px"} | ||
| value={cachedGuidedSearchQueryString} | ||
| options={{ | ||
| automaticLayout: true, | ||
| folding: false, | ||
| lineNumbers: "on", | ||
| lineNumbersMinChars: 2, | ||
| minimap: {enabled: false}, | ||
| overviewRulerBorder: false, | ||
| padding: { | ||
| top: 8, | ||
| bottom: 8, | ||
| }, | ||
| readOnly: true, | ||
| renderLineHighlight: "none", | ||
| scrollBeyondLastLine: false, | ||
| wordWrap: "on", | ||
| }}/> | ||
| </div> | ||
| {searchUiState === SEARCH_UI_STATE.FAILED && ( | ||
| <Alert | ||
| description={errorMsg} | ||
| message={errorName} | ||
| showIcon={true} | ||
| type={"error"}/> | ||
| )} | ||
| </div> | ||
| </Drawer> | ||
| ); | ||
| }; | ||
|
|
||
| export default QueryDrawer; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.