Skip to content
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 x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -4457,6 +4457,8 @@
},
"release": {
"type": "string",
"deprecated": true,
"description": "release label is deprecated, derive from the version instead (packages follow semver)",
"enum": [
"experimental",
"beta",
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2791,6 +2791,10 @@ components:
type: string
release:
type: string
deprecated: true
description: >-
release label is deprecated, derive from the version instead
(packages follow semver)
enum:
- experimental
- beta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ properties:
type: string
release:
type: string
deprecated: true
description: release label is deprecated, derive from the version instead (packages follow semver)
enum:
- experimental
- beta
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@ export type PackageListItem = Installable<RegistrySearchResult> & {
id: string;
};

export type IntegrationCardReleaseLabel = 'beta' | 'preview' | 'ga' | 'rc';

export interface IntegrationCardItem {
url: string;
release?: 'beta' | 'experimental' | 'ga';
release?: IntegrationCardReleaseLabel;
description: string;
name: string;
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
} from '@elastic/eui';
import { useRouteMatch } from 'react-router-dom';

import { mapPackageReleaseToIntegrationCardRelease } from '../../../../../../../../services/package_prerelease';

import { getRegistryDataStreamAssetBaseName } from '../../../../../../../../../common/services';

import type {
Expand Down Expand Up @@ -148,7 +150,11 @@ export const PackagePolicyInputStreamConfig = memo<Props>(
)}
{packagePolicyInputStream.release && packagePolicyInputStream.release !== 'ga' ? (
<EuiFlexItem grow={false}>
<InlineReleaseBadge release={packagePolicyInputStream.release} />
<InlineReleaseBadge
release={mapPackageReleaseToIntegrationCardRelease(
packagePolicyInputStream.release
)}
/>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const argTypes = {
release: {
control: {
type: 'radio',
options: ['ga', 'beta', 'experimental'],
options: ['ga', 'beta', 'preview', 'rc'],
},
},
isUnverified: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const List = (props: Args) => (
name: 'aws',
release: 'beta',
id: 'package_two',
version: '1.0.0',
version: '1.0.0-beta',
url: 'https://example.com',
icons: [],
integration: 'integration',
Expand All @@ -84,9 +84,9 @@ export const List = (props: Args) => (
title: 'Package Three',
description: 'Not Installed Description',
name: 'azure',
release: 'experimental',
release: 'preview',
id: 'package_three',
version: '1.0.0',
version: '0.1.0',
url: 'https://example.com',
icons: [],
integration: 'integration',
Expand All @@ -110,7 +110,7 @@ export const List = (props: Args) => (
name: 'unknown',
release: 'beta',
id: 'package_five',
version: '1.0.0',
version: '1.0.0-beta',
url: 'https://example.com',
icons: [],
integration: 'integration',
Expand All @@ -120,9 +120,9 @@ export const List = (props: Args) => (
title: 'Package Six',
description: 'Installed Description',
name: 'kibana',
release: 'experimental',
release: 'preview',
id: 'package_six',
version: '1.0.0',
version: '0.1.0',
url: 'https://example.com',
icons: [],
integration: 'integration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import semverLt from 'semver/functions/lt';

import { getPackageReleaseLabel } from '../../../../../../services/package_prerelease';

import { splitPkgKey } from '../../../../../../../common/services';
import { HIDDEN_API_REFERENCE_PACKAGES } from '../../../../../../../common/constants';

Expand Down Expand Up @@ -312,7 +314,7 @@ export function Detail() {
</EuiFlexItem>
{packageInfo?.release && packageInfo.release !== 'ga' ? (
<EuiFlexItem grow={false}>
<HeaderReleaseBadge release={packageInfo.release} />
<HeaderReleaseBadge release={getPackageReleaseLabel(packageInfo.version)} />
</EuiFlexItem>
) : null}
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ import { Switch, Route } from 'react-router-dom';

import type { CustomIntegration } from '@kbn/custom-integrations-plugin/common';

import { getPackageReleaseLabel } from '../../../../../../services/package_prerelease';

import { installationStatuses } from '../../../../../../../common/constants';

import type { DynamicPage, DynamicPagePathValues, StaticPage } from '../../../../constants';
import { INTEGRATIONS_ROUTING_PATHS, INTEGRATIONS_SEARCH_QUERYPARAM } from '../../../../constants';
import { DefaultLayout } from '../../../../layouts';
import { isPackagePrerelease, isPackageUnverified } from '../../../../services';
import { isPackageUnverified } from '../../../../services';

import type { PackageListItem } from '../../../../types';

import type { IntegrationCardItem } from '../../../../../../../common/types/models';
import type {
IntegrationCardItem,
IntegrationCardReleaseLabel,
} from '../../../../../../../common/types/models';

import { useGetPackages } from '../../../../hooks';

Expand Down Expand Up @@ -89,15 +94,7 @@ export const mapToCard = ({
uiInternalPathUrl = url;
}

let release: 'ga' | 'beta' | 'experimental' | undefined;
if ('release' in item) {
release = item.release;
} else if ((item as CustomIntegration).isBeta === true) {
release = 'beta';
}
if (!isPackagePrerelease(version)) {
release = 'ga';
}
const release: IntegrationCardReleaseLabel = getPackageReleaseLabel(version);

return {
id: `${item.type === 'ui_link' ? 'ui_link' : 'epr'}:${item.id}`,
Expand Down
20 changes: 13 additions & 7 deletions x-pack/plugins/fleet/public/components/release_badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,34 @@ import React from 'react';
import { EuiBadge, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import type { PackageInfo, RegistryRelease } from '../types';
import type { IntegrationCardReleaseLabel } from '../../common/types';

const RELEASE_BADGE_LABEL: { [key in Exclude<RegistryRelease, 'ga'>]: string } = {
const RELEASE_BADGE_LABEL: { [key in Exclude<IntegrationCardReleaseLabel, 'ga'>]: string } = {
beta: i18n.translate('xpack.fleet.epm.releaseBadge.betaLabel', {
defaultMessage: 'Beta',
}),
experimental: i18n.translate('xpack.fleet.epm.releaseBadge.experimentalLabel', {
preview: i18n.translate('xpack.fleet.epm.releaseBadge.technicalPreviewLabel', {
defaultMessage: 'Technical preview',
}),
rc: i18n.translate('xpack.fleet.epm.releaseBadge.releaseCandidateLabel', {
defaultMessage: 'Release Candidate',
}),
};

const RELEASE_BADGE_DESCRIPTION: { [key in Exclude<RegistryRelease, 'ga'>]: string } = {
const RELEASE_BADGE_DESCRIPTION: { [key in Exclude<IntegrationCardReleaseLabel, 'ga'>]: string } = {
beta: i18n.translate('xpack.fleet.epm.releaseBadge.betaDescription', {
defaultMessage: 'This integration is not recommended for use in production environments.',
}),
experimental: i18n.translate('xpack.fleet.epm.releaseBadge.experimentalDescription', {
preview: i18n.translate('xpack.fleet.epm.releaseBadge.technicalPreviewDescription', {
defaultMessage:
'This functionality is in technical preview and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.',
}),
rc: i18n.translate('xpack.fleet.epm.releaseBadge.releaseCandidateDescription', {
defaultMessage: 'This integration is not recommended for use in production environments.',
}),
};

export const HeaderReleaseBadge: React.FC<{ release: NonNullable<PackageInfo['release']> }> = ({
export const HeaderReleaseBadge: React.FC<{ release: IntegrationCardReleaseLabel }> = ({
release,
}) => {
if (release === 'ga') return null;
Expand All @@ -43,7 +49,7 @@ export const HeaderReleaseBadge: React.FC<{ release: NonNullable<PackageInfo['re
);
};

export const InlineReleaseBadge: React.FC<{ release: NonNullable<PackageInfo['release']> }> = ({
export const InlineReleaseBadge: React.FC<{ release: IntegrationCardReleaseLabel }> = ({
release,
}) => {
if (release === 'ga') return null;
Expand Down
28 changes: 27 additions & 1 deletion x-pack/plugins/fleet/public/services/package_prerelease.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { isPackagePrerelease } from './package_prerelease';
import { getPackageReleaseLabel, isPackagePrerelease } from './package_prerelease';

describe('isPackagePrerelease', () => {
it('should return prerelease true for 0.1.0', () => {
Expand All @@ -32,3 +32,29 @@ describe('isPackagePrerelease', () => {
expect(isPackagePrerelease('1.0.0-dev.0')).toBe(true);
});
});

describe('getPackageReleaseLabel', () => {
it('should return preview for 0.1.0', () => {
expect(getPackageReleaseLabel('0.1.0')).toEqual('preview');
});

it('should return ga for 1.1.0', () => {
expect(getPackageReleaseLabel('1.1.0')).toEqual('ga');
});

it('should return preview for 1.0.0-preview1', () => {
expect(getPackageReleaseLabel('1.0.0-preview1')).toEqual('preview');
});

it('should return beta for 1.0.0-beta', () => {
expect(getPackageReleaseLabel('1.0.0-beta')).toEqual('beta');
});

it('should return rc for 1.0.0-rc', () => {
expect(getPackageReleaseLabel('1.0.0-rc')).toEqual('rc');
});

it('should return beta for 1.0.0-dev.0', () => {
expect(getPackageReleaseLabel('1.0.0-dev.0')).toBe('beta');
});
});
19 changes: 19 additions & 0 deletions x-pack/plugins/fleet/public/services/package_prerelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,26 @@
* 2.0.
*/

import type { IntegrationCardReleaseLabel, RegistryRelease } from '../../common/types';

export function isPackagePrerelease(version: string): boolean {
// derive from semver
return version.startsWith('0') || version.includes('-');
}

export function getPackageReleaseLabel(version: string): IntegrationCardReleaseLabel {
if (version.startsWith('0') || version.includes('-preview')) {
return 'preview';
} else if (version.includes('-rc')) {
return 'rc';
} else if (version.includes('-')) {
return 'beta';
}
return 'ga';
}

export function mapPackageReleaseToIntegrationCardRelease(
release: RegistryRelease
): IntegrationCardReleaseLabel {
return release === 'experimental' ? 'preview' : release;
}
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -13351,8 +13351,6 @@
"xpack.fleet.epm.pageSubtitle": "Choisissez une intégration pour commencer à collecter et à analyser vos données.",
"xpack.fleet.epm.releaseBadge.betaDescription": "Il n'est pas recommandé d'utiliser cette intégration dans les environnements de production.",
"xpack.fleet.epm.releaseBadge.betaLabel": "Bêta",
"xpack.fleet.epm.releaseBadge.experimentalDescription": "Cette fonctionnalité est en version d'évaluation technique et pourra être modifiée ou retirée complètement dans une future version. Elastic s'efforcera au maximum de corriger tout problème, mais les fonctionnalités en version d'évaluation technique ne sont pas soumises aux accords de niveau de service d'assistance des fonctionnalités officielles en disponibilité générale.",
"xpack.fleet.epm.releaseBadge.experimentalLabel": "Version d'évaluation technique",
"xpack.fleet.epm.screenshotErrorText": "Impossible de charger cette capture d'écran",
"xpack.fleet.epm.screenshotsTitle": "Captures d'écran",
"xpack.fleet.epm.updateAvailableTooltip": "Mise à jour disponible",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -13337,8 +13337,6 @@
"xpack.fleet.epm.pageSubtitle": "データの収集と分析を開始するには、統合を選択します。",
"xpack.fleet.epm.releaseBadge.betaDescription": "この統合は本番環境用ではありません。",
"xpack.fleet.epm.releaseBadge.betaLabel": "ベータ",
"xpack.fleet.epm.releaseBadge.experimentalDescription": "この機能はテクニカルプレビュー中であり、将来のリリースでは変更されたり完全に削除されたりする場合があります。Elasticは最善の努力を講じてすべての問題の修正に努めますが、テクニカルプレビュー中の機能には正式なGA機能のサポートSLAが適用されません。",
"xpack.fleet.epm.releaseBadge.experimentalLabel": "テクニカルプレビュー",
"xpack.fleet.epm.screenshotErrorText": "このスクリーンショットを読み込めません",
"xpack.fleet.epm.screenshotsTitle": "スクリーンショット",
"xpack.fleet.epm.updateAvailableTooltip": "更新が利用可能です",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -13357,8 +13357,6 @@
"xpack.fleet.epm.pageSubtitle": "选择集成以开始收集并分析数据。",
"xpack.fleet.epm.releaseBadge.betaDescription": "在生产环境中不推荐使用此集成。",
"xpack.fleet.epm.releaseBadge.betaLabel": "公测版",
"xpack.fleet.epm.releaseBadge.experimentalDescription": "此功能处于技术预览状态,在未来版本中可能会更改或完全移除。Elastic 将尽最大努力来修复任何问题,但处于技术预览状态的功能不受正式 GA 功能支持 SLA 的约束。",
"xpack.fleet.epm.releaseBadge.experimentalLabel": "技术预览",
"xpack.fleet.epm.screenshotErrorText": "无法加载此屏幕截图",
"xpack.fleet.epm.screenshotsTitle": "屏幕截图",
"xpack.fleet.epm.updateAvailableTooltip": "有可用更新",
Expand Down