mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Move src/legacy/server/index_patterns
to data plugin (server) (Remove step) (#61618)
* Removed legacy index pattern * fix type * remove unnecessary import * Removed old references to indexPatternsServiceFactory Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
b4fd1eb673
commit
addb87d779
8 changed files with 1 additions and 99 deletions
1
kibana.d.ts
vendored
1
kibana.d.ts
vendored
|
@ -37,7 +37,6 @@ import * as LegacyKibanaServer from './src/legacy/server/kbn_server';
|
|||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Legacy {
|
||||
export type IndexPatternsService = LegacyKibanaServer.IndexPatternsService;
|
||||
export type KibanaConfig = LegacyKibanaServer.KibanaConfig;
|
||||
export type Request = LegacyKibanaServer.Request;
|
||||
export type ResponseToolkit = LegacyKibanaServer.ResponseToolkit;
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { indexPatternsMixin } from './mixin';
|
||||
export {
|
||||
IndexPatternsFetcher,
|
||||
FieldDescriptor,
|
||||
} from '../../../plugins/data/server/index_patterns/fetcher';
|
||||
export { IndexPatternsServiceFactory } from './mixin';
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { IndexPatternsFetcher } from '../../../plugins/data/server';
|
||||
import KbnServer from '../kbn_server';
|
||||
import { APICaller, CallAPIOptions } from '../../../core/server';
|
||||
import { Legacy } from '../../../../kibana';
|
||||
|
||||
export function indexPatternsMixin(kbnServer: KbnServer, server: Legacy.Server) {
|
||||
/**
|
||||
* Create an instance of the IndexPatternsService
|
||||
*
|
||||
* @method server.indexPatternsServiceFactory
|
||||
* @type {IndexPatternsService}
|
||||
*/
|
||||
server.decorate('server', 'indexPatternsServiceFactory', ({ callCluster }) => {
|
||||
return new IndexPatternsFetcher(callCluster);
|
||||
});
|
||||
|
||||
/**
|
||||
* Get an instance of the IndexPatternsService configured for use
|
||||
* the current request
|
||||
*
|
||||
* @method request.getIndexPatternsService
|
||||
* @type {IndexPatternsService}
|
||||
*/
|
||||
server.addMemoizedFactoryToRequest('getIndexPatternsService', (request: Legacy.Request) => {
|
||||
const { callWithRequest } = request.server.plugins.elasticsearch.getCluster('data');
|
||||
const callCluster: APICaller = (
|
||||
endpoint: string,
|
||||
params?: Record<string, any>,
|
||||
options?: CallAPIOptions
|
||||
) => callWithRequest(request, endpoint, params, options);
|
||||
return server.indexPatternsServiceFactory({ callCluster });
|
||||
});
|
||||
}
|
||||
|
||||
export type IndexPatternsServiceFactory = (args: {
|
||||
callCluster: (endpoint: string, clientParams: any, options: any) => Promise<any>;
|
||||
}) => IndexPatternsFetcher;
|
3
src/legacy/server/kbn_server.d.ts
vendored
3
src/legacy/server/kbn_server.d.ts
vendored
|
@ -44,7 +44,6 @@ import { LegacyConfig, ILegacyService, ILegacyInternals } from '../../core/serve
|
|||
import { ApmOssPlugin } from '../core_plugins/apm_oss';
|
||||
import { CallClusterWithRequest, ElasticsearchPlugin } from '../core_plugins/elasticsearch';
|
||||
import { UsageCollectionSetup } from '../../plugins/usage_collection/server';
|
||||
import { IndexPatternsServiceFactory } from './index_patterns';
|
||||
import { Capabilities } from '../../core/server';
|
||||
import { UiSettingsServiceFactoryOptions } from '../../legacy/ui/ui_settings/ui_settings_service_factory';
|
||||
import { HomeServerPluginSetup } from '../../plugins/home/server';
|
||||
|
@ -68,7 +67,6 @@ declare module 'hapi' {
|
|||
|
||||
interface Server {
|
||||
config: () => KibanaConfig;
|
||||
indexPatternsServiceFactory: IndexPatternsServiceFactory;
|
||||
savedObjects: SavedObjectsLegacyService;
|
||||
injectUiAppVars: (pluginName: string, getAppVars: () => { [key: string]: any }) => void;
|
||||
getHiddenUiAppById(appId: string): UiApp;
|
||||
|
@ -175,5 +173,4 @@ export default class KbnServer {
|
|||
export { Server, Request, ResponseToolkit } from 'hapi';
|
||||
|
||||
// Re-export commonly accessed api types.
|
||||
export { IndexPatternsFetcher as IndexPatternsService } from './index_patterns';
|
||||
export { SavedObjectsLegacyService, SavedObjectsClient } from 'src/core/server';
|
||||
|
|
|
@ -33,7 +33,6 @@ import pidMixin from './pid';
|
|||
import configCompleteMixin from './config/complete';
|
||||
import optimizeMixin from '../../optimize';
|
||||
import * as Plugins from './plugins';
|
||||
import { indexPatternsMixin } from './index_patterns';
|
||||
import { savedObjectsMixin } from './saved_objects/saved_objects_mixin';
|
||||
import { capabilitiesMixin } from './capabilities';
|
||||
import { serverExtensionsMixin } from './server_extensions';
|
||||
|
@ -114,7 +113,6 @@ export default class KbnServer {
|
|||
|
||||
// setup this.uiBundles
|
||||
uiMixin,
|
||||
indexPatternsMixin,
|
||||
|
||||
// setup saved object routes
|
||||
savedObjectsMixin,
|
||||
|
|
|
@ -118,11 +118,6 @@ describe('Saved Objects Mixin', () => {
|
|||
get: stubConfig,
|
||||
};
|
||||
},
|
||||
indexPatternsServiceFactory: () => {
|
||||
return {
|
||||
getFieldsForWildcard: jest.fn(),
|
||||
};
|
||||
},
|
||||
plugins: {
|
||||
elasticsearch: {
|
||||
getCluster: () => {
|
||||
|
|
|
@ -21,9 +21,6 @@ export interface InfraServerPluginDeps {
|
|||
spaces: SpacesPluginSetup;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
metrics: VisTypeTimeseriesSetup;
|
||||
indexPatterns: {
|
||||
indexPatternsServiceFactory: any;
|
||||
};
|
||||
features: FeaturesPluginSetup;
|
||||
apm: APMPluginContract;
|
||||
alerting: AlertingPluginContract;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
/* eslint-disable @typescript-eslint/array-type */
|
||||
|
||||
import { GraphQLSchema } from 'graphql';
|
||||
import { Legacy } from 'kibana';
|
||||
import { runHttpQuery } from 'apollo-server-core';
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import {
|
||||
|
@ -217,9 +216,7 @@ export class KibanaFramework {
|
|||
});
|
||||
}
|
||||
|
||||
public getIndexPatternsService(
|
||||
requestContext: RequestHandlerContext
|
||||
): Legacy.IndexPatternsService {
|
||||
public getIndexPatternsService(requestContext: RequestHandlerContext): IndexPatternsFetcher {
|
||||
return new IndexPatternsFetcher((...rest: Parameters<APICaller>) => {
|
||||
rest[1] = rest[1] || {};
|
||||
rest[1].allowNoIndices = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue