Skip to content

Commit

Permalink
[Fleet] Fix security solution tag id
Browse files Browse the repository at this point in the history
  • Loading branch information
criamico committed Aug 23, 2023
1 parent 054cdba commit ce77744
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ describe('tagKibanaAssets', () => {
} as any;
const assetTags = [
{
text: 'SecuritySolution',
text: 'Security Solution',
asset_types: ['dashboard'],
},
];
Expand Down Expand Up @@ -733,9 +733,9 @@ describe('tagKibanaAssets', () => {
{
color: expect.any(String),
description: 'Tag defined in package-spec',
name: 'SecuritySolution',
name: 'Security Solution',
},
{ id: 'SecuritySolution', overwrite: true, refresh: false }
{ id: 'security-solution-default', overwrite: true, refresh: false }
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const MANAGED_TAG_COLOR = '#0077CC';
const PACKAGE_TAG_COLOR = '#4DD2CA';
const MANAGED_TAG_NAME = 'Managed';
const LEGACY_MANAGED_TAG_ID = 'managed';
const SECURITY_SOLUTION_TAG_ID = 'SecuritySolution';
const SECURITY_SOLUTION_TAG_NAME = 'Security Solution';
const SECURITY_SOLUTION_TAG_ID = 'security-solution-default';

// the tag service only accepts 6-digits hex colors
const TAG_COLORS = [
Expand All @@ -61,10 +62,10 @@ const getLegacyPackageTagId = (pkgName: string) => pkgName;
/*
This function is exported via fleet/plugin.ts to make it available to other plugins
The `SecuritySolution` tag is a special case that needs to be handled separately
In that case simply return `SecuritySolution`
In that case return id `security-solution-default`
*/
export const getPackageSpecTagId = (spaceId: string, pkgName: string, tagName: string) => {
if (tagName.toLowerCase() === SECURITY_SOLUTION_TAG_ID.toLowerCase())
if (tagName.toLowerCase() === SECURITY_SOLUTION_TAG_NAME.toLowerCase())
return SECURITY_SOLUTION_TAG_ID;
// UUID v5 needs a namespace (uuid.DNS) to generate a predictable uuid
const uniqueId = uuidv5(`${tagName.toLowerCase()}`, uuidv5.DNS);
Expand Down

0 comments on commit ce77744

Please sign in to comment.