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

[Lens] Remove visible title in workspace panel #82234

Merged
merged 5 commits into from
Nov 5, 2020

Conversation

lykims
Copy link
Contributor

@lykims lykims commented Nov 2, 2020

Summary

Resolves #81979.

kibana_lens_workspace_title

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@lykims lykims requested a review from a team November 2, 2020 02:59
@kibanamachine
Copy link
Contributor

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@flash1293 flash1293 self-assigned this Nov 2, 2020
@flash1293 flash1293 added Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0 labels Nov 2, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293 flash1293 added the release_note:skip Skip the PR/issue when compiling release notes label Nov 2, 2020
@flash1293
Copy link
Contributor

Thanks for working on this @lykims . I checked the PR and it seems like the empty header is still adding margin to the top - this space should be used by the chart:
Screenshot 2020-11-02 at 14 36 35

Also there are now unused css classes lnsWorkspacePanelWrapper__pageContentHeader and lnsWorkspacePanelWrapper__pageContentHeader--unsaved

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Checked the PR and there is some wasted whitespace in place of the header

@lykims
Copy link
Contributor Author

lykims commented Nov 3, 2020

Hi @flash1293!

Good observation! If the CSS classes lnsWorkspacePanelWrapper__pageContentHeader and lnsWorkspacePanelWrapper__pageContentHeader--unsaved are removed, the margin would still be there because of the UI element EuiPageContentHeader that has the CSS class euiPageContentHeader with margin-bottom: 24px;.

If the UI element EuiPageContentHeader is removed, then the logic !emptyExpression || title wouldn't be needed because the h1 elements would be redundant:

<EuiPageContent className="lnsWorkspacePanelWrapper">
  {!emptyExpression || title ? (
    <EuiScreenReaderOnly>
      <h1 data-test-subj="lns_ChartTitle">
        {title ||
          i18n.translate('xpack.lens.chartTitle.unsaved', { defaultMessage: 'Unsaved' })}
      </h1>
    </EuiScreenReaderOnly>
  ) : (
    <EuiScreenReaderOnly>
      <h1 data-test-subj="lns_ChartTitle">
        {title ||
          i18n.translate('xpack.lens.chartTitle.unsaved', { defaultMessage: 'Unsaved' })}
      </h1>
    </EuiScreenReaderOnly>
  )}
  ...

Then, the workspace part could simply look like:

<EuiPageContent className="lnsWorkspacePanelWrapper">
  <EuiScreenReaderOnly>
    <h1 data-test-subj="lns_ChartTitle">
      {title ||
        i18n.translate('xpack.lens.chartTitle.unsaved', { defaultMessage: 'Unsaved' })}
    </h1>
  </EuiScreenReaderOnly>
  ...

and the prop emptyExpression would become unused.

What do you think?

@flash1293
Copy link
Contributor

@lykims Sounds good to me!

If the CSS classes lnsWorkspacePanelWrapper__pageContentHeader and lnsWorkspacePanelWrapper__pageContentHeader--unsaved are removed, the margin would still be there because of the UI element EuiPageContentHeader that has the CSS class euiPageContentHeader

Yeah, removing the classes and removing the margin are two separate things I just put in a single comment

@lykims lykims requested a review from a team as a code owner November 4, 2020 00:10
@lykims
Copy link
Contributor Author

lykims commented Nov 4, 2020

@flash1293 I pushed new changes to be reviewed.

@flash1293
Copy link
Contributor

Thanks @lykims , I will take a look later today 👍

@flash1293
Copy link
Contributor

@elasticmachine merge upstream

@flash1293
Copy link
Contributor

Jenkins, test this

@flash1293
Copy link
Contributor

@lykims Seems like there's a little additonal cleanup to do:

ERROR x-pack failed
x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx:39:9 - error TS2322: Type '{ children: Element; dispatch: Mock<any, any>; framePublicAPI: Mocked; visualizationState: {}; visualizationId: string; visualizationMap: { ...; }; datasourceMap: {}; datasourceStates: {}; emptyExpression: boolean; }' is not assignable to type 'IntrinsicAttributes & WorkspacePanelWrapperProps'.
Property 'emptyExpression' does not exist on type 'IntrinsicAttributes & WorkspacePanelWrapperProps'.

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

+1 for leaning into the dashboard-first/default-no-title approach; breadcrumb seems sufficient in this case.

@flash1293
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Tested in Chrome and Firefox and looks great, thanks for this!

@flash1293
Copy link
Contributor

Jenkins, test this.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
lens 1.0MB 1.0MB -2.0KB

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💝community Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Remove visible title in workspace panel
5 participants