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

Redesign the "Add Panel" Experience #183764

Merged
merged 70 commits into from
Jun 26, 2024
Merged

Conversation

eokoneyo
Copy link
Contributor

@eokoneyo eokoneyo commented May 17, 2024

Summary

Closes #144418

This PR introduces changes to the dashboard add panel selection functionality, so that panel selection would now happen from within a flyout, and as such panels are now grouped together logically.

With this implementation any panel that is intended to show up within this new flyout is required to have either been registered leveraging the ui action trigger ADD_PANEL_TRIGGER and have it's grouping value defined or belong to a subset of visualization types (PROMOTED, TOOLS, and LEGACY) that would automatically get grouped.

It's worth pointing out that because we can't control the order at which UI actions gets registered, we won't always get the the panel groups in the same order, for this specific reason a new optional property (placementPriority) has been added in the property order is now leveraged such that it allows a user registering a UI action define a relative weight for where they'd like their group to show up. All registered actions would be rendered in descending order considering all order defined, in the case where no order is defined 0 is assumed for the group. In addition an action which is registered without a group, would automatically get assigned into a default group titled "Other".

The search implemented within the add panel is rudimentary, checking if the group titles and group item titles contain the input character; when a group title is matched the entire group is remains highlighted, in the case that the group isn't matched and it's just the group item, only said item is highlighted within it's group.

Visuals

Default view

Screenshot 2024-06-10 at 17 44 17

Search match view

Screenshot 2024-06-10 at 17 45 11
P.S.

This changes also includes changes to the display of certain panels;

  • ML group has a new title i.e. Machine Learning and Analytics
  • In serverless, the observability panels (SLO*) only shows as a selection choice in the observability project type.

Checklist

Delete any items that are not applicable to this PR.

@eokoneyo eokoneyo added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:large Large Level of Effort Project:Dashboard Usability Related to the Dashboard Usability initiative labels May 17, 2024
@eokoneyo eokoneyo self-assigned this May 17, 2024
@eokoneyo eokoneyo force-pushed the feat/resolve-144418 branch 2 times, most recently from bd2aeab to c564ea6 Compare May 24, 2024 09:44
}

public async isCompatible() {
return true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need further clarification about this, I'm assuming it would be compatible since this action only calls a function to display the selection modal.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would check that at least apiCanAddNewPanel(embeddable) is true to make sure the embeddable is capable of adding new panels.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI you would be checking to ensure the parent API is compatible - so something like apiHasParentApi(embeddable) && apiCanAddNewPanel(embeddable.parentApi) :)

@eokoneyo eokoneyo force-pushed the feat/resolve-144418 branch 4 times, most recently from e3a5e7c to b5180a7 Compare May 28, 2024 08:33
@eokoneyo
Copy link
Contributor Author

/ci

@eokoneyo eokoneyo force-pushed the feat/resolve-144418 branch 2 times, most recently from 6d80484 to 50422f5 Compare May 28, 2024 11:25
@eokoneyo
Copy link
Contributor Author

/ci

1 similar comment
@eokoneyo
Copy link
Contributor Author

/ci

@eokoneyo
Copy link
Contributor Author

/ci

@eokoneyo
Copy link
Contributor Author

/ci

Comment on lines 34 to 42

if (!isServerless) {
// only register these actions in stateful kibana
uiActions.addTriggerAction(ADD_PANEL_TRIGGER, addOverviewPanelAction);
uiActions.addTriggerAction(ADD_PANEL_TRIGGER, addErrorBudgetPanelAction);
uiActions.addTriggerAction(ADD_PANEL_TRIGGER, addAlertsPanelAction);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

exclude the registering of observability SLO actions in serverless.

Copy link
Contributor

@mgiota mgiota Jun 19, 2024

Choose a reason for hiding this comment

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

@eokoneyo Can you elaborate more why you had to exclude these actions on serverless?

Copy link
Contributor

@mgiota mgiota Jun 20, 2024

Choose a reason for hiding this comment

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

@eokoneyo I just noticed that this file is outdated and you indeed register these actions on stateful and observability serverless. In the beginning I thought you were disabling on serverless just the SLO edit actions, but that was my misunderstanding.

@eokoneyo
Copy link
Contributor Author

/ci

@eokoneyo
Copy link
Contributor Author

/ci

@eokoneyo
Copy link
Contributor Author

/ci

@cqliu1
Copy link
Contributor

cqliu1 commented Jun 21, 2024

UX change: I changed the add panel flyout search behavior to hiding the sections that don't match the search string. This resolves an issue with a failing maps test where the flyout was scrolling to the bottom of the flyout which prevented the maps panel option from being clicked.

Jun-21-2024 11-51-36

Tiny UI change: I added an empty state for when no panel types match your search string.

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.

A lot of this is looking good! Tested it locally and it also works great - especially the new searching.

I thought that we had removed all of the placementPriority code, but I still see a lot of references to it. I'd really like to have this whole system removed, as the actions already contain an order param.

Is this possible?

return isApiCompatible(embeddable);
}

public execute({ embeddable }: EmbeddableApiContext): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why not use an async function here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed in 48bef80

return apiHasType(api) && api.type === 'dashboard';
};

export class AddAggVisualizationPanelAction implements Action<EmbeddableApiContext> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this action is in the Dashboard plugin and not in the Visualize plugin?

Copy link
Contributor

Choose a reason for hiding this comment

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

I moved this to the visualizations plugin in 48bef80

items: PanelSelectionMenuItem[];
};

export interface PlacementPriority {
Copy link
Contributor

@ThomThomson ThomThomson Jun 21, 2024

Choose a reason for hiding this comment

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

I thought we removed this placementPriority concept in favour of the order key? If so, can we clean these up? If they are still used, I'd like to move away from them because this info should be captured in the normal action types.

edit it looks like these are still used in quite a few places. See top level review comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

I removed all references to placementPriority in 910065f.

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.

Code looks much better! I tested locally again, and found a very small regression - if you open an agg based editor now and hit cancel you'll end up at /app/dashboard which is a 404 page. I wasn't able to reproduce this in main.

404

Another small detail we could consider - perhaps in a followup, is that oftentimes the editors need async-loaded code, or take some time to open. This means that the add panel flyout closes immediately, and then the editor for the chart type you selected takes a moment to appear. We could handle this load state more gracefully - this is especially noticeable with the ES|QL editor.


import { i18n } from '@kbn/i18n';

export const COMMON_EMBEDDABLE_GROUPING = {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we type these? Maybe UiActionsPresentableGrouping<unknown>?

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated the type in 5337820

@cqliu1
Copy link
Contributor

cqliu1 commented Jun 25, 2024

I tested locally again, and found a very small regression - if you open an agg based editor now and hit cancel you'll end up at /app/dashboard which is a 404 page. I wasn't able to reproduce this in main.

I was passing the wrong originatingApp. This is fixed with 56a4697.

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.

Changes LGTM!

Ran it locally on chrome, ensuring that all add panel actions worked as expected. I think it might be worth creating an issue for the ability to wait for an editor to be ready before closing the add panel menu - because it was jarring a few times when the flyout closed and there was a visible delay in opening the next step.

I also looked through the code, and it all seems functional. IMO, there are a lot of ways it could be made more concise or organized, but likely most of this cleanup will happen after the embeddable refactor, once we've removed the legacy factories.

@peteharverson
Copy link
Contributor

Noted when testing this for ML that the ML panel types are still shown even when the ML feature is None for the current space. However this is not related to the changes in this PR, and I have raised a separate issue to fix on the ML side - #187007.

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 26, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 631 632 +1
apm 1886 1887 +1
cloudSecurityPosture 680 681 +1
dashboard 539 563 +24
discover 938 939 +1
embeddable 139 140 +1
esqlDataGrid 397 398 +1
eventAnnotationListing 617 618 +1
lens 1478 1479 +1
logsExplorer 598 599 +1
securitySolution 5535 5536 +1
slo 852 853 +1
uiActions 39 40 +1
visualizations 437 447 +10
total +46

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
embeddable 447 461 +14
links 57 58 +1
uiActions 103 110 +7
visualizations 834 838 +4
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
aiops 558.7KB 558.8KB +60.0B
canvas 1.1MB 1.1MB +36.0B
dashboard 495.2KB 503.5KB +8.3KB
discover 808.8KB 809.1KB +254.0B
imageEmbeddable 66.9KB 66.9KB +19.0B
lens 1.5MB 1.5MB +254.0B
ml 4.6MB 4.6MB +939.0B
securitySolution 13.7MB 13.7MB +254.0B
slo 868.5KB 868.9KB +411.0B
visualizations 291.1KB 291.3KB +171.0B
total +10.6KB

Page load bundle

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

id before after diff
dashboard 43.5KB 43.1KB -425.0B
embeddable 70.7KB 71.2KB +554.0B
imageEmbeddable 5.7KB 5.9KB +207.0B
infra 101.8KB 101.9KB +66.0B
lens 49.3KB 49.4KB +62.0B
links 33.8KB 33.9KB +106.0B
maps 54.5KB 54.5KB +9.0B
ml 80.2KB 80.2KB +14.0B
slo 23.1KB 23.1KB -8.0B
uiActions 22.9KB 23.4KB +441.0B
visTypeMarkdown 9.6KB 9.6KB +9.0B
visTypeTimeseries 20.6KB 20.6KB +7.0B
visualizations 61.9KB 63.1KB +1.2KB
total +2.2KB
Unknown metric groups

API count

id before after diff
embeddable 557 571 +14
links 57 58 +1
uiActions 149 156 +7
visualizations 865 869 +4
total +26

ESLint disabled line counts

id before after diff
dashboard 9 10 +1
visualizations 17 18 +1
total +2

Total ESLint disabled count

id before after diff
dashboard 9 10 +1
visualizations 19 20 +1
total +2

History

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

cc @eokoneyo

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Change for ML LGTM. Thanks for switching the order of the items @cqliu1

@cqliu1 cqliu1 merged commit 22e0545 into elastic:main Jun 26, 2024
21 checks passed
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels Jun 26, 2024
cqliu1 added a commit that referenced this pull request Jun 28, 2024
## Summary

Follow up to #183764.

The labels for the Visualizations and Observability groupings shown in
the Add Panel flyout in Dashboard were not being translated.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
@eokoneyo eokoneyo deleted the feat/resolve-144418 branch July 1, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:review backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:large Large Level of Effort Project:Dashboard Usability Related to the Dashboard Usability initiative release_note:feature Makes this part of the condensed release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] Redesign Add Panel Experience