Skip to content

Commit 7ca7ce5

Browse files
[Fleet] Fix missing Alerting tab for pre-installed integrations (elastic#270646)
# Summary Closes elastic#256826 Pre-installed (bundled) integrations such as Fleet Server and Elastic Synthetics were not showing the Alerting tab even when they had rule templates installed. The tab visibility logic only checked `packageInfo.assets.kibana` (the archive manifest), but for bundled packages, alerting assets are recorded in `installationInfo.installed_kibana` after installation — not in the archive manifest. This adds a second check against `installed_kibana` so the tab appears whenever alerting assets are actually installed, regardless of install source. Also adds test coverage to future-proof against regressions. ## Testing 1. Navigate to Data Management → Integrations → Installed integrations. 2. Open a pre-installed integration (e.g. Fleet Server or Elastic Synthetics). 3. Verify the Alerting tab is now visible in the integration detail navigation. 4. As a sanity check, confirm the rule templates shown in the Alerting tab match those available under Stack Management → Rules → Create rule → Template for that integration. <img width="1706" height="1274" alt="image" src="https://github.com/user-attachments/assets/c9da3850-cd03-41e7-bce4-af021ba71732" /> ## Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation ](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)was added for features that require explanation or tutorials - [ ] [Unit or functional tests ](https://www.elastic.co/guide/en/kibana/master/development-tests.html)were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations. - [ ] [Flaky Test Runner ](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines ](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)and apply applicable backport:* labels. ## Identify risks N/A Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 42f79fe commit 7ca7ce5

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

  • x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail

x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type {
2121
GetVerificationKeyIdResponse,
2222
} from '../../../../../../../common/types/rest_spec';
2323
import type { KibanaAssetType } from '../../../../../../../common/types/models';
24+
import { KibanaSavedObjectType } from '../../../../../../../common/types/models';
2425
import {
2526
agentPolicyRouteService,
2627
appRoutesService,
@@ -189,6 +190,42 @@ describe('When on integration detail', () => {
189190
// Reset to default
190191
ExperimentalFeaturesService.init(allowedExperimentalValues);
191192
});
193+
194+
it('should show Alerting tab for pre-installed packages with alerting assets in installationInfo', async () => {
195+
const baseResponse = mockedApi.responseProvider.epmGetInfo('nginx');
196+
const kibanaAssets = baseResponse.item.assets?.kibana as Record<string, unknown> | undefined;
197+
const itemWithInstalledAlertingAssets = {
198+
...baseResponse.item,
199+
assets: {
200+
...baseResponse.item.assets,
201+
kibana: {
202+
dashboard: kibanaAssets?.dashboard ?? [],
203+
search: kibanaAssets?.search ?? [],
204+
visualization: kibanaAssets?.visualization ?? [],
205+
},
206+
},
207+
installationInfo: {
208+
install_source: 'bundled' as const,
209+
installed_kibana: [
210+
{
211+
id: 'nginx-inactivity-rule',
212+
type: KibanaSavedObjectType.alertingRuleTemplate,
213+
},
214+
],
215+
},
216+
};
217+
mockedApi.responseProvider.epmGetInfo.mockReturnValue({
218+
...baseResponse,
219+
item: itemWithInstalledAlertingAssets as typeof baseResponse.item,
220+
});
221+
await render();
222+
await act(() => mockedApi.waitForApi());
223+
await act(() => mockedApi.waitForApi());
224+
await act(() => mockedApi.waitForApi());
225+
await act(() => mockedApi.waitForApi());
226+
227+
expect(await renderResult.findByTestId('tab-alerting')).not.toBeNull();
228+
});
192229
});
193230

194231
function mockGAAndPrereleaseVersions(pkgVersion: string) {

x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,14 @@ export function Detail() {
323323
const hasArchiveAlertingAssets = Object.keys(packageInfo?.assets?.kibana ?? {}).some((type) =>
324324
(ALERTING_ASSET_TYPES as string[]).includes(type)
325325
);
326+
const pkgInstallationInfo =
327+
packageInfo && 'installationInfo' in packageInfo ? packageInfo.installationInfo : undefined;
328+
const hasInstalledAlertingAssets = (pkgInstallationInfo?.installed_kibana ?? []).some((asset) =>
329+
(ALERTING_ASSET_TYPES as string[]).includes(asset.type)
330+
);
326331
const showAlertingTab =
327332
hasArchiveAlertingAssets ||
333+
hasInstalledAlertingAssets ||
328334
(isInstalled && packageInfo?.type === 'integration' && enableIntegrationInactivityAlerting);
329335

330336
// Track install status state

0 commit comments

Comments
 (0)