-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Add toolbar api #69263
[Lens] Add toolbar api #69263
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
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.
I haven't yet run the code, but this doesn't look right to me because it removes the title. @cchaos you may want to look at this
x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel_wrapper.tsx
Show resolved
Hide resolved
@cchaos Alright thanks, I will adjust the PR. Moving over the chart selector will be done in a separate PR. |
Unsaved Not sure about the separator line below the title - it's there on master: |
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.
I think it's better without the border 👍
x-pack/plugins/lens/public/editor_frame_service/editor_frame/_workspace_panel_wrapper.scss
Outdated
Show resolved
Hide resolved
<EuiPageContentHeader | ||
className={classNames('lnsWorkspacePanelWrapper__pageContentHeader', { | ||
'lnsWorkspacePanelWrapper__pageContentHeader--unsaved': !title, | ||
})} | ||
> | ||
<span data-test-subj="lns_ChartTitle"> | ||
{title || | ||
i18n.translate('xpack.lens.chartTitle.unsaved', { defaultMessage: 'Unsaved' })} | ||
</span> | ||
</EuiPageContentHeader> |
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.
Can we make sure the content header only shows when there's a chart? So don't show "Unsaved" in the empty state (alongside the graphic).
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.
@flash1293 It is very important and pretty similar to it used to behave. Before, it would show the title component once you have a visualization and then saved it. Now I'm just asking if we can put a second layer of logic to show the "Unsaved" title after chart creation.
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.
@cchaos I withdrew my comment, I found a nice solution :) Sorry for the noise.
…workspace_panel_wrapper.scss Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
@wylieconlon @cchaos can you check again? |
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.
Code review LGTM since my guess is we don't actually have anything being populated in the toolbar area yet, this is just for the opportunity to.
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.
This is very close, but I found another title-related issue.
/> | ||
); | ||
|
||
expect(renderToolbarMock).toHaveBeenCalledWith(expect.anything(), { |
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.
I usually do expect.any(Element)
i18n.translate('xpack.lens.chartTitle.unsaved', { defaultMessage: 'Unsaved' })} | ||
</span> | ||
</EuiPageContentHeader> | ||
)} |
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.
This logic doesn't look right to me: it hides the title for a saved visualization in the following case:
- Go to a previously saved Lens visualization
- Clear the layer
- Title disappears?
@wylieconlon good point, fixed that |
@elasticmachine merge upstream |
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
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.
Changes LGTM!
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.
Arghh, I've started checking too late 😅 I only had one comment about exhaustive-deps rule, but nevermind - we can do it some other time.
Functionality works good on Firefox - post-approved! 😄
}: WorkspacePanelWrapperProps) { | ||
const setVisualizationState = useCallback( | ||
(newState: unknown) => { | ||
if (!activeVisualization) { |
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.
Can you add activeVisualization
to dependency array of useCallback
?
* master: (34 commits) Upgrade `elliptic` dependency (`6.5.2` → `6.5.3`). (elastic#70054) [License Management] Do not break when `telemetry.enabled:false` (elastic#69711) [SECURITY] Redirect app/security to app/security/overview (elastic#70005) "Explore underlying data" in-chart action (elastic#69494) Api reference docs for state_containers and state_sync (elastic#67354) prep state transfer for passing embeddables by value to editor and back (elastic#69991) move Metrics API to start (elastic#69787) refactor: 💡 fix typo in embeddable (elastic#69417) [alerting] migrates the old `alerting` consumer to be `alerts` (elastic#69982) [APM]Create API to return data to be used on the Overview page (elastic#69137) [Lens] Fix delete button position in dimension panel for long labels (elastic#69495) [Lens] Add toolbar api (elastic#69263) Fixes bug on color picker defaults on TSVB (elastic#69889) [DOCS] Fixes wording in Upload a CSV section (elastic#69969) [Discover] Validate timerange before submitting query to ES (elastic#69363) [Maps] avoid using MAP_SAVED_OBJECT_TYPE constant when defining URL paths (elastic#69723) [Maps] Fix icon palettes are not working (elastic#69937) [Ingest Manager] Fix typo in constant name (elastic#69919) [test] skip status.allowAnonymous tests on cloud (elastic#69017) Fix backport (elastic#70003) ...
Fixes #67384
This PR adds a new optional property to a Lens visualization -
renderToolbar
. If the property is provided, it is called to render above the actual chart. This is meant to provide a place for chart-level settings.This removes the "title" bar (title is still visible in the chrome breadcrumb)
The toolbar renderer has access to the current state, the state setter and the frame API.
Example (if toolbar is provided)
Example (if toolbar is not provided)
To test this, you can use the following example toolbar:
This PR does not move over the chart-picker yet, this can be done in a separate PR.