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

Fix web log sample visualization & vis-builder not rendering with data source issue #6948

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/6948.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix web log sample visualization & vis-builder not rendering with data source issue ([#6948](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6948))
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we change from indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index to doc id?

Copy link
Member Author

Choose a reason for hiding this comment

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

so if you check the other sample visualizations that are working fine, they all following same pattern

  1. define "index" in "searchSourceJson"
  2. define "references" field as empty array.

But visualizations in this file are not following the pattern, that's why only them will fail our logic to add reference to data source, and fail to render with data source.

},
title: '(Line) Avg bytes over time',
uiStateJSON: '{}',
Expand All @@ -408,13 +408,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '39b5bd70-eb7b-11ed-8e00-17d7d50cd7b2',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
zhongnansu marked this conversation as resolved.
Show resolved Hide resolved
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzE2LDFd',
Expand Down Expand Up @@ -525,7 +519,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Area) Stacked extensions over time',
uiStateJSON: '{}',
Expand All @@ -535,13 +529,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: 'c0ba29f0-eb8f-11ed-8e00-17d7d50cd7b2',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzIyLDFd',
Expand Down Expand Up @@ -652,7 +640,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Vertical Bar) Stacked responses over time',
uiStateJSON: '{}',
Expand All @@ -662,13 +650,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '23a5de70-eb99-11ed-8e00-17d7d50cd7b2',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzI4LDFd',
Expand Down Expand Up @@ -780,7 +762,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Horizontal Bar) Top destination count',
uiStateJSON: '{}',
Expand All @@ -790,13 +772,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '08741f50-2275-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzM0LDFd',
Expand Down Expand Up @@ -889,7 +865,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Heatmap) Source vs OS',
uiStateJSON: '{}',
Expand All @@ -899,13 +875,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '3d034700-227f-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzM5LDFd',
Expand Down Expand Up @@ -953,7 +923,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Table) Bytes by request stats summary',
uiStateJSON: '{"vis":{"sortColumn":{"colIndex":0,"direction":"asc"}}}',
Expand All @@ -963,13 +933,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: 'f8df8de0-22a6-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzQyLDFd',
Expand Down Expand Up @@ -1061,7 +1025,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Metric) Unique visitors',
uiStateJSON: '{}',
Expand All @@ -1071,13 +1035,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '104396f0-22a4-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzQ3LDFd',
Expand Down Expand Up @@ -1170,7 +1128,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Pie) Visitors by OS',
uiStateJSON: '{}',
Expand All @@ -1180,13 +1138,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '7fd12620-2a44-11ee-92de-ad1b6a4928e5',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzUyLDFd',
Expand Down Expand Up @@ -1234,7 +1186,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Gauge) Average bytes by extension',
uiStateJSON: '{}',
Expand All @@ -1244,13 +1196,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: 'f772de50-2281-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzU1LDFd',
Expand Down Expand Up @@ -1298,7 +1244,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Goal) Average machine RAM',
uiStateJSON: '{}',
Expand All @@ -1308,13 +1254,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '9b0ae760-2282-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzU4LDFd',
Expand Down Expand Up @@ -1362,7 +1302,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Coordinate Map) Geohash coordinates',
uiStateJSON: '{"mapZoom":3,"mapCenter":[35.0659731379842,-107.80640422373408]}',
Expand All @@ -1372,13 +1312,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: 'fe07f770-227f-11ee-b88b-47a93b5c527c',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzYxLDFd',
Expand All @@ -1388,7 +1322,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Region Map) Destination count',
uiStateJSON: '{}',
Expand All @@ -1398,13 +1332,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: 'eb268650-2a43-11ee-92de-ad1b6a4928e5',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzYyLDFd',
Expand Down Expand Up @@ -1490,7 +1418,7 @@ export const getSavedObjects = (): SavedObject[] => [
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON:
'{"query":{"query":"","language":"kuery"},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}',
'{"index":"90943e30-9a47-11e8-b64d-95841ca0b247","query":{"query":"","language":"kuery"},"filter":[]}',
},
title: '(Tag Cloud) Requests',
uiStateJSON: '{}',
Expand All @@ -1500,13 +1428,7 @@ export const getSavedObjects = (): SavedObject[] => [
},
id: '81017350-2a45-11ee-92de-ad1b6a4928e5',
migrationVersion: { visualization: '7.10.0' },
references: [
{
id: '90943e30-9a47-11e8-b64d-95841ca0b247',
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
},
],
references: [],
type: 'visualization',
updated_at: '2023-07-25T17:00:34.843Z',
version: 'WzY3LDFd',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const appendDataSourceId = (id: string) => {
const overrideSavedObjectId = (savedObject: SavedObject, idGenerator: (id: string) => string) => {
savedObject.id = idGenerator(savedObject.id);
// update reference
if (savedObject.type === 'dashboard') {
if (savedObject.type === 'dashboard' || savedObject.type === 'visualization-visbuilder') {
savedObject.references.map((reference) => {
if (reference.id) {
reference.id = idGenerator(reference.id);
Expand Down Expand Up @@ -88,7 +88,8 @@ export const getSavedObjectsWithDataSource = (
if (
saveObject.type === 'dashboard' ||
saveObject.type === 'visualization' ||
saveObject.type === 'search'
saveObject.type === 'search' ||
saveObject.type === 'visualization-visbuilder'
) {
saveObject.attributes.title = saveObject.attributes.title + `_${dataSourceTitle}`;
}
Expand Down
Loading