-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Query Explanation #6346
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
Query Explanation #6346
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
54230ca
Return Query Explaination in QueryAPI
PradyumnaKrishna d0a813c
Add explain checkbox in thanos UI
PradyumnaKrishna 7ae5ad4
Add ExpandableNode Component
PradyumnaKrishna 4f2a642
Disable Explain checkbox on prometheus engine
PradyumnaKrishna 83a6337
Add alert box with horizontal scrolling for Explanation
PradyumnaKrishna 054ca48
Remove ExpandableNode and Add ListTree
PradyumnaKrishna 9b7ac5d
Minor refactor in Query API response
PradyumnaKrishna e93f825
Update UI tests to passing
PradyumnaKrishna d4b4894
Minor UI changes and test fix
PradyumnaKrishna 9834bc3
Update promql-engine to use Explain method
PradyumnaKrishna d6d22ce
Build UI assets
PradyumnaKrishna 7882734
Revert proxy url change from package.json
PradyumnaKrishna 761b304
Minor changes in UI
PradyumnaKrishna dff1cd8
Update UI assets
PradyumnaKrishna 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,64 @@ | ||
| import React, { useState } from 'react'; | ||
| import { InputProps, Collapse, ListGroupItem, ListGroup } from 'reactstrap'; | ||
|
|
||
| export interface QueryTree { | ||
| name: string; | ||
| children?: QueryTree[]; | ||
| } | ||
|
|
||
| interface NodeProps extends InputProps { | ||
| node: QueryTree | null; | ||
| } | ||
|
|
||
| const ListTree: React.FC<NodeProps> = ({ id, node }) => { | ||
saswatamcode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type idMapping = { | ||
| [key: string]: boolean; | ||
| }; | ||
|
|
||
| const [mapping, setMapping] = useState<idMapping>({}); | ||
| const toggle = (e: React.MouseEvent<HTMLDivElement>) => { | ||
| const el = e.target as HTMLDivElement; | ||
| const id = el.getAttribute('id'); | ||
| if (id) { | ||
| setMapping({ ...mapping, [id]: !mapping[id] }); | ||
| } | ||
| }; | ||
|
|
||
| // Constructing List Items recursively. | ||
| const mapper = (nodes: QueryTree[], parentId?: any, lvl?: any) => { | ||
| return nodes.map((node: QueryTree, index: number) => { | ||
| const id = `${index}-${parentId ? parentId : 'top'}`.replace(/[^a-zA-Z0-9-_]/g, ''); | ||
saswatamcode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const item = ( | ||
| <React.Fragment> | ||
| <ListGroupItem | ||
| className={`bg-transparent p-0 border-0 ${parentId ? `rounded-0 ${lvl ? 'border-bottom-0' : ''}` : ''}`} | ||
| > | ||
| { | ||
| <div className={`d-flex align-items-center`} style={{ paddingLeft: `${25 * lvl}px` }}> | ||
| {node.children && ( | ||
| <div className="pl-0 btn text-primary" style={{ cursor: 'inherit' }} color="link"> | ||
| {mapping[id] ? '\u002B' : '\u002D'} | ||
| </div> | ||
| )} | ||
| <div id={id} style={{ cursor: `${node.children ? 'pointer' : 'inherit'}` }} onClick={toggle}> | ||
| {node.name} | ||
| </div> | ||
| </div> | ||
| } | ||
| </ListGroupItem> | ||
| {node.children && <Collapse isOpen={mapping[id]}>{mapper(node.children, id, (lvl || 0) + 1)}</Collapse>} | ||
| </React.Fragment> | ||
| ); | ||
|
|
||
| return item; | ||
| }); | ||
| }; | ||
|
|
||
| if (node) { | ||
| return <ListGroup>{mapper([node], id)}</ListGroup>; | ||
| } else { | ||
| return null; | ||
| } | ||
| }; | ||
|
|
||
| export default ListTree; | ||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typecheck: undefined: engine.ExplainOutputNode
❗❗ 2 similar findings have been found in this PR
🔎 Expand here to view all instances of this finding
Visit the Lift Web Console to find more details in your report.
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore@sonatype-lift ignoreall@sonatype-lift exclude <file|issue|path|tool>file|issue|path|toolfrom Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.