Skip to content

Commit

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

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Search][Serverless] Enabled Onboarding without Feature Flag
(#196755)](#196755)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rodney
Norris","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-18T16:39:21Z","message":"[Search][Serverless]
Enabled Onboarding without Feature Flag (#196755)\n\n##
Summary\r\n\r\nThis PR removes the feature flag check for the new search
onboarding\r\nexperience in Serverless.\r\n\r\n### Checklist\r\n\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"e955cb044fcad83fd9e1c6631eddd95aa7357ad7","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Search","backport:prev-minor"],"number":196755,"url":"https://github.com/elastic/kibana/pull/196755","mergeCommit":{"message":"[Search][Serverless]
Enabled Onboarding without Feature Flag (#196755)\n\n##
Summary\r\n\r\nThis PR removes the feature flag check for the new search
onboarding\r\nexperience in Serverless.\r\n\r\n### Checklist\r\n\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"e955cb044fcad83fd9e1c6631eddd95aa7357ad7"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196755","number":196755,"mergeCommit":{"message":"[Search][Serverless]
Enabled Onboarding without Feature Flag (#196755)\n\n##
Summary\r\n\r\nThis PR removes the feature flag check for the new search
onboarding\r\nexperience in Serverless.\r\n\r\n### Checklist\r\n\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"e955cb044fcad83fd9e1c6631eddd95aa7357ad7"}}]}]
BACKPORT-->
  • Loading branch information
TattdCodeMonkey authored Oct 20, 2024
1 parent 47c0f5e commit 1f4532a
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 97 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
57 changes: 37 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 @@ -138,7 +122,40 @@ export const navigationTree = (
},
],
},
...(showGettingStarted ? [gettingStartedItem] : []),
{
id: 'analyze',
title: i18n.translate('xpack.serverlessSearch.nav.analyze', {
defaultMessage: 'Analyze',
}),
spaceBefore: 'm',
children: [
{
link: 'discover',
},
{
link: 'dashboards',
getIsActive: ({ pathNameSerialized, prepend }) => {
return pathNameSerialized.startsWith(prepend('/app/dashboards'));
},
},
],
},
{
id: 'otherTools',
title: i18n.translate('xpack.serverlessSearch.nav.otherTools', {
defaultMessage: 'Other tools',
}),
spaceBefore: 'm',
children: [{ link: 'maps' }],
},
{
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 @@ -26,13 +26,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
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ export default function ({ loadTestFile }: FtrProviderContext) {
describe('serverless search UI', function () {
this.tags(['esGate']);

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('./navigation'));
loadTestFile(require.resolve('./pipelines'));
loadTestFile(require.resolve('./cases/attachment_framework'));
loadTestFile(require.resolve('./dashboards/build_dashboard'));
Expand Down
Loading

0 comments on commit 1f4532a

Please sign in to comment.