Skip to content

Commit

Permalink
[Move @kbn/config-schema to server] discover (elastic#191784)
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo authored Aug 31, 2024
1 parent a88cfc8 commit b19ad96
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
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

0 comments on commit b19ad96

Please sign in to comment.