Skip to content

Commit

Permalink
[8.x] [Search][Onboarding] Enable search indices & gate with a fe…
Browse files Browse the repository at this point in the history
…ature flag (elastic#195802) (elastic#195972)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Search][Onboarding] Enable search indices & gate with a feature
flag (elastic#195802)](elastic#195802)

<!--- Backport version: 9.4.3 -->

### 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-11T17:21:47Z","message":"[Search][Onboarding]
Enable search indices & gate with a feature flag (elastic#195802)\n\n##
Summary\r\n\r\nThis PR enables the `search_indices` plugin in serverless
search. But\r\nthen gates it with a UI settings feature flag until we
are ready to ship\r\nthe new onboarding experience to all
users.\r\n\r\n### Testing\r\nLocally you can add this to your
`kibana.dev.yml` to enable the
FF:\r\n```\r\nuiSettings.overrides.searchIndices:globalEmptyStateEnabled:
true\r\n```\r\n\r\nOr you can enable the ui setting via Dev Tools and
refresh the browser:\r\n\r\n```\r\nPOST
kbn:/internal/kibana/settings/searchIndices:globalEmptyStateEnabled\r\n{\"value\":
true}\r\n```\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\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by: Jean-Louis
Leysens
<[email protected]>","sha":"8577d1357e2c59f66e397a480ec39b2c405787db","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Search","backport:prev-minor","ci:project-deploy-elasticsearch"],"title":"[Search][Onboarding]
Enable search indices & gate with a feature
flag","number":195802,"url":"https://github.com/elastic/kibana/pull/195802","mergeCommit":{"message":"[Search][Onboarding]
Enable search indices & gate with a feature flag (elastic#195802)\n\n##
Summary\r\n\r\nThis PR enables the `search_indices` plugin in serverless
search. But\r\nthen gates it with a UI settings feature flag until we
are ready to ship\r\nthe new onboarding experience to all
users.\r\n\r\n### Testing\r\nLocally you can add this to your
`kibana.dev.yml` to enable the
FF:\r\n```\r\nuiSettings.overrides.searchIndices:globalEmptyStateEnabled:
true\r\n```\r\n\r\nOr you can enable the ui setting via Dev Tools and
refresh the browser:\r\n\r\n```\r\nPOST
kbn:/internal/kibana/settings/searchIndices:globalEmptyStateEnabled\r\n{\"value\":
true}\r\n```\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\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by: Jean-Louis
Leysens
<[email protected]>","sha":"8577d1357e2c59f66e397a480ec39b2c405787db"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195802","number":195802,"mergeCommit":{"message":"[Search][Onboarding]
Enable search indices & gate with a feature flag (elastic#195802)\n\n##
Summary\r\n\r\nThis PR enables the `search_indices` plugin in serverless
search. But\r\nthen gates it with a UI settings feature flag until we
are ready to ship\r\nthe new onboarding experience to all
users.\r\n\r\n### Testing\r\nLocally you can add this to your
`kibana.dev.yml` to enable the
FF:\r\n```\r\nuiSettings.overrides.searchIndices:globalEmptyStateEnabled:
true\r\n```\r\n\r\nOr you can enable the ui setting via Dev Tools and
refresh the browser:\r\n\r\n```\r\nPOST
kbn:/internal/kibana/settings/searchIndices:globalEmptyStateEnabled\r\n{\"value\":
true}\r\n```\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\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by: Jean-Louis
Leysens
<[email protected]>","sha":"8577d1357e2c59f66e397a480ec39b2c405787db"}}]}]
BACKPORT-->

Co-authored-by: Rodney Norris <[email protected]>
  • Loading branch information
kibanamachine and TattdCodeMonkey authored Oct 11, 2024
1 parent 3926570 commit 7d25b26
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/serverless.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ xpack.cloud.serverless.project_type: search

## Enable the Serverless Search plugin
xpack.serverless.search.enabled: true
xpack.searchIndices.enabled: true

## Set the home route
uiSettings.overrides.defaultRoute: /app/elasticsearch
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/search_indices/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ 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: 13 additions & 0 deletions x-pack/plugins/search_indices/public/feature_flags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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 { IUiSettingsClient } from '@kbn/core/public';
import { GLOBAL_EMPTY_STATE_FEATURE_FLAG_ID } from '../common';

export function isGlobalEmptyStateEnabled(uiSettings: IUiSettingsClient): boolean {
return uiSettings.get<boolean>(GLOBAL_EMPTY_STATE_FEATURE_FLAG_ID, false);
}
14 changes: 13 additions & 1 deletion x-pack/plugins/search_indices/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@ 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>
{
private pluginEnabled: boolean = false;

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);

core.application.register({
Expand Down Expand Up @@ -72,7 +84,7 @@ export class SearchIndicesPlugin
public start(core: CoreStart): SearchIndicesPluginStart {
docLinks.setDocLinks(core.docLinks.links);
return {
enabled: true,
enabled: this.pluginEnabled,
startAppId: START_APP_ID,
startRoute: START_APP_BASE,
};
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/serverless_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ export class ServerlessSearchPlugin
serverless.setProjectHome(homeRoute);

const navigationTree$ = of(
navigationTree(services.searchIndices?.startAppId, useGlobalEmptyState)
navigationTree(
useGlobalEmptyState ? services.searchIndices?.startAppId : undefined,
useGlobalEmptyState
)
);
serverless.initNavigation('search', navigationTree$, { dataTestSubj: 'svlSearchSideNav' });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default createTestConfig({
`--xpack.cloud.organization_url=/account/members`,
`--xpack.security.roleManagementEnabled=true`,
`--xpack.spaces.maxSpaces=100`, // enables spaces UI capabilities
`--xpack.searchIndices.enabled=true`, // global empty state FF
`--uiSettings.overrides.searchIndices:globalEmptyStateEnabled=true`, // global empty state FF
],
// load tests in the index file
testFiles: [require.resolve('./index.feature_flags.ts')],
Expand Down

0 comments on commit 7d25b26

Please sign in to comment.