diff --git a/x-pack/plugins/upgrade_assistant/common/constants.ts b/x-pack/plugins/upgrade_assistant/common/constants.ts
index d9a056cebcc21..dfd69cac47e73 100644
--- a/x-pack/plugins/upgrade_assistant/common/constants.ts
+++ b/x-pack/plugins/upgrade_assistant/common/constants.ts
@@ -13,3 +13,10 @@ import SemVer from 'semver/classes/semver';
*/
export const mockKibanaVersion = '7.0.0';
export const mockKibanaSemverVersion = new SemVer(mockKibanaVersion);
+
+/*
+ * This will be set to true up until the last minor before the next major.
+ * In readonly mode, the user will not be able to perform any actions in the UI
+ * and will be presented with a message indicating as such.
+ */
+export const UA_READONLY_MODE = true;
diff --git a/x-pack/plugins/upgrade_assistant/public/application/app.tsx b/x-pack/plugins/upgrade_assistant/public/application/app.tsx
index f8a15b38d8c8e..d54a6957f4b6e 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/app.tsx
+++ b/x-pack/plugins/upgrade_assistant/public/application/app.tsx
@@ -7,37 +7,19 @@
import React from 'react';
import { I18nStart } from 'src/core/public';
-import { EuiPageHeader, EuiPageHeaderSection, EuiTitle } from '@elastic/eui';
-import { FormattedMessage } from '@kbn/i18n/react';
-import { UpgradeAssistantTabs } from './components/tabs';
-import { AppContextProvider, ContextValue, AppContext } from './app_context';
+import { AppContextProvider, ContextValue } from './app_context';
+import { PageContent } from './components/page_content';
export interface AppDependencies extends ContextValue {
i18n: I18nStart;
}
export const RootComponent = ({ i18n, ...contextValue }: AppDependencies) => {
- const { nextMajor } = contextValue.kibanaVersionInfo;
return (
-
-
-
-
-
-
-
-
-
-
- {({ http }) => }
-
+
diff --git a/x-pack/plugins/upgrade_assistant/public/application/app_context.tsx b/x-pack/plugins/upgrade_assistant/public/application/app_context.tsx
index 5aaf69e151573..2a16be7ec5204 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/app_context.tsx
+++ b/x-pack/plugins/upgrade_assistant/public/application/app_context.tsx
@@ -19,6 +19,7 @@ export interface ContextValue {
isCloudEnabled: boolean;
docLinks: DocLinksStart;
kibanaVersionInfo: KibanaVersionContext;
+ isReadOnlyMode: boolean;
}
export const AppContext = createContext({} as any);
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/coming_soon_prompt.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/coming_soon_prompt.tsx
new file mode 100644
index 0000000000000..b7869226a84b0
--- /dev/null
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/coming_soon_prompt.tsx
@@ -0,0 +1,65 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import React from 'react';
+import { EuiEmptyPrompt, EuiPageContent, EuiLink } from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { useAppContext } from '../app_context';
+
+export const ComingSoonPrompt: React.FunctionComponent = () => {
+ const { kibanaVersionInfo, docLinks } = useAppContext();
+ const { nextMajor, currentMajor } = kibanaVersionInfo;
+ const { ELASTIC_WEBSITE_URL } = docLinks;
+
+ return (
+
+
+
+
+ }
+ body={
+ <>
+
+
+
+
+ {currentMajor === 7 && (
+
+
+
+
+
+ )}
+ >
+ }
+ />
+
+ );
+};
diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/page_content.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/page_content.tsx
new file mode 100644
index 0000000000000..4497a7603d8d9
--- /dev/null
+++ b/x-pack/plugins/upgrade_assistant/public/application/components/page_content.tsx
@@ -0,0 +1,44 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import React from 'react';
+import { EuiPageHeader, EuiPageHeaderSection, EuiTitle } from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
+
+import { useAppContext } from '../app_context';
+import { ComingSoonPrompt } from './coming_soon_prompt';
+import { UpgradeAssistantTabs } from './tabs';
+
+export const PageContent: React.FunctionComponent = () => {
+ const { kibanaVersionInfo, isReadOnlyMode, http } = useAppContext();
+ const { nextMajor } = kibanaVersionInfo;
+
+ // Read-only mode will be enabled up until the last minor before the next major release
+ if (isReadOnlyMode) {
+ return ;
+ }
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
diff --git a/x-pack/plugins/upgrade_assistant/public/application/mount_management_section.ts b/x-pack/plugins/upgrade_assistant/public/application/mount_management_section.ts
index 41871c9d9da9c..905f8201e0648 100644
--- a/x-pack/plugins/upgrade_assistant/public/application/mount_management_section.ts
+++ b/x-pack/plugins/upgrade_assistant/public/application/mount_management_section.ts
@@ -7,6 +7,7 @@
import { CoreSetup } from 'src/core/public';
import { ManagementAppMountParams } from '../../../../../src/plugins/management/public';
+import { UA_READONLY_MODE } from '../../common/constants';
import { renderApp } from './render_app';
import { KibanaVersionContext } from './app_context';
@@ -24,5 +25,6 @@ export async function mountManagementSection(
i18n,
docLinks,
kibanaVersionInfo,
+ isReadOnlyMode: UA_READONLY_MODE,
});
}
diff --git a/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/index.ts b/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/index.ts
new file mode 100644
index 0000000000000..358c854a0af9f
--- /dev/null
+++ b/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/index.ts
@@ -0,0 +1,8 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+export { setup, OverviewTestBed } from './overview.helpers';
diff --git a/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/overview.helpers.ts b/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/overview.helpers.ts
new file mode 100644
index 0000000000000..768c87051a670
--- /dev/null
+++ b/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/overview.helpers.ts
@@ -0,0 +1,25 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest';
+import { PageContent } from '../../public/application/components/page_content';
+import { WithAppDependencies } from './setup_environment';
+
+const testBedConfig: TestBedConfig = {
+ doMountAsync: true,
+};
+
+export type OverviewTestBed = TestBed;
+
+export const setup = async (overrides?: any): Promise => {
+ const initTestBed = registerTestBed(WithAppDependencies(PageContent, overrides), testBedConfig);
+ const testBed = await initTestBed();
+
+ return testBed;
+};
+
+export type OverviewTestSubjects = 'comingSoonPrompt' | 'upgradeAssistantPageContent';
diff --git a/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/setup_environment.tsx b/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/setup_environment.tsx
new file mode 100644
index 0000000000000..75a0ce4d47e77
--- /dev/null
+++ b/x-pack/plugins/upgrade_assistant/tests_client_integration/helpers/setup_environment.tsx
@@ -0,0 +1,37 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import React from 'react';
+import axios from 'axios';
+
+import { docLinksServiceMock } from '../../../../../src/core/public/mocks';
+import { HttpSetup } from '../../../../../src/core/public';
+
+import { mockKibanaSemverVersion, UA_READONLY_MODE } from '../../common/constants';
+import { AppContextProvider } from '../../public/application/app_context';
+
+const mockHttpClient = axios.create();
+
+const contextValue = {
+ http: (mockHttpClient as unknown) as HttpSetup,
+ isCloudEnabled: false,
+ docLinks: docLinksServiceMock.createStartContract(),
+ kibanaVersionInfo: {
+ currentMajor: mockKibanaSemverVersion.major,
+ prevMajor: mockKibanaSemverVersion.major - 1,
+ nextMajor: mockKibanaSemverVersion.major + 1,
+ },
+ isReadOnlyMode: UA_READONLY_MODE,
+};
+
+export const WithAppDependencies = (Comp: any, overrides: any = {}) => (props: any) => {
+ return (
+
+
+
+ );
+};
diff --git a/x-pack/plugins/upgrade_assistant/tests_client_integration/overview.test.ts b/x-pack/plugins/upgrade_assistant/tests_client_integration/overview.test.ts
new file mode 100644
index 0000000000000..b475c8b89c616
--- /dev/null
+++ b/x-pack/plugins/upgrade_assistant/tests_client_integration/overview.test.ts
@@ -0,0 +1,46 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import { act } from 'react-dom/test-utils';
+
+import { OverviewTestBed, setup } from './helpers';
+
+describe('', () => {
+ let testBed: OverviewTestBed;
+
+ beforeEach(async () => {
+ await act(async () => {
+ testBed = await setup();
+ });
+ });
+
+ describe('Coming soon prompt', () => {
+ // Default behavior up until the last minor before the next major release
+ test('renders the coming soon prompt by default', () => {
+ const { exists } = testBed;
+
+ expect(exists('comingSoonPrompt')).toBe(true);
+ });
+ });
+
+ describe('Tabs', () => {
+ beforeEach(async () => {
+ await act(async () => {
+ // Override the default context value to verify tab content renders as expected
+ // This will be the default behavior on the last minor before the next major release (e.g., v7.15)
+ testBed = await setup({ isReadOnlyMode: false });
+ });
+ });
+
+ test('renders the coming soon prompt by default', () => {
+ const { exists } = testBed;
+
+ expect(exists('comingSoonPrompt')).toBe(false);
+ expect(exists('upgradeAssistantPageContent')).toBe(true);
+ });
+ });
+});
diff --git a/x-pack/plugins/upgrade_assistant/tsconfig.json b/x-pack/plugins/upgrade_assistant/tsconfig.json
index 220ae4d0f0160..0d65c8ddd8fed 100644
--- a/x-pack/plugins/upgrade_assistant/tsconfig.json
+++ b/x-pack/plugins/upgrade_assistant/tsconfig.json
@@ -11,6 +11,7 @@
"common/**/*",
"public/**/*",
"server/**/*",
+ "tests_client_integration/**/*",
// have to declare *.json explicitly due to https://github.com/microsoft/TypeScript/issues/25636
"public/**/*.json",
"server/**/*.json"
diff --git a/x-pack/test/accessibility/apps/upgrade_assistant.ts b/x-pack/test/accessibility/apps/upgrade_assistant.ts
index 332a54006b0ec..96b3e6673de70 100644
--- a/x-pack/test/accessibility/apps/upgrade_assistant.ts
+++ b/x-pack/test/accessibility/apps/upgrade_assistant.ts
@@ -18,27 +18,37 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.upgradeAssistant.navigateToPage();
});
- it('Overview Tab', async () => {
- await retry.waitFor('Upgrade Assistant overview tab to be visible', async () => {
- return testSubjects.exists('upgradeAssistantOverviewTabDetail');
+ it('Overview page', async () => {
+ await retry.waitFor('Upgrade Assistant overview page to be visible', async () => {
+ return testSubjects.exists('comingSoonPrompt');
});
await a11y.testAppSnapshot();
});
- it('Cluster Tab', async () => {
- await testSubjects.click('upgradeAssistantClusterTab');
- await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
- return testSubjects.exists('upgradeAssistantClusterTabDetail');
+ // These tests will be skipped until the last minor of the next major release
+ describe.skip('tabs', () => {
+ it('Overview Tab', async () => {
+ await retry.waitFor('Upgrade Assistant overview tab to be visible', async () => {
+ return testSubjects.exists('upgradeAssistantOverviewTabDetail');
+ });
+ await a11y.testAppSnapshot();
});
- await a11y.testAppSnapshot();
- });
- it('Indices Tab', async () => {
- await testSubjects.click('upgradeAssistantIndicesTab');
- await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
- return testSubjects.exists('upgradeAssistantIndexTabDetail');
+ it('Cluster Tab', async () => {
+ await testSubjects.click('upgradeAssistantClusterTab');
+ await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
+ return testSubjects.exists('upgradeAssistantClusterTabDetail');
+ });
+ await a11y.testAppSnapshot();
+ });
+
+ it('Indices Tab', async () => {
+ await testSubjects.click('upgradeAssistantIndicesTab');
+ await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
+ return testSubjects.exists('upgradeAssistantIndexTabDetail');
+ });
+ await a11y.testAppSnapshot();
});
- await a11y.testAppSnapshot();
});
});
}