Skip to content

Commit

Permalink
[Fleet] Display owner type in package details (elastic#171239)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet authored Nov 15, 2023
1 parent 1ecb6ba commit 74a5fba
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/common/types/models/package_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface PackageSpecManifest {
screenshots?: PackageSpecScreenshot[];
policy_templates?: RegistryPolicyTemplate[];
vars?: RegistryVarsEntry[];
owner: { github: string };
owner: { github: string; type?: 'elastic' | 'partner' | 'community' };
elasticsearch?: Pick<
RegistryElasticsearch,
'index_template.settings' | 'index_template.mappings' | 'index_template.data_stream'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,45 @@ export const Details: React.FC<Props> = memo(({ packageInfo }) => {
),
});

let ownerTypeDescription: React.ReactNode;
switch (packageInfo.owner.type) {
case 'community':
ownerTypeDescription = (
<FormattedMessage
id="xpack.fleet.epm.ownerTypeCommunityDescription"
defaultMessage="Community"
/>
);
break;
case 'partner':
ownerTypeDescription = (
<FormattedMessage
id="xpack.fleet.epm.ownerTypePartnerDescription"
defaultMessage="Partner"
/>
);
break;
case 'elastic':
ownerTypeDescription = (
<FormattedMessage
id="xpack.fleet.epm.ownerTypeElasticDescription"
defaultMessage="Elastic"
/>
);
break;
}

if (ownerTypeDescription) {
items.push({
title: (
<EuiTextColor color="subdued">
<FormattedMessage id="xpack.fleet.epm.ownerTypeLabel" defaultMessage="Developed by" />
</EuiTextColor>
),
description: ownerTypeDescription,
});
}

// License details
if (packageInfo.licensePath || packageInfo.source?.license || packageInfo.notice) {
items.push({
Expand Down Expand Up @@ -233,6 +272,7 @@ export const Details: React.FC<Props> = memo(({ packageInfo }) => {
packageInfo.licensePath,
packageInfo.notice,
packageInfo.source?.license,
packageInfo.owner.type,
packageInfo.version,
toggleLicenseModal,
toggleNoticeModal,
Expand Down

0 comments on commit 74a5fba

Please sign in to comment.