diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index 6254d333a66be..42db2ff330680 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -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", diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index 0295ea7e44f03..08581dea73259 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -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 diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/package_info.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/package_info.yaml index 80c777a07718c..17f70e274ed52 100644 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/package_info.yaml +++ b/x-pack/plugins/fleet/common/openapi/components/schemas/package_info.yaml @@ -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 diff --git a/x-pack/plugins/fleet/common/types/models/epm.ts b/x-pack/plugins/fleet/common/types/models/epm.ts index 2a226864dab7e..4ef4a7fdd751b 100644 --- a/x-pack/plugins/fleet/common/types/models/epm.ts +++ b/x-pack/plugins/fleet/common/types/models/epm.ts @@ -419,9 +419,11 @@ export type PackageListItem = Installable & { 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; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_stream.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_stream.tsx index 9b94537a73c27..54b6205da2ed9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_stream.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_stream.tsx @@ -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 { @@ -148,7 +150,11 @@ export const PackagePolicyInputStreamConfig = memo( )} {packagePolicyInputStream.release && packagePolicyInputStream.release !== 'ga' ? ( - + ) : null} diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.stories.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.stories.tsx index dee9dfbe4d42b..f17ca41ef41b4 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.stories.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.stories.tsx @@ -36,7 +36,7 @@ const argTypes = { release: { control: { type: 'radio', - options: ['ga', 'beta', 'experimental'], + options: ['ga', 'beta', 'preview', 'rc'], }, }, isUnverified: { diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx index 0e746d8ca8195..aa472212940a3 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx @@ -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', @@ -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', @@ -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', @@ -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', diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx index 42c5cc535d6b7..b18e0b49d2445 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx @@ -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'; @@ -312,7 +314,7 @@ export function Detail() { {packageInfo?.release && packageInfo.release !== 'ga' ? ( - + ) : null} diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx index 5b9227553c79e..31c7ee7eeb362 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx @@ -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'; @@ -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}`, diff --git a/x-pack/plugins/fleet/public/components/release_badge.tsx b/x-pack/plugins/fleet/public/components/release_badge.tsx index 3252ea21ee2df..488b2a6a46131 100644 --- a/x-pack/plugins/fleet/public/components/release_badge.tsx +++ b/x-pack/plugins/fleet/public/components/release_badge.tsx @@ -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]: string } = { +const RELEASE_BADGE_LABEL: { [key in Exclude]: 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]: string } = { +const RELEASE_BADGE_DESCRIPTION: { [key in Exclude]: 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 }> = ({ +export const HeaderReleaseBadge: React.FC<{ release: IntegrationCardReleaseLabel }> = ({ release, }) => { if (release === 'ga') return null; @@ -43,7 +49,7 @@ export const HeaderReleaseBadge: React.FC<{ release: NonNullable }> = ({ +export const InlineReleaseBadge: React.FC<{ release: IntegrationCardReleaseLabel }> = ({ release, }) => { if (release === 'ga') return null; diff --git a/x-pack/plugins/fleet/public/services/package_prerelease.test.ts b/x-pack/plugins/fleet/public/services/package_prerelease.test.ts index c8843d304de55..cb4fe530571d3 100644 --- a/x-pack/plugins/fleet/public/services/package_prerelease.test.ts +++ b/x-pack/plugins/fleet/public/services/package_prerelease.test.ts @@ -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', () => { @@ -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'); + }); +}); diff --git a/x-pack/plugins/fleet/public/services/package_prerelease.ts b/x-pack/plugins/fleet/public/services/package_prerelease.ts index 0df6e0deee409..6cda43e20e642 100644 --- a/x-pack/plugins/fleet/public/services/package_prerelease.ts +++ b/x-pack/plugins/fleet/public/services/package_prerelease.ts @@ -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; +} diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 28b01bd81281a..cf5350b4af2f6 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -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", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 4f2f30e3e1fdb..9bf83166e2cab 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -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": "更新が利用可能です", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index c11034dbc5b93..4f153aeee34ce 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -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": "有可用更新",