Skip to content

[Lens] Enable read only editor mode to inspect panel's configuration#208554

Merged
dej611 merged 52 commits intoelastic:mainfrom
dej611:fix/106553
Mar 14, 2025
Merged

[Lens] Enable read only editor mode to inspect panel's configuration#208554
dej611 merged 52 commits intoelastic:mainfrom
dej611:fix/106553

Conversation

@dej611
Copy link
Copy Markdown
Contributor

@dej611 dej611 commented Jan 28, 2025

Summary

Fixes #106553

This PR enables the Read Only editor feature for Lens panels, who will let users in read mode (no matter broader permissions) to explore the visualization configuration.

Short list of changes:

  • Edit action tooltip now changed from Edit {name} into Edit {name} configuration
  • isEditingEnabled takes into account now also Managed state of both visualization and parentApi
  • A new showConfigAction has been created to show users without write capabilities the current Lens chart configuration
  • Edit inline flyout title changed to Configuration no matter the context (this has impact also on creation, i.e. ES|QL new panel)
  • Within the configuration panel the Visualization configuration section title has changed to Visualization layers
  • When the panel is in read-only mode a callout is shown and no editing/saving action is shown

UX guidance

Here's some guidance inherited by @MichaelMarcialis comment about the different flows based on user permissions.

Read/write UX

  • No change

Read-only UX

  • The glasses icon's tooltip shows as "View visualization configuration"?
  • Flyout title should simply be "Configuration"
  • On second read, "Read only panel changes will revert after closing" sounds a bit odd. Can we change to "Read-only: Changes will be reverted on close"? Also, can we change the callout icon to glasses?
  • Change "Visualization configuration" accordion title to "Visualization layers".

Screenshots

Read-only UX

If user has no write permissions the glasses icon is shown for the action:
Screenshot 2025-02-05 at 14 25 15
And the panel is shown with the read only callout with no edit buttons:
Screenshot 2025-02-05 at 14 25 23

For a Managed dashboard the behaviour is the same as above (for the user there's no difference between regular or managed dashboard, just wanted to report here both cases):
Screenshot 2025-02-05 at 14 25 34
Screenshot 2025-02-05 at 14 25 41

Checklist

@dej611 dej611 added Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// Feature:Lens release_note:feature Makes this part of the condensed release notes backport:prev-major labels Jan 28, 2025
@dej611 dej611 requested review from a team as code owners January 28, 2025 15:03
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

public getDisplayName({ embeddable }: EmbeddableApiContext) {
if (!isApiCompatible(embeddable)) throw new IncompatibleActionError();
return i18n.translate('presentationPanel.action.showConfigPanel.displayName', {
defaultMessage: 'Configuration',
Copy link
Copy Markdown
Contributor Author

@dej611 dej611 Jan 28, 2025

Choose a reason for hiding this comment

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

I've been discussing offline with @MichaelMarcialis about naming here, and there's this idea to change the Edit action label too into something on the line with this:

  • Configuration => show
  • Configure => edit

WDYT @elastic/kibana-presentation ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that works pretty well! @wajihaparvez FYI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good for me, can we also change the Edit Lens to this Configure name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's the proposal @markov00 . I'll create a follow up PR for that so we could discuss it more clearly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just jumping in on this. I think these labels are a good idea, but is it possible to say View configuration for "show" instead of just Configuration?

Copy link
Copy Markdown
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

I am not sure a new action and interfaces are needed. Instead of having separate actions for edit and view - how about just a single action for viewing panel configuration. Then, the panel configuration view can either show a read-only mode or edit mode based on container view mode and user permissions.

@dej611
Copy link
Copy Markdown
Contributor Author

dej611 commented Jan 29, 2025

I am not sure a new action and interfaces are needed. Instead of having separate actions for edit and view - how about just a single action for viewing panel configuration. Then, the panel configuration view can either show a read-only mode or edit mode based on container view mode and user permissions.

That was my initial idea too, and partially this can be found also in the Lens embeddable code, but after tweaking too many things around the edit action, I've decided a distinct action was a better approach.
In particular the worst part was the compatibility check in the edit action would become very complex to take into account too many factors who do not strictly belong to it.

@ThomThomson
Copy link
Copy Markdown
Contributor

@nreese in regards to multiple actions vs one action, I was thinking we would consolidate those later as part of our inline editing project - i.e. when we merge panel settings and this editor.

@dej611
Copy link
Copy Markdown
Contributor Author

dej611 commented Feb 12, 2025

Put on hold for the moment to discuss a bit the edit behaviour for author users.

@MichaelMarcialis
Copy link
Copy Markdown
Contributor

MichaelMarcialis commented Feb 18, 2025

Quick recap from today's sync with @dej611, @ThomThomson, @ghudgins:

Read-only users

  • View mode: Continue to offer the "View visualization configuration" action with glasses icon on visualization panels. These users are allowed to view/fiddle with the configuration options, but not apply them.

Read/write users

  • View mode: No option to view or edit the configuration is offered for these users in view mode.

  • Edit mode: Continue to offer the "Edit visualization configuration" action with pencil icon. These users are allowed to apply edits made to the configuration.

@dej611 dej611 requested a review from ThomThomson March 3, 2025 13:41
}

/**
* The execute method contains a compatibility check with a wider scope
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment can be removed since its no longer valid

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, removed it with d9d56e5

Copy link
Copy Markdown
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

Copy link
Copy Markdown
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Code and functionality are fine for me! LGTM

<h5>
{i18n.translate('xpack.lens.config.visualizationConfigurationLabel', {
defaultMessage: 'Visualization configuration',
defaultMessage: 'Visualization layers',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't agree much on this change, this works fine with cartesian charts, but doesn't have much sense for all the other charts that only have a single layer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No strong opinion here. I can see as a flexible wording for a plugin-first interface, which could potentially can hit any chart type (i.e. annotations for pie charts?). But pragmatically I see your point.
The change was triggered initially by Michael comment here: https://github.com/elastic/kibana/pull/208554/files/34ff73b5fdab54a0e798ddbdd09203b7e9401ee8#r1939693883 . I'll be fine with anything @gvnmagni or @wajihaparvez agree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would personally go with the most agnostic word here so that we avoid incongruences with different kind of charts. If we want to simplify a bit, even just "Configuration" would work

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@markov00 made me notice that we have a Configuration title above that makes this redundant. What if we use "Visualisation Parameters"? I am afraid we need you here @wajihaparvez I am honestly struggling with words :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for looping me in!
I agree with @gvnmagni that we should use something with a broader meaning so that it applies to all visualizations. I really like "Visualization parameters". We could also consider "Visualization settings".
Just a note that whichever phrase we end up using, it should be in sentence case so only the first word should be capitalized, e.g. "Visualization parameters"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll address it with Visualization parameters for now.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 603 604 +1
apm 1890 1891 +1
cases 1014 1015 +1
controls 353 354 +1
dashboard 638 639 +1
dashboardEnhanced 87 88 +1
dataVisualizer 747 748 +1
discover 1208 1209 +1
discoverEnhanced 48 49 +1
embeddable 82 83 +1
embeddableEnhanced 46 47 +1
imageEmbeddable 133 134 +1
infra 1453 1454 +1
inputControlVis 90 91 +1
lens 1527 1528 +1
links 108 109 +1
maps 1253 1254 +1
ml 2419 2420 +1
presentationPanel 117 120 +3
reporting 148 149 +1
securitySolution 7081 7082 +1
slo 1126 1127 +1
synthetics 1215 1216 +1
urlDrilldown 50 51 +1
visTypeMarkdown 64 65 +1
visTypeVega 538 539 +1
visualizations 471 472 +1
total +29

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/presentation-publishing 205 208 +3

Async chunks

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

id before after diff
lens 1.5MB 1.5MB +715.0B
presentationPanel 36.4KB 37.5KB +1.1KB
total +1.8KB

Page load bundle

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

id before after diff
lens 58.8KB 58.8KB -12.0B
presentationPanel 10.9KB 11.1KB +239.0B
total +227.0B
Unknown metric groups

API count

id before after diff
@kbn/presentation-publishing 242 247 +5

History

@dej611 dej611 merged commit 07c7450 into elastic:main Mar 14, 2025
clintandrewhall pushed a commit to clintandrewhall/kibana that referenced this pull request Mar 20, 2025
…lastic#208554)

## Summary

Fixes elastic#106553 

This PR enables the Read Only editor feature for Lens panels, who will
let users in read mode (no matter broader permissions) to explore the
visualization configuration.

Short list of changes:
* Edit action tooltip now changed from `Edit {name}` into `Edit {name}
configuration`
* `isEditingEnabled` takes into account now also `Managed` state of both
visualization and `parentApi`
* A new `showConfigAction` has been created to show users without write
capabilities the current Lens chart configuration
* Edit inline flyout title changed to `Configuration` no matter the
context (this has impact also on creation, i.e. ES|QL new panel)
* Within the configuration panel the `Visualization configuration`
section title has changed to `Visualization layers`
* When the panel is in read-only mode a callout is shown and no
editing/saving action is shown

## UX guidance

Here's some guidance [inherited by @MichaelMarcialis
comment](elastic#208554 (comment))
about the different flows based on user permissions.

**Read/write UX**

* No change

**Read-only UX**

* The glasses icon's tooltip shows as "View visualization
configuration"?
* Flyout title should simply be "Configuration"
* On second read, "Read only panel changes will revert after closing"
sounds a bit odd. Can we change to "Read-only: Changes will be reverted
on close"? Also, can we change the callout icon to glasses?
* Change "Visualization configuration" accordion title to "Visualization
layers".

### Screenshots

**Read-only UX**

If user has no write permissions the `glasses` icon is shown for the
action:
![Screenshot 2025-02-05 at 14 25
15](https://github.com/user-attachments/assets/64d23f00-82f7-4e90-bcef-29a18ae7116a)
And the panel is shown with the `read only` callout with no edit
buttons:
![Screenshot 2025-02-05 at 14 25
23](https://github.com/user-attachments/assets/39782a01-5d61-4498-9f50-4a3c7a6bf35d)

For a `Managed` dashboard the behaviour is the same as above (for the
user there's no difference between regular or managed dashboard, just
wanted to report here both cases):
![Screenshot 2025-02-05 at 14 25
34](https://github.com/user-attachments/assets/0b9aebd5-96db-4140-8e85-b08a9720ae33)
![Screenshot 2025-02-05 at 14 25
41](https://github.com/user-attachments/assets/d3487aa8-af9c-4b73-80fc-8ee2489f2f90)


### Checklist

- [x] [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

---------

Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
Co-authored-by: Michael Marcialis <michael.l.marcialis@gmail.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Mar 22, 2025
…lastic#208554)

## Summary

Fixes elastic#106553 

This PR enables the Read Only editor feature for Lens panels, who will
let users in read mode (no matter broader permissions) to explore the
visualization configuration.

Short list of changes:
* Edit action tooltip now changed from `Edit {name}` into `Edit {name}
configuration`
* `isEditingEnabled` takes into account now also `Managed` state of both
visualization and `parentApi`
* A new `showConfigAction` has been created to show users without write
capabilities the current Lens chart configuration
* Edit inline flyout title changed to `Configuration` no matter the
context (this has impact also on creation, i.e. ES|QL new panel)
* Within the configuration panel the `Visualization configuration`
section title has changed to `Visualization layers`
* When the panel is in read-only mode a callout is shown and no
editing/saving action is shown

## UX guidance

Here's some guidance [inherited by @MichaelMarcialis
comment](elastic#208554 (comment))
about the different flows based on user permissions.

**Read/write UX**

* No change

**Read-only UX**

* The glasses icon's tooltip shows as "View visualization
configuration"?
* Flyout title should simply be "Configuration"
* On second read, "Read only panel changes will revert after closing"
sounds a bit odd. Can we change to "Read-only: Changes will be reverted
on close"? Also, can we change the callout icon to glasses?
* Change "Visualization configuration" accordion title to "Visualization
layers".

### Screenshots

**Read-only UX**

If user has no write permissions the `glasses` icon is shown for the
action:
![Screenshot 2025-02-05 at 14 25
15](https://github.com/user-attachments/assets/64d23f00-82f7-4e90-bcef-29a18ae7116a)
And the panel is shown with the `read only` callout with no edit
buttons:
![Screenshot 2025-02-05 at 14 25
23](https://github.com/user-attachments/assets/39782a01-5d61-4498-9f50-4a3c7a6bf35d)

For a `Managed` dashboard the behaviour is the same as above (for the
user there's no difference between regular or managed dashboard, just
wanted to report here both cases):
![Screenshot 2025-02-05 at 14 25
34](https://github.com/user-attachments/assets/0b9aebd5-96db-4140-8e85-b08a9720ae33)
![Screenshot 2025-02-05 at 14 25
41](https://github.com/user-attachments/assets/d3487aa8-af9c-4b73-80fc-8ee2489f2f90)


### Checklist

- [x] [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

---------

Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
Co-authored-by: Michael Marcialis <michael.l.marcialis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:feature Makes this part of the condensed release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.1.0