Skip to content

Commit

Permalink
[Search][Serverless] Enabled Onboarding without Feature Flag (elastic…
Browse files Browse the repository at this point in the history
…#196755)

## Summary

This PR removes the feature flag check for the new search onboarding
experience in Serverless.

### Checklist

- [x] [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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
  • Loading branch information
TattdCodeMonkey authored Oct 18, 2024
1 parent 01d32b0 commit e955cb0
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 96 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/search_indices/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ export const PLUGIN_NAME = 'searchIndices';
export const START_APP_ID: SearchStart = 'elasticsearchStart';
export const INDICES_APP_ID: SearchIndices = 'elasticsearchIndices';

export const GLOBAL_EMPTY_STATE_FEATURE_FLAG_ID = 'searchIndices:globalEmptyStateEnabled';

export type { IndicesStatusResponse, UserStartPrivilegesResponse } from './types';
13 changes: 0 additions & 13 deletions x-pack/plugins/search_indices/public/feature_flags.ts

This file was deleted.

8 changes: 0 additions & 8 deletions x-pack/plugins/search_indices/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type {
import { initQueryClient } from './services/query_client';
import { INDICES_APP_ID, START_APP_ID } from '../common';
import { INDICES_APP_BASE, START_APP_BASE } from './routes';
import { isGlobalEmptyStateEnabled } from './feature_flags';

export class SearchIndicesPlugin
implements Plugin<SearchIndicesPluginSetup, SearchIndicesPluginStart>
Expand All @@ -28,13 +27,6 @@ export class SearchIndicesPlugin
public setup(
core: CoreSetup<SearchIndicesAppPluginStartDependencies, SearchIndicesPluginStart>
): SearchIndicesPluginSetup {
if (!isGlobalEmptyStateEnabled(core.uiSettings)) {
return {
enabled: this.pluginEnabled,
startAppId: START_APP_ID,
startRoute: START_APP_BASE,
};
}
this.pluginEnabled = true;

const queryClient = initQueryClient(core.notifications.toasts);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/serverless_search/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"devTools",
"discover",
"management",
"searchIndices",
"searchprofiler",
"security",
"serverless",
Expand All @@ -25,7 +26,6 @@
"optionalPlugins": [
"indexManagement",
"searchConnectors",
"searchIndices",
"searchInferenceEndpoints",
"usageCollection"
],
Expand Down
31 changes: 11 additions & 20 deletions x-pack/plugins/serverless_search/public/navigation_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,11 @@
* 2.0.
*/

import type {
AppDeepLinkId,
NavigationTreeDefinition,
NodeDefinition,
} from '@kbn/core-chrome-browser';
import type { NavigationTreeDefinition } from '@kbn/core-chrome-browser';
import { i18n } from '@kbn/i18n';
import { CONNECTORS_LABEL } from '../common/i18n_string';

const gettingStartedItem: NodeDefinition<AppDeepLinkId, string, string> = {
id: 'gettingStarted',
title: i18n.translate('xpack.serverlessSearch.nav.gettingStarted', {
defaultMessage: 'Getting Started',
}),
link: 'serverlessElasticsearch',
spaceBefore: 'm',
};

export const navigationTree = (
homeLink: AppDeepLinkId = 'serverlessElasticsearch' as AppDeepLinkId,
showGettingStarted: boolean
): NavigationTreeDefinition => ({
export const navigationTree = (): NavigationTreeDefinition => ({
body: [
{
type: 'navGroup',
Expand All @@ -41,7 +25,7 @@ export const navigationTree = (
title: i18n.translate('xpack.serverlessSearch.nav.home', {
defaultMessage: 'Home',
}),
link: homeLink,
link: 'elasticsearchStart',
spaceBefore: 'm',
},
{
Expand Down Expand Up @@ -146,7 +130,14 @@ export const navigationTree = (
spaceBefore: 'm',
children: [{ link: 'maps' }],
},
...(showGettingStarted ? [gettingStartedItem] : []),
{
id: 'gettingStarted',
title: i18n.translate('xpack.serverlessSearch.nav.gettingStarted', {
defaultMessage: 'Getting Started',
}),
link: 'serverlessElasticsearch',
spaceBefore: 'm',
},
],
},
],
Expand Down
53 changes: 19 additions & 34 deletions x-pack/plugins/serverless_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export class ServerlessSearchPlugin
const homeTitle = i18n.translate('xpack.serverlessSearch.app.home.title', {
defaultMessage: 'Home',
});
const useGlobalEmptyState = setupDeps.searchIndices?.enabled ?? false;
const serverlessElasticsearchAppRoute = useGlobalEmptyState
? '/app/elasticsearch/getting_started'
: '/app/elasticsearch';

core.application.register({
id: 'serverlessElasticsearch',
Expand All @@ -85,7 +81,7 @@ export class ServerlessSearchPlugin
}),
euiIconType: 'logoElastic',
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
appRoute: serverlessElasticsearchAppRoute,
appRoute: '/app/elasticsearch/getting_started',
async mount({ element, history }: AppMountParameters) {
const { renderApp } = await import('./application/elasticsearch');
const [coreStart, services] = await core.getStartServices();
Expand Down Expand Up @@ -124,23 +120,21 @@ export class ServerlessSearchPlugin
},
});

if (useGlobalEmptyState) {
const redirectApp = setupDeps.searchIndices!.startAppId;
core.application.register({
id: 'serverlessHomeRedirect',
title: homeTitle,
appRoute: '/app/elasticsearch',
euiIconType: 'logoElastic',
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
visibleIn: [],
async mount({}: AppMountParameters) {
const [coreStart] = await core.getStartServices();
coreStart.chrome.docTitle.change(homeTitle);
coreStart.application.navigateToApp(redirectApp);
return () => {};
},
});
}
const { searchIndices } = setupDeps;
core.application.register({
id: 'serverlessHomeRedirect',
title: homeTitle,
appRoute: '/app/elasticsearch',
euiIconType: 'logoElastic',
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
visibleIn: [],
async mount({}: AppMountParameters) {
const [coreStart] = await core.getStartServices();
coreStart.chrome.docTitle.change(homeTitle);
coreStart.application.navigateToApp(searchIndices.startAppId);
return () => {};
},
});

setupDeps.discover.showInlineTopNav();

Expand All @@ -152,18 +146,9 @@ export class ServerlessSearchPlugin
services: ServerlessSearchPluginStartDependencies
): ServerlessSearchPluginStart {
const { serverless, management, indexManagement, security } = services;
const useGlobalEmptyState = services.searchIndices?.enabled ?? false;
const homeRoute = useGlobalEmptyState
? services.searchIndices!.startRoute
: '/app/elasticsearch';
serverless.setProjectHome(homeRoute);

const navigationTree$ = of(
navigationTree(
useGlobalEmptyState ? services.searchIndices?.startAppId : undefined,
useGlobalEmptyState
)
);
serverless.setProjectHome(services.searchIndices.startRoute);

const navigationTree$ = of(navigationTree());
serverless.initNavigation('search', navigationTree$, { dataTestSubj: 'svlSearchSideNav' });

const extendCardNavDefinitions = serverless.getNavigationCards(
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/serverless_search/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface ServerlessSearchPluginSetupDependencies {
management: ManagementSetup;
serverless: ServerlessPluginSetup;
discover: DiscoverSetup;
searchIndices?: SearchIndicesPluginSetup;
searchIndices: SearchIndicesPluginSetup;
}

export interface ServerlessSearchPluginStartDependencies {
Expand All @@ -44,5 +44,5 @@ export interface ServerlessSearchPluginStartDependencies {
serverless: ServerlessPluginStart;
share: SharePluginStart;
indexManagement?: IndexManagementPluginStart;
searchIndices?: SearchIndicesPluginStart;
searchIndices: SearchIndicesPluginStart;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function SvlSearchNavigationServiceProvider({
async navigateToLandingPage() {
await retry.tryForTime(60 * 1000, async () => {
await PageObjects.common.navigateToApp('landingPage');
await testSubjects.existOrFail('svlSearchOverviewPage', { timeout: 2000 });
// Wait for the side nav, since the landing page will sometimes redirect to index management now
await testSubjects.existOrFail('svlSearchSideNav', { timeout: 2000 });
});
},
async navigateToGettingStartedPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default createTestConfig({
`--xpack.cloud.organization_url=/account/members`,
`--xpack.security.roleManagementEnabled=true`,
`--xpack.spaces.maxSpaces=100`, // enables spaces UI capabilities
`--uiSettings.overrides.searchIndices:globalEmptyStateEnabled=true`, // global empty state FF
],
// load tests in the index file
testFiles: [require.resolve('./index.feature_flags.ts')],
Expand All @@ -38,6 +37,12 @@ export default createTestConfig({
serverlessElasticsearch: {
pathname: '/app/elasticsearch/getting_started',
},
serverlessConnectors: {
pathname: '/app/connectors',
},
searchPlayground: {
pathname: '/app/search_playground',
},
elasticsearchStart: {
pathname: '/app/elasticsearch/start',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ export default createTestConfig({
],
apps: {
serverlessElasticsearch: {
pathname: '/app/elasticsearch',
pathname: '/app/elasticsearch/getting_started',
},
serverlessConnectors: {
pathname: '/app/connectors',
},
searchPlayground: {
pathname: '/app/search_playground',
},
elasticsearchStart: {
pathname: '/app/elasticsearch/start',
},
elasticsearchIndices: {
pathname: '/app/elasticsearch/indices',
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getPageObjects }: FtrProviderContext) {
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const pageObjects = getPageObjects(['svlCommonPage', 'embeddedConsole']);
const svlSearchNavigation = getService('svlSearchNavigation');

describe('Console Notebooks', function () {
before(async () => {
await pageObjects.svlCommonPage.loginAsViewer();

await svlSearchNavigation.navigateToGettingStartedPage();
});

it('has notebooks view available', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('serverless search UI - feature flags', function () {
// add tests that require feature flags, defined in config.feature_flags.ts
loadTestFile(require.resolve('./elasticsearch_start.ts'));
loadTestFile(require.resolve('./search_index_detail.ts'));
loadTestFile(require.resolve('./getting_started'));

loadTestFile(require.resolve('../common/platform_security/navigation/management_nav_cards.ts'));
loadTestFile(require.resolve('../common/platform_security/roles.ts'));
loadTestFile(require.resolve('../common/spaces/multiple_spaces_enabled.ts'));
Expand Down
5 changes: 3 additions & 2 deletions x-pack/test_serverless/functional/test_suites/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ export default function ({ loadTestFile }: FtrProviderContext) {
describe('serverless search UI', function () {
this.tags(['esGate']);

loadTestFile(require.resolve('./getting_started'));
loadTestFile(require.resolve('./navigation'));
loadTestFile(require.resolve('./elasticsearch_start.ts'));
loadTestFile(require.resolve('./search_index_detail.ts'));
loadTestFile(require.resolve('./getting_started'));
loadTestFile(require.resolve('./connectors/connectors_overview'));
loadTestFile(require.resolve('./default_dataview'));
loadTestFile(require.resolve('./index_management'));
loadTestFile(require.resolve('./pipelines'));
loadTestFile(require.resolve('./cases/attachment_framework'));
loadTestFile(require.resolve('./dashboards/build_dashboard'));
Expand Down
29 changes: 22 additions & 7 deletions x-pack/test_serverless/functional/test_suites/search/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
// check side nav links
await solutionNavigation.sidenav.expectSectionExists('search_project_nav');
await solutionNavigation.sidenav.expectLinkActive({
deepLinkId: 'serverlessElasticsearch',
deepLinkId: 'elasticsearchStart',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'serverlessElasticsearch',
deepLinkId: 'elasticsearchStart',
});
await testSubjects.existOrFail(`svlSearchOverviewPage`);
await testSubjects.existOrFail(`elasticsearchStartPage`);

// check Data
// > Index Management
Expand Down Expand Up @@ -144,6 +144,21 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
deepLinkId: 'maps',
});

// check Getting Started
await solutionNavigation.sidenav.clickLink({
deepLinkId: 'serverlessElasticsearch',
});
await solutionNavigation.sidenav.expectLinkActive({
deepLinkId: 'serverlessElasticsearch',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Getting Started' });
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
text: 'Getting Started',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'serverlessElasticsearch',
});

// Open Project Settings
await solutionNavigation.sidenav.openSection('project_settings_project_nav');
// check Project Settings
Expand Down Expand Up @@ -174,10 +189,10 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
// navigate back to serverless search overview
await svlCommonNavigation.clickLogo();
await svlCommonNavigation.sidenav.expectLinkActive({
deepLinkId: 'serverlessElasticsearch',
deepLinkId: 'elasticsearchStart',
});
await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: `Home` });
await testSubjects.existOrFail(`svlSearchOverviewPage`);
await testSubjects.existOrFail(`elasticsearchStartPage`);

await expectNoPageReload();
});
Expand Down Expand Up @@ -248,7 +263,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await solutionNavigation.sidenav.expectLinkExists({ text: 'Dashboards' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Other tools' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Maps' });
// await solutionNavigation.sidenav.expectLinkExists({ text: 'Getting Started' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Getting Started' });

await solutionNavigation.sidenav.expectLinkExists({ text: 'Trained models' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Management' });
Expand All @@ -273,7 +288,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
'dashboards',
'otherTools',
'maps',
// 'gettingStarted',
'gettingStarted',
'project_settings_project_nav',
'ml:modelManagement',
'management',
Expand Down

0 comments on commit e955cb0

Please sign in to comment.