-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Replace index patterns in TSVB visualizations #7929
Conversation
libbeat/dashboards/modify_json.go
Outdated
return string(d) | ||
} | ||
|
||
func ReplaceIndexInDashboardObject(index string, content common.MapStr) common.MapStr { |
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.
exported function ReplaceIndexInDashboardObject should have comment or be unexported
libbeat/dashboards/modify_json.go
Outdated
return visStateJSON | ||
} | ||
|
||
index_pattern, ok := params["index_pattern"].(string) |
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.
don't use underscores in Go names; var index_pattern should be indexPattern
@@ -42,24 +42,29 @@ type JSONFormat struct { | |||
} | |||
|
|||
func ReplaceIndexInIndexPattern(index string, content common.MapStr) common.MapStr { |
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.
Changes here are not directly related, I have just reorganized the code to have less nesting levels in these functions. Result should be the same.
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.
++ on the cleanup.
8601e6d
to
561cba2
Compare
When customizing the index pattern with `setup.dashboards.index`, references to index patterns need to be replaced in imported dashboards. It was not being done with objects that contain the index pattern in the `visState` object, as is the case of TSVB visualizations.
561cba2
to
b0fc21a
Compare
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.
Probably this will also need a needs_backport
label.
@@ -42,24 +42,29 @@ type JSONFormat struct { | |||
} | |||
|
|||
func ReplaceIndexInIndexPattern(index string, content common.MapStr) common.MapStr { |
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.
++ on the cleanup.
@@ -69,3 +69,45 @@ func TestReplaceStringInDashboard(t *testing.T) { | |||
assert.Equal(t, test.expected, result) | |||
} | |||
} | |||
|
|||
func TestReplaceIndexInDashboardObject(t *testing.T) { |
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.
Great, wanted to ask for tests :-)
@ruflin it was in progress, I was testing it, I think it is not working with |
No, sorry, false alarm, it is working 😃 |
When customizing the index pattern with `setup.dashboards.index`, references to index patterns need to be replaced in imported dashboards. It was not being done with objects that contain the index pattern in the `visState` object, as is the case of TSVB visualizations. (cherry picked from commit 7a8a476)
When customizing the index pattern with `setup.dashboards.index`, references to index patterns need to be replaced in imported dashboards. It was not being done with objects that contain the index pattern in the `visState` object, as is the case of TSVB visualizations. (cherry picked from commit 7a8a476)
Sorry about the |
When customizing the index pattern with `setup.dashboards.index`, references to index patterns need to be replaced in imported dashboards. It was not being done with objects that contain the index pattern in the `visState` object, as is the case of TSVB visualizations. (cherry picked from commit 7a8a476)
When customizing the index pattern with `setup.dashboards.index`, references to index patterns need to be replaced in imported dashboards. It was not being done with objects that contain the index pattern in the `visState` object, as is the case of TSVB visualizations. (cherry picked from commit 7a8a476)
…#7932) When customizing the index pattern with `setup.dashboards.index`, references to index patterns need to be replaced in imported dashboards. It was not being done with objects that contain the index pattern in the `visState` object, as is the case of TSVB visualizations. (cherry picked from commit f27fd7a)
When customizing the index pattern with
setup.dashboards.index
,references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the
visState
object, as is the case of TSVB visualizations.