mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Search][Onboarding] Enable search indices & gate with a feature flag (#195802)](https://github.com/elastic/kibana/pull/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":"rodney.norris@elastic.co"},"sourceCommit":{"committedDate":"2024-10-11T17:21:47Z","message":"[Search][Onboarding] Enable search indices & gate with a feature flag (#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 <elasticmachine@users.noreply.github.com>\r\nCo-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>","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 (#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 <elasticmachine@users.noreply.github.com>\r\nCo-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>","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 (#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 <elasticmachine@users.noreply.github.com>\r\nCo-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>","sha":"8577d1357e2c59f66e397a480ec39b2c405787db"}}]}] BACKPORT--> Co-authored-by: Rodney Norris <rodney.norris@elastic.co>
This commit is contained in:
parent
3926570553
commit
7d25b26536
6 changed files with 34 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
x-pack/plugins/search_indices/public/feature_flags.ts
Normal file
13
x-pack/plugins/search_indices/public/feature_flags.ts
Normal file
|
@ -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);
|
||||
}
|
|
@ -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({
|
||||
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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' });
|
||||
|
||||
|
|
|
@ -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')],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue