diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts index 42c05c2d80d37c..73a6e74a9e5eaa 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts @@ -55,6 +55,7 @@ shareMock.url.locators.get = (id: IdKey) => ({ export const getAppContextMock = () => ({ isReadOnlyMode: false, + isInfraPluginAvailable: true, kibanaVersionInfo: { currentMajor: mockKibanaSemverVersion.major, prevMajor: mockKibanaSemverVersion.major - 1, diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_logs_step/fix_logs_step.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_logs_step/fix_logs_step.test.tsx index c81e0b2bd943ee..2dd88036c6fcb6 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_logs_step/fix_logs_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_logs_step/fix_logs_step.test.tsx @@ -211,6 +211,20 @@ describe('Overview - Fix deprecation logs step', () => { ); }); + test(`Doesn't show observability app link if infra app is not available`, async () => { + await act(async () => { + testBed = await setupOverviewPage({ + isInfraPluginAvailable: false, + }); + }); + + const { component, exists } = testBed; + + component.update(); + + expect(exists('viewObserveLogs')).toBe(false); + }); + test('Has a link to see logs in discover app', async () => { await act(async () => { testBed = await setupOverviewPage(); diff --git a/x-pack/plugins/upgrade_assistant/kibana.json b/x-pack/plugins/upgrade_assistant/kibana.json index 4573be8fdc0412..db53d7b1ae6f2c 100644 --- a/x-pack/plugins/upgrade_assistant/kibana.json +++ b/x-pack/plugins/upgrade_assistant/kibana.json @@ -8,7 +8,7 @@ "githubTeam": "kibana-stack-management" }, "configPath": ["xpack", "upgrade_assistant"], - "requiredPlugins": ["management", "data", "licensing", "features", "infra", "share"], - "optionalPlugins": ["usageCollection", "cloud"], + "requiredPlugins": ["management", "data", "licensing", "features", "share"], + "optionalPlugins": ["usageCollection", "cloud", "infra"], "requiredBundles": ["esUiShared", "kibanaReact", "kibanaUtils"] } diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/fix_logs_step/external_links.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/fix_logs_step/external_links.tsx index 7ced564fab2040..3a16b7ac78f7d9 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/fix_logs_step/external_links.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/fix_logs_step/external_links.tsx @@ -105,22 +105,26 @@ const ObservabilityAppLink: FunctionComponent = ({ checkpoint }) => { }; export const ExternalLinks: FunctionComponent = ({ checkpoint }) => { + const { isInfraPluginAvailable } = useAppContext(); + return ( - - - -

- -

-
- - -
-
+ {isInfraPluginAvailable && ( + + + +

+ +

+
+ + +
+
+ )} diff --git a/x-pack/plugins/upgrade_assistant/public/plugin.ts b/x-pack/plugins/upgrade_assistant/public/plugin.ts index 1b33ec676e1c0b..47bcb442e83219 100644 --- a/x-pack/plugins/upgrade_assistant/public/plugin.ts +++ b/x-pack/plugins/upgrade_assistant/public/plugin.ts @@ -42,7 +42,7 @@ export class UpgradeAssistantUIPlugin title: pluginName, order: 1, async mount(params) { - const [coreStart, { data }] = await coreSetup.getStartServices(); + const [coreStart, { data, ...plugins }] = await coreSetup.getStartServices(); const { chrome: { docTitle }, @@ -53,6 +53,10 @@ export class UpgradeAssistantUIPlugin const appDependencies: AppDependencies = { kibanaVersionInfo, isReadOnlyMode: readonly, + // Infra plugin doesnt export anything as a public interface. So the only + // way we have at this stage for checking if the plugin is available or not + // is by checking if the startServices has the `infra` key. + isInfraPluginAvailable: plugins.hasOwnProperty('infra'), plugins: { cloud, share, diff --git a/x-pack/plugins/upgrade_assistant/public/types.ts b/x-pack/plugins/upgrade_assistant/public/types.ts index d59e9b158b74e3..dfdf0006a2bb39 100644 --- a/x-pack/plugins/upgrade_assistant/public/types.ts +++ b/x-pack/plugins/upgrade_assistant/public/types.ts @@ -34,6 +34,7 @@ export interface StartDependencies { export interface AppDependencies { isReadOnlyMode: boolean; + isInfraPluginAvailable: boolean; kibanaVersionInfo: KibanaVersionContext; plugins: { cloud?: CloudSetup; diff --git a/x-pack/plugins/upgrade_assistant/server/plugin.ts b/x-pack/plugins/upgrade_assistant/server/plugin.ts index b47400c065bdd0..27f7111b499ce1 100644 --- a/x-pack/plugins/upgrade_assistant/server/plugin.ts +++ b/x-pack/plugins/upgrade_assistant/server/plugin.ts @@ -94,7 +94,7 @@ export class UpgradeAssistantServerPlugin implements Plugin { // We need to initialize the deprecation logs plugin so that we can // navigate from this app to the observability app using a source_id. - infra.defineInternalSourceConfiguration(DEPRECATION_LOGS_SOURCE_ID, { + infra?.defineInternalSourceConfiguration(DEPRECATION_LOGS_SOURCE_ID, { name: 'deprecationLogs', description: 'deprecation logs', logIndices: {