Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Move @kbn/config-schema to server] discover #191784

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions src/plugins/discover/common/config.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { EuiErrorBoundary } from '@elastic/eui';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import useObservable from 'react-use/lib/useObservable';
import type { Observable } from 'rxjs';
import { ExperimentalFeatures } from '../../common/config';
import type { ExperimentalFeatures } from '../../server/config';
import { ContextAppRoute } from './context';
import { SingleDocRoute } from './doc';
import { DiscoverMainRoute } from './main';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';
import { i18n } from '@kbn/i18n';
import { toMountPoint } from '@kbn/react-kibana-mount';
import type { Observable } from 'rxjs';
import { ExperimentalFeatures } from '../../common/config';
import type { ExperimentalFeatures } from '../../server/config';
import { DiscoverRouter } from './discover_router';
import { DiscoverServices } from '../build_services';
import type { DiscoverCustomizationContext } from '../customizations';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
} from './components/discover_container';
import { getESQLSearchProvider } from './global_search/search_provider';
import { HistoryService } from './history_service';
import { ConfigSchema, ExperimentalFeatures } from '../common/config';
import type { ConfigSchema, ExperimentalFeatures } from '../server/config';
import {
DataSourceProfileService,
DocumentProfileService,
Expand Down
15 changes: 14 additions & 1 deletion src/plugins/discover/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@
*/

import { PluginConfigDescriptor } from '@kbn/core-plugins-server';
import { configSchema, type ConfigSchema } from '../common/config';
import { schema, TypeOf } from '@kbn/config-schema';

export const configSchema = schema.object({
enableUiSettingsValidations: schema.boolean({ defaultValue: false }),
experimental: schema.maybe(
schema.object({
ruleFormV2Enabled: schema.maybe(schema.boolean({ defaultValue: false })),
enabledProfiles: schema.maybe(schema.arrayOf(schema.string(), { defaultValue: [] })),
})
),
});

export type ConfigSchema = TypeOf<typeof configSchema>;
export type ExperimentalFeatures = NonNullable<ConfigSchema['experimental']>;

export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { createSearchEmbeddableFactory } from './embeddable';
import { initializeLocatorServices } from './locator';
import { registerSampleData } from './sample_data';
import { getUiSettings } from './ui_settings';
import { ConfigSchema } from '../common/config';
import type { ConfigSchema } from './config';

export class DiscoverServerPlugin
implements Plugin<object, DiscoverServerPluginStart, object, DiscoverServerPluginStartDeps>
Expand Down