Skip to content

[Lens] Prevent overwriting managed content from editor#175062

Merged
drewdaemon merged 23 commits intoelastic:mainfrom
drewdaemon:lens-respect-managed-content
Jan 24, 2024
Merged

[Lens] Prevent overwriting managed content from editor#175062
drewdaemon merged 23 commits intoelastic:mainfrom
drewdaemon:lens-respect-managed-content

Conversation

@drewdaemon
Copy link
Copy Markdown
Contributor

@drewdaemon drewdaemon commented Jan 17, 2024

Summary

Close #166720

I marked this a breaking change since it is preventing users from doing something they have been able to do before. They can no longer save changes to managed Lens visualizations. Instead, they have to save changes to a new visualization.

To test, import this ndjson file which includes both a managed and an unmanaged visualization:

Details
{"attributes":{"allowHidden":false,"fieldAttrs":"{}","fieldFormatMap":"{\"hour_of_day\":{}}","fields":"[]","name":"Kibana Sample Data Logs","runtimeFieldMap":"{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['timestamp'].value.getHour());\"}}}","sourceFilters":"[]","timeFieldName":"timestamp","title":"kibana_sample_data_logs"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-22T15:27:04.601Z","id":"90943e30-9a47-11e8-b64d-95841ca0b247","managed":false,"references":[],"type":"index-pattern","typeMigrationVersion":"8.0.0","updated_at":"2024-01-22T18:34:19.022Z","version":"WzI1MiwxXQ=="}
{"attributes":{"description":"","state":{"adHocDataViews":{},"datasourceStates":{"formBased":{"layers":{"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a":{"columnOrder":["2c32f558-7549-44a5-9954-0578aa19642a","d229daf9-9658-4579-99af-01d8adb2f25f"],"columns":{"2c32f558-7549-44a5-9954-0578aa19642a":{"dataType":"date","isBucketed":true,"label":"timestamp","operationType":"date_histogram","params":{"dropPartials":false,"includeEmptyRows":true,"interval":"auto"},"scale":"interval","sourceField":"timestamp"},"d229daf9-9658-4579-99af-01d8adb2f25f":{"dataType":"number","isBucketed":false,"label":"Median of bytes","operationType":"median","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"bytes"}},"incompleteColumns":{},"sampling":1}}},"indexpattern":{"layers":{}},"textBased":{"layers":{}}},"filters":[],"internalReferences":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["d229daf9-9658-4579-99af-01d8adb2f25f"],"layerId":"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"2c32f558-7549-44a5-9954-0578aa19642a"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide"}},"title":"Lens vis (managed)","visualizationType":"lnsXY"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-17T18:36:58.721Z","id":"abc16953-36db-4a3b-a4ba-7a64ab8f130c","managed":true,"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"indexpattern-datasource-layer-e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","type":"index-pattern"}],"type":"lens","typeMigrationVersion":"8.9.0","updated_at":"2024-01-17T18:36:58.721Z","version":"Wzk0LDFd"}
{"attributes":{"description":"","state":{"adHocDataViews":{},"datasourceStates":{"formBased":{"layers":{"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a":{"columnOrder":["2c32f558-7549-44a5-9954-0578aa19642a","d229daf9-9658-4579-99af-01d8adb2f25f"],"columns":{"2c32f558-7549-44a5-9954-0578aa19642a":{"dataType":"date","isBucketed":true,"label":"timestamp","operationType":"date_histogram","params":{"dropPartials":false,"includeEmptyRows":true,"interval":"auto"},"scale":"interval","sourceField":"timestamp"},"d229daf9-9658-4579-99af-01d8adb2f25f":{"dataType":"number","isBucketed":false,"label":"Median of bytes","operationType":"median","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"bytes"}},"incompleteColumns":{},"sampling":1}}},"indexpattern":{"layers":{}},"textBased":{"layers":{}}},"filters":[],"internalReferences":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["d229daf9-9658-4579-99af-01d8adb2f25f"],"layerId":"e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"2c32f558-7549-44a5-9954-0578aa19642a"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide"}},"title":"Lens vis (unmanaged)","visualizationType":"lnsXY"},"coreMigrationVersion":"8.8.0","created_at":"2024-01-17T18:34:06.341Z","id":"49616953-36db-4a3b-a4ba-7a64ab8f130b","managed":false,"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"indexpattern-datasource-layer-e633b1af-3ab4-4bf5-8faa-fefde06c4a4a","type":"index-pattern"}],"type":"lens","typeMigrationVersion":"8.9.0","updated_at":"2024-01-17T18:34:06.341Z","version":"Wzg5LDFd"}
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":3,"missingRefCount":0,"missingReferences":[]}

This is how the UI should look for the managed visualization.

Screenshot 2024-01-18 at 12 01 30 PM

Checklist

Delete any items that are not applicable to this PR.

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

1 similar comment
@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon drewdaemon requested review from a team as code owners January 21, 2024 20:18
@drewdaemon
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@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.

ftr_configs.yml

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

@drewdaemon drewdaemon added the Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// label Jan 22, 2024
@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Member

@pheyos pheyos left a comment

Choose a reason for hiding this comment

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

test_subjects service changes LGTM

@stratoula
Copy link
Copy Markdown
Contributor

/ci

Copy link
Copy Markdown
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.

@drewdaemon this works great in the editor. Just one question and I will approve depending on the answer.

I can still edit this from a dashboard (inline editing). You going to address this in another PR, do I understand this correctly? I didn't see it in the description so I wonder if this is a next step or something we forgot to address!!

@@ -0,0 +1,3 @@
# @kbn/managed-content-badge

Empty package generated by @kbn/generate
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.

Maybe this Readme would need some love :D

toolTipProps: {
content: tooltipText,
position: 'bottom',
} as EuiToolTipProps,
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.

Do we need this casting?

@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #9 / UserActionPropertyActions renders the property actions

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 418 419 +1
lens 1238 1239 +1
total +2

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/managed-content-badge - 2 +2
presentationUtil 164 165 +1
total +3

Async chunks

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

id before after diff
dashboard 382.3KB 382.3KB +41.0B
lens 1.4MB 1.4MB +958.0B
presentationUtil 82.1KB 82.2KB +46.0B
total +1.0KB

Page load bundle

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

id before after diff
savedObjects 22.3KB 22.8KB +499.0B
Unknown metric groups

API count

id before after diff
@kbn/managed-content-badge - 2 +2
presentationUtil 219 220 +1
total +3

History

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

@drewdaemon
Copy link
Copy Markdown
Contributor Author

drewdaemon commented Jan 24, 2024

@stratoula

I can still edit this from a dashboard (inline editing). You going to address this in another PR, do I understand this correctly? I didn't see it in the description so I wonder if this is a next step or something we forgot to address!!

Correct. The following two issues (#172383, #172384) will prevent managed visualizations from being added to unmanaged dashboards. They will cover the inline editing case.

You can see the full plan on the meta issue.

Copy link
Copy Markdown
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.

Amazing, thanx Drew! LGTM!

@drewdaemon drewdaemon merged commit 1d4b7df into elastic:main Jan 24, 2024
@kibanamachine kibanamachine added v8.13.0 backport:skip This PR does not require backporting labels Jan 24, 2024
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Close elastic#166720

I marked this a breaking change since it is preventing users from doing
something they have been able to do before. They can no longer save
changes to managed Lens visualizations. Instead, they have to save
changes to a new visualization.

To test, import this `ndjson` file which includes both a managed and an
unmanaged visualization:

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
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 release_note:breaking Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.13.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens] Prevent overwriting managed content from editor

9 participants