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

[ES|QL] Improves the authoring of the query and charts #186875

Merged
merged 30 commits into from
Jul 30, 2024

Conversation

stratoula
Copy link
Contributor

@stratoula stratoula commented Jun 25, 2024

Summary

It makes the authoring of the ES|QL query easier by:

  • changing the flyout to be resizable
  • displaying a tab with the results of the query in the ES|QL datagrid component.
image

Checklist

@andreadelrio
Copy link
Contributor

andreadelrio commented Jul 5, 2024

Hi @stratoula, a very nice addition to our ES|QL Dashboard UX here! As requested by @teresaalvarezsoler here's a first round of design feedback I wanted to share.

a) I don’t think we should be offering the entire power of Discover in such a small area. Therefore, I suggest we provide a simplified version of Discover here.

  • Remove the checkboxes and with them the Selected and Compare buttons and related functionalities
Frame 1
  • Offer a link for users to take their query and see it in the full Discover app if they wish to do so. Label it Open in Discover. See:
Frame 3
  • Given the limited space, I suggest we set Single as the default setting for Cell row height.
  • For the Pagination, given the limited space where we are displaying the results I think we should allow 25 rows per pages at the most. So we’d have Rows per page = [10, 25].

b) If I make any changes to the table, including resizing the columns, and then I edit and re-run the query, my changes to the table should not be altered. This is not the behavior currently. See:

format_settings_list

  • Keep table settings (columns width, Cell row height, etc) intact upon editing and re-running the query

c) Other suggestions and/or findings

  • Just like in Discover, make the table’s header sticky
  • Similar to what we do for the Suggestions accordion, add a counter to the Results accordion
  • Consistently show the Columns button. Right now, sometimes it disappears. See:
    columns_dissapear

@stratoula
Copy link
Contributor Author

@andreadelrio thanx, not sure when I will find the time to work with this PR again but some comments:

If I make any changes to the table, including resizing the columns, and then I edit and re-run the query, my changes to the table should not be altered.

This is true but as the same happens for viz changes I suggest to tackle them together. (I have a task for this in 8.17)

Consistently show the Columns button. Right now, sometimes it disappears. See:

My guess is that this is how Discover works in small spaces but I will take a look

@jughosta
Copy link
Contributor

jughosta commented Jul 9, 2024

Consistently show the Columns button. Right now, sometimes it disappears.

That's a part of EuiDataGrid logic for smaller screens, but we could override it in UnifiedDataTable if necessary

@stratoula
Copy link
Contributor Author

@andreadelrio thanx a lot for your review

image

As I mention above I have addressed everything except from the b. This is something which also works like that currently for the vis configuration settings and we are going to handle it most possibly in 8.17.

One note: I added the Open In Discover link but next to the columns sort button as the Discover toolbar has already a setting to add a new control there. Are you ok with it? Otherwise I will need to create a new position and will make the component a little bit more complicated.

@stratoula stratoula changed the title [ES|QL] Display ESQL grid of results and make the flyout resizable [ES|QL] Improves the authoring of the query and charts Jul 22, 2024
@stratoula stratoula added release_note:feature Makes this part of the condensed release notes backport:skip This commit does not require backporting v8.16.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana labels Jul 22, 2024
@stratoula stratoula marked this pull request as ready for review July 22, 2024 10:30
@stratoula stratoula requested review from a team as code owners July 22, 2024 10:30
@stratoula
Copy link
Contributor Author

stratoula commented Jul 29, 2024

Thanx @andreadelrio, yes is not at the scope of this PR (lovely idea btw). I am going to return to this PR hopefully this week. I am dealing with other tasks with greater priority so this is mostly a PR I am working on my free time. @andreadelrio can you create an issue with the above comment for the presentation team (I assume it is their territory) if there is not one already?

@stratoula
Copy link
Contributor Author

@andreadelrio about this:

When checking this on my external monitor, I noticed that it looks like given the increased viewport height we are showing white space below the results. Can we get rid of it?
It is being added by the euiDataGrid__virtualized so it seems I can't get rid of it (unless someone else knows the eui datagrid better than me)

@stratoula
Copy link
Contributor Author

@andreadelrio I addressed your comments, can you give another look? 🙏

@elastic/kibana-visualizations same, I addressed Marco's comments, I know his out but I would appreciate a followup review 🙇‍♀️

@stratoula stratoula requested a review from a team as a code owner July 29, 2024 12:14
@@ -47,7 +59,8 @@ const DataGrid: React.FC<ESQLDataGridProps> = (props) => {
const [activeColumns, setActiveColumns] = useState<string[]>(
(props.initialColumns || (props.isTableView ? props.columns : [])).map((c) => c.name)
);
const [rowHeight, setRowHeight] = useState<number>(5);
const [rowHeight, setRowHeight] = useState<number>(props.initialRowHeight ?? 5);
const [rowsPerPage, setRowsPerPage] = useState(10);
Copy link
Contributor

Choose a reason for hiding this comment

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

this constant is used here and then again in line 212. Could we export it to the variable? The one above too:

 const DEFAULT_INITIAL_ROW_HEIGHT = 5
 const DEFAULT_ROWS_PER_PAGE = 10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure e5f0fdc

@@ -128,6 +135,30 @@ export function LensEditConfigurationFlyout({
return () => s?.unsubscribe();
}, [dispatch, output$, layers]);

useEffect(() => {
Copy link
Contributor

@mbondyra mbondyra Jul 29, 2024

Choose a reason for hiding this comment

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

why is this needed here?

Copy link
Contributor Author

@stratoula stratoula Jul 29, 2024

Choose a reason for hiding this comment

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

It is because you need to initialize it, otherwise the accordion is not visible, only runs in the initialization btw

@@ -479,6 +508,78 @@ export function LensEditConfigurationFlyout({
/>
</EuiFlexItem>
)}
{isOfAggregateQueryType(query) && canEditTextBasedQuery && dataGridAttrs && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth to extract this to a component?

Copy link
Contributor Author

@stratoula stratoula Jul 29, 2024

Choose a reason for hiding this comment

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

Hmmm, we don't do it for the other accordion items 🤔 I don't think we will gain a lot, on the contrary you will need to pass a lot of properties to the component. The ESQLDatagrid is already a reusable component.

Copy link
Contributor Author

@stratoula stratoula Jul 29, 2024

Choose a reason for hiding this comment

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

Done here b64dc30. As I said you don't gain a lot but it is not bad either!

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

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

LGTM, tested in Chrome 👌🏼

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

@stratoula 🚀 Amazing work here! Thanks for working on all the UI polish tasks. Just one nit, let's make the icon in the Open in Discover blue as well (right now it shows in teal and black). Approving now assuming you can take care of that.

image

Related task (improve Preview) is already being tracked here.
#187864 (comment)

@stratoula
Copy link
Contributor Author

@andreadelrio thanx a lot for your help with the design here!

Done
image

@stratoula
Copy link
Contributor Author

/ci

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 1489 1490 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/esql-utils 59 61 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
esqlDataGrid 116.6KB 117.9KB +1.3KB
lens 1.5MB 1.5MB +2.2KB
total +3.5KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 416.0KB 416.2KB +168.0B
esqlDataGrid 9.2KB 9.3KB +103.0B
lens 50.2KB 50.4KB +142.0B
total +413.0B
Unknown metric groups

API count

id before after diff
@kbn/esql-utils 63 65 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@vadimkibana vadimkibana left a comment

Choose a reason for hiding this comment

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

ES|QL code changes LGTM.

@stratoula stratoula merged commit 1bf4fcd into elastic:main Jul 30, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:ES|QL ES|QL related features in Kibana Feature:Lens release_note:enhancement Team:ESQL ES|QL related features in Kibana Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants