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

[Presentation Util] Shared toolbar component #94139

Merged
merged 15 commits into from
Apr 13, 2021

Conversation

cqliu1
Copy link
Contributor

@cqliu1 cqliu1 commented Mar 9, 2021

Summary

Related to #85666.

This moves the solution toolbar from the dashboard plugin into the presentation_util plugin and adds quick buttons to the toolbar in Dashboard.

Screen Shot 2021-03-22 at 3 06 56 PM

Significant changes:

  • Moved panelToolbar into presentationUtil plugin and renamed to solutionToolbar
  • Quick buttons for Markdown and Input controls were added to Dashboard toolbar
  • @elastic/kibana-operations The presentationUtil plugin bundle size limit was increased because we added new toolbar components. The toolbar should be one of the first visible parts of the UI in Dashboard, so it shouldn't be lazy loaded.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cqliu1 cqliu1 force-pushed the pres-util/panel-toolbar branch 2 times, most recently from ce80f02 to 51ae1ae Compare March 11, 2021 20:52
@cqliu1 cqliu1 force-pushed the pres-util/panel-toolbar branch 2 times, most recently from 45c848b to 847f278 Compare March 25, 2021 17:53
@cqliu1 cqliu1 force-pushed the pres-util/panel-toolbar branch 5 times, most recently from c0c85a7 to c80a919 Compare April 2, 2021 21:01
@cqliu1 cqliu1 added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas labels Apr 2, 2021
@cqliu1 cqliu1 added enhancement New value added to drive a business result release_note:enhancement v7.13.0 v8.0.0 loe:x-large Extra Large Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Apr 6, 2021
@cqliu1 cqliu1 force-pushed the pres-util/panel-toolbar branch 4 times, most recently from 4e8fd95 to dc91fa6 Compare April 7, 2021 01:49
    Fixed ts errors

    Fixed tsconfig

    Fixed quick button background color

    Suggestions for more generic component; named slots projection

    Refactor toolbar in dashboard

    Fixed i18n ids

    Added button size to QuickButtonGroup

    Fixed add panel test subject

    Exported all sub components from solution toolbar

    Fixed library button data test subject

    Fixed style lint errors

    Spread remaining props on add from library button component

    Fixed prop type

    Added functional tests for dashboard quick buttons

    Use page object instead of test subject

    Fixed functional tests

Renamed files

Fixed toolbar components
@cqliu1 cqliu1 marked this pull request as ready for review April 7, 2021 16:59
@cqliu1 cqliu1 requested a review from a team April 7, 2021 16:59
@cqliu1 cqliu1 requested review from a team as code owners April 7, 2021 16:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

operations - limits.yml LGTM

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

The code looks super modular and well done!

Also tested in Chrome, and the shortcut buttons work really well and everything mostly seems to be working as expected.

One thing I did notice is that the unsaved changes badge appears if you navigate to an editor, then return to the dashboard with the back button or the cancel button. There shouldn't any unsaved changes in this state.
I'm not sure if this is in Master or not - but I checked and it works correctly in 7.12.

Edit turns out that I can reproduce this issue on master as well. I will investigate!
Edit 2 It turns out that this only happens when you have a map panel on a dashboard, I have created an issue

Copy link
Contributor

@poffdeluxe poffdeluxe left a comment

Choose a reason for hiding this comment

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

Looks great! One small question but otherwise looks good


// required for dynamic import using React.lazy()
// eslint-disable-next-line import/no-default-export
export default PrimaryActionPopover;
Copy link
Contributor

Choose a reason for hiding this comment

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

A lot of these have the export default but are we using the React.lazy for these components? Do we still want to export them like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right, that's leftover from when I was trying to lazy load the components, but then Clint helped me realize that we probably shouldn't lazy load the toolbar. I'll remove the default export from all the solution toolbar components.

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Left one small SCSS comment below, but looks good otherwise. Approving so I don't hold you up.

@@ -0,0 +1,8 @@
.quickButtonGroup {
.euiButtonGroup__buttons {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to create/use a different class to avoid using EUI classes? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, on second look, it appears that the related border-radius style might not even be necessary, as EUI is already giving it this styling. If I'm not mistaken, I think this selector and style can be removed altogether.

@stratoula
Copy link
Contributor

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

user doesn't have permission to update head repository

@elastic elastic deleted a comment from kibanamachine Apr 12, 2021
@@ -84,6 +85,19 @@ class NewVisModal extends React.Component<TypeSelectionProps, TypeSelectionState
return null;
}

if (this.props.newVisType) {
Copy link
Contributor

@stratoula stratoula Apr 12, 2021

Choose a reason for hiding this comment

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

I am so sorry but I dont get what we want to do. What kind of information has the newVisType prop. And why do we return null if it has a value? If we don't want to display the wizard, why do we use this component? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it turns out I didn't actually need to go through the new vis modal to add these visualizations, and instead use the embeddable state transfer service. I removed all the changes to the new vis modal.

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @cqliu1 for addressing all my feedback!

@@ -63,6 +63,7 @@ export interface VisualizeInput extends EmbeddableInput {
query?: Query;
filters?: Filter[];
timeRange?: TimeRange;
newVisType?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also remove this, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! Sorry I missed this line.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 200 189 -11
presentationUtil 50 87 +37
total +26

Async chunks

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

id before after diff
dashboard 134.8KB 132.6KB -2.2KB
presentationUtil 46.5KB 53.3KB +6.8KB
total +4.6KB

Page load bundle

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

id before after diff
presentationUtil 15.2KB 33.7KB +18.5KB
visualizations 92.5KB 92.5KB -20.0B
total +18.5KB

History

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

@cqliu1 cqliu1 merged commit 74d93a2 into elastic:master Apr 13, 2021
@cqliu1 cqliu1 deleted the pres-util/panel-toolbar branch April 13, 2021 16:24
@cqliu1 cqliu1 mentioned this pull request Sep 28, 2021
8 tasks
@cqliu1 cqliu1 restored the pres-util/panel-toolbar branch June 8, 2022 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Dashboard Dashboard related features impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort release_note:enhancement Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants