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

Add hide/show toggle to chart #6

Merged

Conversation

andreadelrio
Copy link
Collaborator

Summary

Added a toggle to hide the chart and allow more space for the data grid.

hide

Note: I'm getting this error but not sure how to fix it.
`React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render.

Will send another PR for the datagrid's popover. For now I just removed the danger from the buttons since I don't think we need it.

`

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@@ -79,6 +80,11 @@ export function Discover({
}
const { TopNavMenu } = getServices().navigation.ui;
const { savedSearch } = opts;
const [toggleOn, setToggleOn] = useState(true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to move the useState before line 77 to get rid of the warning you mentioned. furthermore I'd suggest to name it a bit more specific, since this component will grow soon. maybe name it toggleChartOn, or a bit more clear what it does: showChart (subjectively)

Copy link
Owner

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fine change that will also later on make it possible to omit the request for the chart to ES, users were asking for that 👍 , and it even needs less code then before!
One thing I've noticed, when the browser window offers too less space, it was broken before, and now it's a bit more broken, do you think you could fix this in this PR (could also be a future one, of course)
Bildschirmfoto 2020-07-29 um 17 37 58

@andreadelrio
Copy link
Collaborator Author

One thing I've noticed, when the browser window offers too less space, it was broken before, and now it's a bit more broken, do you think you could fix this in this PR (could also be a future one, of course)
Bildschirmfoto 2020-07-29 um 17 37 58

Made some improvements (see below). We'll need to continue polishing up responsiveness in follow up PRs.

Frame 53

Copy link
Owner

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM 👍 thx for taking care of this, the opens the gate to useful follow up improvements beyond the design. E.g. we can adapt the request to ES when the histogram is not displayed, no more aggregation necessary. some users demanded it for a faster response when querying lots of data.

@kertal
Copy link
Owner

kertal commented Aug 5, 2020

@andreadelrio guess there are no more changes, so we can merge, right? thx!

@andreadelrio
Copy link
Collaborator Author

@andreadelrio guess there are no more changes, so we can merge, right? thx!

@kertal Yes, please. Go ahead and merge it.

@kertal kertal merged commit 6c8bf2d into kertal:kertal-pr-2020-04-25-discover-data-grid Aug 5, 2020
kertal pushed a commit that referenced this pull request Jun 23, 2023
- adds hooks that provide context to the Security Assistant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants