-
Notifications
You must be signed in to change notification settings - Fork 130
Implement shared tags functionality to remove tags when dashboard export #3163
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| func isSharedTag(aId string, sharedTags []string) bool { | ||
| for _, tag := range sharedTags { | ||
| id := fmt.Sprintf("tag-ref-%s-default", strings.ReplaceAll(strings.ToLower(tag), " ", "-")) |
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.
does the shared tag have more formatting than this?
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.
Is this format set by Fleet? Not sure if we can rely on it, it could be changed without previous notice.
Though we should not care a lot if we check by names instead of ids.
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.
fleet is actually parsing a specific id for shared tags https://github.com/elastic/kibana/blob/5385f96a132114362b2542e6a44c96a697b66c28/x-pack/platform/plugins/shared/fleet/server/services/epm/kibana/assets/tag_assets.ts#L67
i've reviewed the pr and have taken into account this format to identify the shared tags when exporting a dashboard.
jsoriano
left a comment
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.
Approach looks mostly good to me. I only wonder if we are relying on ids, when we are interested on the names, that is what users see.
Tried to re-export all Crowdstrike dashboards and the changes make sense to me 👍
|
|
||
| func isSharedTag(aId string, sharedTags []string) bool { | ||
| for _, tag := range sharedTags { | ||
| id := fmt.Sprintf("tag-ref-%s-default", strings.ReplaceAll(strings.ToLower(tag), " ", "-")) |
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.
Is this format set by Fleet? Not sure if we can rely on it, it could be changed without previous notice.
Though we should not care a lot if we check by names instead of ids.
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.
Nit. It is usually discouraged to use underscores in go files or package names, as some of them have special meanings (_test, _linux...).
Maybe this file could be called just removesharedtags.go, or we could merge all these files into a single tags.go.
Though I see there are already other files here with underscores.
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 followed the naming i saw.. but agree, i think we can merge into a single one 👍🏻
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.
consolidated tag functions into new ´tag.go´ file
💚 Build Succeeded
History
|
tags.ymlfile)When exporting a dashboard, tags that are shared (defined at kibana/tags.yml) where being also exported into
kibana/tagfolder.Shared tags are managed by fleet when reading the
tags.ymlso exporting them asjsonis duplicating this tags in the UI.This PR adds a filter layer when exporting a dashboard, removing shared tag objects and dashboard references to them.
Identification of tags is done based on fleet criteria on creating the json objects when reading the ´tags.yml´ file.
Updated unit tests to include shared tags object and check the filter is working as expected