-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Switch to SavedObjectClient.resolve #110059
[Lens] Switch to SavedObjectClient.resolve #110059
Conversation
0426a6f
to
2d034ba
Compare
0a2d926
to
7abf3c2
Compare
Following sharing Saved Objects developer guide: Step 2 This step demonstrates the changes to update client code to use the new SavedObjectsClient `resolve()` method instead of `get()`.
7abf3c2
to
b82354d
Compare
Pinging @elastic/kibana-vis-editors (Team:VisEditors) |
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 noticed a few small issues, overall this is looking great though -- exactly what I was hoping to see!
Yes, that link is how you generate sample data. I had to update the script in that comment, as there was a bit about references that was missing.
Here is the staging data that I generated from
export.ndjson.zip: it includes one "test lens" visualization, one "test dashboard" that embeds the lens vis, and one index pattern
Click to see staging data...
POST .kibana/_bulk
{"index":{"_id":"test1:index-pattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f-test1"}}
{"index-pattern":{"fieldAttrs":"{\"products.manufacturer\":{\"count\":1},\"products.price\":{\"count\":1},\"products.product_name\":{\"count\":1},\"total_quantity\":{\"count\":1}}","fieldFormatMap":"{\"taxful_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.[00]\"}},\"products.price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"taxless_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxless_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxful_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.min_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_unit_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}}}","fields":"[]","runtimeFieldMap":"{}","timeFieldName":"order_date","title":"kibana_sample_data_ecommerce","typeMeta":"{}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-08-31T17:21:59.650Z","namespace":"test1"}
{"index":{"_id":"test2:index-pattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2-newId"}}
{"index-pattern":{"fieldAttrs":"{\"products.manufacturer\":{\"count\":1},\"products.price\":{\"count\":1},\"products.product_name\":{\"count\":1},\"total_quantity\":{\"count\":1}}","fieldFormatMap":"{\"taxful_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.[00]\"}},\"products.price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"taxless_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxless_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxful_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.min_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_unit_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}}}","fields":"[]","runtimeFieldMap":"{}","timeFieldName":"order_date","title":"kibana_sample_data_ecommerce","typeMeta":"{}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-08-31T17:21:59.650Z","namespace":"test2"}
{"index":{"_id":"test3:index-pattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3"}}
{"index-pattern":{"fieldAttrs":"{\"products.manufacturer\":{\"count\":1},\"products.price\":{\"count\":1},\"products.product_name\":{\"count\":1},\"total_quantity\":{\"count\":1}}","fieldFormatMap":"{\"taxful_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.[00]\"}},\"products.price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"taxless_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxless_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxful_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.min_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_unit_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}}}","fields":"[]","runtimeFieldMap":"{}","timeFieldName":"order_date","title":"kibana_sample_data_ecommerce","typeMeta":"{}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-08-31T17:21:59.650Z","namespace":"test3"}
{"index":{"_id":"test3:index-pattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3-newId"}}
{"index-pattern":{"fieldAttrs":"{\"products.manufacturer\":{\"count\":1},\"products.price\":{\"count\":1},\"products.product_name\":{\"count\":1},\"total_quantity\":{\"count\":1}}","fieldFormatMap":"{\"taxful_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.[00]\"}},\"products.price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"taxless_total_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxless_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.taxful_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.min_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_unit_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}},\"products.base_price\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.00\"}}}","fields":"[]","runtimeFieldMap":"{}","timeFieldName":"order_date","title":"kibana_sample_data_ecommerce","typeMeta":"{}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-08-31T17:21:59.650Z","namespace":"test3"}
{"index":{"_id":"legacy-url-alias:test2:index-pattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2"}}
{"legacy-url-alias":{"targetNamespace":"test2","targetType":"index-pattern","targetId":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2-newId","sourceId":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"legacy-url-alias:test3:index-pattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3"}}
{"legacy-url-alias":{"targetNamespace":"test3","targetType":"index-pattern","targetId":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3-newId","sourceId":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"test1:lens:15522780-0a80-11ec-a4bf-616628b395be-test1"}}
{"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"6ed3487e-1153-4e63-aa3a-61c121a33400":{"columnOrder":["f39a1314-f878-4e70-a1d1-1063de7a1477"],"columns":{"f39a1314-f878-4e70-a1d1-1063de7a1477":{"dataType":"number","isBucketed":false,"label":"Unique count of currency","operationType":"unique_count","scale":"ratio","sourceField":"currency"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"accessor":"f39a1314-f878-4e70-a1d1-1063de7a1477","layerId":"6ed3487e-1153-4e63-aa3a-61c121a33400","layerType":"data"}},"title":"test lens","visualizationType":"lnsMetric"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test1","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test1","name":"indexpattern-datasource-layer-6ed3487e-1153-4e63-aa3a-61c121a33400","type":"index-pattern"}],"type":"lens","updated_at":"2021-08-31T17:22:57.148Z","namespace":"test1"}
{"index":{"_id":"test2:lens:15522780-0a80-11ec-a4bf-616628b395be-test2-newId"}}
{"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"6ed3487e-1153-4e63-aa3a-61c121a33400":{"columnOrder":["f39a1314-f878-4e70-a1d1-1063de7a1477"],"columns":{"f39a1314-f878-4e70-a1d1-1063de7a1477":{"dataType":"number","isBucketed":false,"label":"Unique count of currency","operationType":"unique_count","scale":"ratio","sourceField":"currency"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"accessor":"f39a1314-f878-4e70-a1d1-1063de7a1477","layerId":"6ed3487e-1153-4e63-aa3a-61c121a33400","layerType":"data"}},"title":"test lens","visualizationType":"lnsMetric"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2-newId","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2-newId","name":"indexpattern-datasource-layer-6ed3487e-1153-4e63-aa3a-61c121a33400","type":"index-pattern"}],"type":"lens","updated_at":"2021-08-31T17:22:57.148Z","namespace":"test2"}
{"index":{"_id":"test3:lens:15522780-0a80-11ec-a4bf-616628b395be-test3"}}
{"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"6ed3487e-1153-4e63-aa3a-61c121a33400":{"columnOrder":["f39a1314-f878-4e70-a1d1-1063de7a1477"],"columns":{"f39a1314-f878-4e70-a1d1-1063de7a1477":{"dataType":"number","isBucketed":false,"label":"Unique count of currency","operationType":"unique_count","scale":"ratio","sourceField":"currency"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"accessor":"f39a1314-f878-4e70-a1d1-1063de7a1477","layerId":"6ed3487e-1153-4e63-aa3a-61c121a33400","layerType":"data"}},"title":"test lens","visualizationType":"lnsMetric"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3","name":"indexpattern-datasource-layer-6ed3487e-1153-4e63-aa3a-61c121a33400","type":"index-pattern"}],"type":"lens","updated_at":"2021-08-31T17:22:57.148Z","namespace":"test3"}
{"index":{"_id":"test3:lens:15522780-0a80-11ec-a4bf-616628b395be-test3-newId"}}
{"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"6ed3487e-1153-4e63-aa3a-61c121a33400":{"columnOrder":["f39a1314-f878-4e70-a1d1-1063de7a1477"],"columns":{"f39a1314-f878-4e70-a1d1-1063de7a1477":{"dataType":"number","isBucketed":false,"label":"Unique count of currency","operationType":"unique_count","scale":"ratio","sourceField":"currency"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"accessor":"f39a1314-f878-4e70-a1d1-1063de7a1477","layerId":"6ed3487e-1153-4e63-aa3a-61c121a33400","layerType":"data"}},"title":"test lens","visualizationType":"lnsMetric"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3-newId","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3-newId","name":"indexpattern-datasource-layer-6ed3487e-1153-4e63-aa3a-61c121a33400","type":"index-pattern"}],"type":"lens","updated_at":"2021-08-31T17:22:57.148Z","namespace":"test3"}
{"index":{"_id":"legacy-url-alias:test2:lens:15522780-0a80-11ec-a4bf-616628b395be-test2"}}
{"legacy-url-alias":{"targetNamespace":"test2","targetType":"lens","targetId":"15522780-0a80-11ec-a4bf-616628b395be-test2-newId","sourceId":"15522780-0a80-11ec-a4bf-616628b395be-test2"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"legacy-url-alias:test3:lens:15522780-0a80-11ec-a4bf-616628b395be-test3"}}
{"legacy-url-alias":{"targetNamespace":"test3","targetType":"lens","targetId":"15522780-0a80-11ec-a4bf-616628b395be-test3-newId","sourceId":"15522780-0a80-11ec-a4bf-616628b395be-test3"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"test1:dashboard:397085d0-0a80-11ec-a4bf-616628b395be-test1"}}
{"dashboard":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\"},\"panelIndex\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"visualizationType\":\"lnsMetric\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3\"}],\"state\":{\"visualization\":{\"layerId\":\"58ae7d14-6f9a-423f-9dce-435a75785db3\",\"accessor\":\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\",\"layerType\":\"data\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"58ae7d14-6f9a-423f-9dce-435a75785db3\":{\"columns\":{\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\":{\"label\":\"Unique count of customer_gender\",\"dataType\":\"number\",\"operationType\":\"unique_count\",\"scale\":\"ratio\",\"sourceField\":\"customer_gender\",\"isBucketed\":false}},\"columnOrder\":[\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\"],\"incompleteColumns\":{}}}}}}},\"enhancements\":{}}},{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"20c73608-610c-4a60-ac60-517e66bc351f\"},\"panelIndex\":\"20c73608-610c-4a60-ac60-517e66bc351f\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_20c73608-610c-4a60-ac60-517e66bc351f\"}]","timeRestore":false,"title":"test dashboard","version":1},"coreMigrationVersion":"8.0.0","migrationVersion":{"dashboard":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test1","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test1","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3","type":"index-pattern"},{"id":"15522780-0a80-11ec-a4bf-616628b395be-test1","name":"20c73608-610c-4a60-ac60-517e66bc351f:panel_20c73608-610c-4a60-ac60-517e66bc351f","type":"lens"}],"type":"dashboard","updated_at":"2021-08-31T17:24:51.017Z","namespace":"test1"}
{"index":{"_id":"test2:dashboard:397085d0-0a80-11ec-a4bf-616628b395be-test2-newId"}}
{"dashboard":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\"},\"panelIndex\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"visualizationType\":\"lnsMetric\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3\"}],\"state\":{\"visualization\":{\"layerId\":\"58ae7d14-6f9a-423f-9dce-435a75785db3\",\"accessor\":\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\",\"layerType\":\"data\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"58ae7d14-6f9a-423f-9dce-435a75785db3\":{\"columns\":{\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\":{\"label\":\"Unique count of customer_gender\",\"dataType\":\"number\",\"operationType\":\"unique_count\",\"scale\":\"ratio\",\"sourceField\":\"customer_gender\",\"isBucketed\":false}},\"columnOrder\":[\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\"],\"incompleteColumns\":{}}}}}}},\"enhancements\":{}}},{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"20c73608-610c-4a60-ac60-517e66bc351f\"},\"panelIndex\":\"20c73608-610c-4a60-ac60-517e66bc351f\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_20c73608-610c-4a60-ac60-517e66bc351f\"}]","timeRestore":false,"title":"test dashboard","version":1},"coreMigrationVersion":"8.0.0","migrationVersion":{"dashboard":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2-newId","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2-newId","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3","type":"index-pattern"},{"id":"15522780-0a80-11ec-a4bf-616628b395be-test2-newId","name":"20c73608-610c-4a60-ac60-517e66bc351f:panel_20c73608-610c-4a60-ac60-517e66bc351f","type":"lens"}],"type":"dashboard","updated_at":"2021-08-31T17:24:51.017Z","namespace":"test2"}
{"index":{"_id":"test3:dashboard:397085d0-0a80-11ec-a4bf-616628b395be-test3"}}
{"dashboard":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\"},\"panelIndex\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"visualizationType\":\"lnsMetric\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3\"}],\"state\":{\"visualization\":{\"layerId\":\"58ae7d14-6f9a-423f-9dce-435a75785db3\",\"accessor\":\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\",\"layerType\":\"data\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"58ae7d14-6f9a-423f-9dce-435a75785db3\":{\"columns\":{\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\":{\"label\":\"Unique count of customer_gender\",\"dataType\":\"number\",\"operationType\":\"unique_count\",\"scale\":\"ratio\",\"sourceField\":\"customer_gender\",\"isBucketed\":false}},\"columnOrder\":[\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\"],\"incompleteColumns\":{}}}}}}},\"enhancements\":{}}},{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"20c73608-610c-4a60-ac60-517e66bc351f\"},\"panelIndex\":\"20c73608-610c-4a60-ac60-517e66bc351f\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_20c73608-610c-4a60-ac60-517e66bc351f\"}]","timeRestore":false,"title":"test dashboard","version":1},"coreMigrationVersion":"8.0.0","migrationVersion":{"dashboard":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3","type":"index-pattern"},{"id":"15522780-0a80-11ec-a4bf-616628b395be-test3","name":"20c73608-610c-4a60-ac60-517e66bc351f:panel_20c73608-610c-4a60-ac60-517e66bc351f","type":"lens"}],"type":"dashboard","updated_at":"2021-08-31T17:24:51.017Z","namespace":"test3"}
{"index":{"_id":"test3:dashboard:397085d0-0a80-11ec-a4bf-616628b395be-test3-newId"}}
{"dashboard":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\"},\"panelIndex\":\"8aa85371-1f6b-45c2-b214-46b4a78bcfc5\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"visualizationType\":\"lnsMetric\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3\"}],\"state\":{\"visualization\":{\"layerId\":\"58ae7d14-6f9a-423f-9dce-435a75785db3\",\"accessor\":\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\",\"layerType\":\"data\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"58ae7d14-6f9a-423f-9dce-435a75785db3\":{\"columns\":{\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\":{\"label\":\"Unique count of customer_gender\",\"dataType\":\"number\",\"operationType\":\"unique_count\",\"scale\":\"ratio\",\"sourceField\":\"customer_gender\",\"isBucketed\":false}},\"columnOrder\":[\"53e54413-274a-44c7-8f5f-e7659cbc6c2a\"],\"incompleteColumns\":{}}}}}}},\"enhancements\":{}}},{\"version\":\"8.0.0\",\"type\":\"lens\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"20c73608-610c-4a60-ac60-517e66bc351f\"},\"panelIndex\":\"20c73608-610c-4a60-ac60-517e66bc351f\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_20c73608-610c-4a60-ac60-517e66bc351f\"}]","timeRestore":false,"title":"test dashboard","version":1},"coreMigrationVersion":"8.0.0","migrationVersion":{"dashboard":"7.15.0"},"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3-newId","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3-newId","name":"8aa85371-1f6b-45c2-b214-46b4a78bcfc5:indexpattern-datasource-layer-58ae7d14-6f9a-423f-9dce-435a75785db3","type":"index-pattern"},{"id":"15522780-0a80-11ec-a4bf-616628b395be-test3-newId","name":"20c73608-610c-4a60-ac60-517e66bc351f:panel_20c73608-610c-4a60-ac60-517e66bc351f","type":"lens"}],"type":"dashboard","updated_at":"2021-08-31T17:24:51.017Z","namespace":"test3"}
{"index":{"_id":"legacy-url-alias:test2:dashboard:397085d0-0a80-11ec-a4bf-616628b395be-test2"}}
{"legacy-url-alias":{"targetNamespace":"test2","targetType":"dashboard","targetId":"397085d0-0a80-11ec-a4bf-616628b395be-test2-newId","sourceId":"397085d0-0a80-11ec-a4bf-616628b395be-test2"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"legacy-url-alias:test3:dashboard:397085d0-0a80-11ec-a4bf-616628b395be-test3"}}
{"legacy-url-alias":{"targetNamespace":"test3","targetType":"dashboard","targetId":"397085d0-0a80-11ec-a4bf-616628b395be-test3-newId","sourceId":"397085d0-0a80-11ec-a4bf-616628b395be-test3"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"space:test1"}}
{"space":{"name":"Test 1: Resolve Exact Match","initials":"T1","description":"In this space, test object(s) will resolve with an \"exactMatch\" outcome.","disabledFeatures":[]},"type":"space"}
{"index":{"_id":"space:test2"}}
{"space":{"name":"Test 2: Resolve Alias Match","initials":"T2","description":"In this space, test object(s) will resolve with an \"aliasMatch\" outcome.","disabledFeatures":[]},"type":"space"}
{"index":{"_id":"space:test3"}}
{"space":{"name":"Test 3: Resolve Conflict","initials":"T3","description":"In this space, test object(s) will resolve with a \"conflict\" outcome.","disabledFeatures":[]},"type":"space"}
Using that staging data, I could test with these links:
- Lens,
exactMatch
- http://localhost:5601/s/test1/app/lens#/edit/15522780-0a80-11ec-a4bf-616628b395be-test1?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) - Lens,
aliasMatch
- http://localhost:5601/s/test2/app/lens#/edit/15522780-0a80-11ec-a4bf-616628b395be-test2?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) -> redirects you to the new ID for that object - Lens,
conflict
- http://localhost:5601/s/test3/app/lens#/edit/15522780-0a80-11ec-a4bf-616628b395be-test3?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) -> clicking the button redirects you to the conflicting object that has a new ID - Dashboard,
exactMatch
- http://localhost:5601/s/test1/app/dashboards#/view/397085d0-0a80-11ec-a4bf-616628b395be-test1?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) - Dashboard,
aliasMatch
- http://localhost:5601/s/test2/app/dashboards#/view/397085d0-0a80-11ec-a4bf-616628b395be-test2?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) - Dashboard,
conflict
- http://localhost:5601/s/test3/app/dashboards#/view/397085d0-0a80-11ec-a4bf-616628b395be-test3?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))
One general question for you: is there any way to differentiate how the embeddable is loading?
For example, there are two ways to load a dashboard:
- Using the link for the saved object
- Using a "Snapshot URL"
If you're using the link for the saved object, there is no reason to resolve()
the embedded visualizations, since object IDs are loaded from up-to-date references.
However, if you're using a snapshot URL, that's when you need to use resolve()
for the embedded visualizations, because the object IDs are coming from outside of Kibana (in this case, wherever the user saved that URL)
documentationLink: ( | ||
<EuiLink | ||
external | ||
href="https://www.elastic.co/guide/en/kibana/master/resolve_copy_saved_objects_conflicts.html" |
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.
A couple points:
- This link is wrong, the correct link is https://www.elastic.co/guide/en/kibana/master/legacy-url-aliases.html
- We should probably use the
docLinks
service here; I think the best thing to do is to modify the Core service and make this available to all consumers from there, so I'll submit a PR to do that. It looks like you'll need to pass in thedocLinks
service via the EmbeddableFactory to leverage it.
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 corrected the link just hardcoding it. Should I wait for you for the PR modifying core service and then do my changes?
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.
Thanks, I didn't get to submit the PR yet, it's been a crazy week.
I'd say this: go ahead and merge this as-is, and I will fix this in my PR.
x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts
Outdated
Show resolved
Hide resolved
…edObjectClientResolve2
<> | ||
<FormattedMessage | ||
id="xpack.lens.embeddable.legacyURLConflict.longMessage" | ||
defaultMessage="You have encountered a legacy URL alias conflict. See the {documentationLink} for more information." |
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.
Perhaps we'll want to get the @elastic/kibana-docs team's input on this?
(see PR description above for screenshot!)
{expandError ? ( | ||
<EuiCallOut | ||
title={i18n.translate('xpack.lens.embeddable.legacyURLConflict.expandErrorText', { | ||
defaultMessage: `Found a specified object and an alias for the same URL. You can disable the alias to resolve this error: {json}`, |
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.
Perhaps we'll want to get the @elastic/kibana-docs team's input on this?
(see PR description above for screenshot!)
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.
Tested this again and LGTM! A few more comments below too. Thanks so much!
Suggestion: Title: You've encountered a URL conflict Show details |
@elasticmachine merge upstream |
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 works fine. I just left one nit comment. Code LGTM and everything works as expected. I noticed that the dashboard aliasMatch returns an error but I discussed it with Marta and I agree that it is not Lens related but happens because the dashboard hasn't implemented yet the SOs changes.
Just some thoughts:
Do we want to have the word objects
in the title here? Maybe visualizations make more sense to the users?
Maybe we could rephrase a bit the text? It seems a bit technical to me (also do we need to show the ids?). Something like:
You are currently looking at a visualization with a legacy url alias
Button:
Check the other visualization
or maybe @elastic/kibana-docs could also help us a bit here too?
@stratoula about the text on the notification, the whole content comes from here:
https://github.com/elastic/kibana/pull/110059/files#diff-62b4eca6ab93c938023295869419d9b3031fd1c11470d5a3fec89f0012bbf036R183-R191 |
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.
@mbondyra got it! Thanx for the clarification. In that case LGTM ❤️
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
* Step 2: Update client code to use resolve() method instead of get() Following sharing Saved Objects developer guide: Step 2 This step demonstrates the changes to update client code to use the new SavedObjectsClient `resolve()` method instead of `get()`. * Step 3 Lens
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* Step 2: Update client code to use resolve() method instead of get() Following sharing Saved Objects developer guide: Step 2 This step demonstrates the changes to update client code to use the new SavedObjectsClient `resolve()` method instead of `get()`. * Step 3 Lens Co-authored-by: Marta Bondyra <[email protected]>
Summary
Fixes #105808
exactMatch
outcomeThe behavior doesn't change
aliasMatch
For the dashboard, the behavior doesn't change.
For the editor, it redirects to the new url and displays the notification:
conflict
For the dashboard:
For the editor:
testing
@jportner let me know if this is correct way to test it.
Follow the instructions from here: #107099 (comment)
Remember about adding the base path to the urls if you use it when doing the
curl
step.Once you do the steps, go to
http://localhost:5601/
and check all the spaces.exactMatch
- you can check the link by modifying original object [id] to[id]-test1
in the linkaliasMatch
can be checked by modifying the original link (from the [id] to[id]-test2
) (we're simulating user having this link bookmarked)conflict
is listed in Visualize App. You can also embed it in the Dashboard to check how it behaves.Checklist
Delete any items that are not applicable to this PR.
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: