mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ES UI] Error handling (#68809)
This commit is contained in:
parent
0c34bd7e67
commit
533046fd9c
73 changed files with 194 additions and 183 deletions
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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 { isEsError } from './is_es_error';
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
interface RequestError extends Error {
|
||||
statusCode?: number;
|
||||
}
|
||||
|
||||
export function isEsError(err: RequestError) {
|
||||
const isInstanceOfEsError = err instanceof esErrorsParent;
|
||||
const hasStatusCode = Boolean(err.statusCode);
|
||||
|
||||
return isInstanceOfEsError && hasStatusCode;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"id": "esUiShared",
|
||||
"version": "kibana",
|
||||
"ui": true
|
||||
"ui": true,
|
||||
"server": true
|
||||
}
|
||||
|
|
20
src/plugins/es_ui_shared/server/errors/index.ts
Normal file
20
src/plugins/es_ui_shared/server/errors/index.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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 { isEsError } from '../../__packages_do_not_import__/errors';
|
28
src/plugins/es_ui_shared/server/index.ts
Normal file
28
src/plugins/es_ui_shared/server/index.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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 { isEsError } from './errors';
|
||||
|
||||
/** dummy plugin*/
|
||||
export function plugin() {
|
||||
return new (class EsUiSharedPlugin {
|
||||
setup() {}
|
||||
start() {}
|
||||
})();
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -30,7 +30,7 @@ import { registerApiRoutes } from './routes';
|
|||
import { License } from './services';
|
||||
import { elasticsearchJsPlugin } from './client/elasticsearch_ccr';
|
||||
import { CrossClusterReplicationConfig } from './config';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { formatEsError } from './lib/format_es_error';
|
||||
|
||||
interface CrossClusterReplicationContext {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
|
||||
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { formatEsError } from '../../../lib/format_es_error';
|
||||
import { License } from '../../../services';
|
||||
import { mockRouteContext } from '../test_lib';
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from './is_es_error';
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -9,7 +9,7 @@ import { LicensingPluginSetup } from '../../licensing/server';
|
|||
import { IndexManagementPluginSetup } from '../../index_management/server';
|
||||
import { RemoteClustersPluginSetup } from '../../remote_clusters/server';
|
||||
import { License } from './services';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { formatEsError } from './lib/format_es_error';
|
||||
|
||||
export interface Dependencies {
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error): boolean {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -14,7 +14,7 @@ import { Dependencies } from './types';
|
|||
import { registerApiRoutes } from './routes';
|
||||
import { License } from './services';
|
||||
import { IndexLifecycleManagementConfig } from './config';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
|
||||
const indexLifecycleDataEnricher = async (indicesList: any, callAsCurrentUser: APICaller) => {
|
||||
if (!indicesList || !indicesList.length) {
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from './is_es_error';
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -10,7 +10,7 @@ import { LicensingPluginSetup } from '../../licensing/server';
|
|||
import { IndexManagementPluginSetup } from '../../index_management/server';
|
||||
import { License } from './services';
|
||||
import { IndexLifecycleManagementConfig } from './config';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
|
||||
export interface Dependencies {
|
||||
licensing: LicensingPluginSetup;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -24,7 +24,7 @@ import { PLUGIN } from '../common';
|
|||
import { Dependencies } from './types';
|
||||
import { ApiRoutes } from './routes';
|
||||
import { License, IndexDataEnricher } from './services';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { elasticsearchJsPlugin } from './client/elasticsearch';
|
||||
|
||||
export interface DataManagementContext {
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from './is_es_error';
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -7,7 +7,7 @@ import { ScopedClusterClient, IRouter } from 'src/core/server';
|
|||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
import { SecurityPluginSetup } from '../../security/server';
|
||||
import { License, IndexDataEnricher } from './services';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
|
||||
export interface Dependencies {
|
||||
security: SecurityPluginSetup;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -11,7 +11,7 @@ import { PLUGIN_ID, PLUGIN_MIN_LICENSE_TYPE } from '../common/constants';
|
|||
|
||||
import { License } from './services';
|
||||
import { ApiRoutes } from './routes';
|
||||
import { isEsError } from './lib';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { Dependencies } from './types';
|
||||
|
||||
export class IngestPipelinesPlugin implements Plugin<void, void, any, any> {
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from './is_es_error';
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -8,7 +8,7 @@ import { IRouter } from 'src/core/server';
|
|||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
import { SecurityPluginSetup } from '../../security/server';
|
||||
import { License } from './services';
|
||||
import { isEsError } from './lib';
|
||||
import { isEsError } from './shared_imports';
|
||||
|
||||
export interface Dependencies {
|
||||
security: SecurityPluginSetup;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
import { Plugin, CoreSetup } from 'kibana/server';
|
||||
|
||||
import { ApiRoutes } from './routes';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { Dependencies } from './types';
|
||||
|
||||
export class LicenseManagementServerPlugin implements Plugin<void, void, any, any> {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -7,7 +7,7 @@ import { ScopedClusterClient, IRouter } from 'kibana/server';
|
|||
|
||||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
import { SecurityPluginSetup } from '../../security/server';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
|
||||
export interface Dependencies {
|
||||
licensing: LicensingPluginSetup;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -7,7 +7,7 @@ import { schema } from '@kbn/config-schema';
|
|||
|
||||
import { API_BASE_PATH } from '../../../common/constants';
|
||||
import { RouteDependencies } from '../../types';
|
||||
import { isEsError } from '../../lib';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
|
||||
const bodySchema = schema.string();
|
||||
|
||||
|
|
7
x-pack/plugins/painless_lab/server/shared_imports.ts
Normal file
7
x-pack/plugins/painless_lab/server/shared_imports.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -13,7 +13,7 @@ import { serializeCluster, Cluster } from '../../../common/lib';
|
|||
import { doesClusterExist } from '../../lib/does_cluster_exist';
|
||||
import { API_BASE_PATH, PROXY_MODE, SNIFF_MODE } from '../../../common/constants';
|
||||
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
|
||||
import { isEsError } from '../../lib/is_es_error';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
import { RouteDependencies } from '../../types';
|
||||
|
||||
const bodyValidation = schema.object({
|
||||
|
|
|
@ -14,7 +14,7 @@ import { serializeCluster } from '../../../common/lib';
|
|||
import { API_BASE_PATH } from '../../../common/constants';
|
||||
import { doesClusterExist } from '../../lib/does_cluster_exist';
|
||||
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
|
||||
import { isEsError } from '../../lib/is_es_error';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
|
||||
const paramsValidation = schema.object({
|
||||
nameOrNames: schema.string(),
|
||||
|
|
|
@ -10,7 +10,7 @@ import { RequestHandler } from 'src/core/server';
|
|||
import { deserializeCluster } from '../../../common/lib';
|
||||
import { API_BASE_PATH } from '../../../common/constants';
|
||||
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
|
||||
import { isEsError } from '../../lib/is_es_error';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
import { RouteDependencies } from '../../types';
|
||||
|
||||
export const register = (deps: RouteDependencies): void => {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { serializeCluster, deserializeCluster, Cluster, ClusterInfoEs } from '..
|
|||
import { doesClusterExist } from '../../lib/does_cluster_exist';
|
||||
import { RouteDependencies } from '../../types';
|
||||
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
|
||||
import { isEsError } from '../../lib/is_es_error';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
|
||||
const bodyValidation = schema.object({
|
||||
skipUnavailable: schema.boolean(),
|
||||
|
|
7
x-pack/plugins/remote_clusters/server/shared_imports.ts
Normal file
7
x-pack/plugins/remote_clusters/server/shared_imports.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -35,7 +35,7 @@ import { rollupDataEnricher } from './rollup_data_enricher';
|
|||
import { IndexPatternsFetcher } from './shared_imports';
|
||||
import { registerRollupSearchStrategy } from './lib/search_strategies';
|
||||
import { elasticsearchJsPlugin } from './client/elasticsearch_rollup';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { formatEsError } from './lib/format_es_error';
|
||||
import { getCapabilitiesForRollupIndices } from './lib/map_capabilities';
|
||||
import { mergeCapabilitiesWithFields } from './lib/merge_capabilities_with_fields';
|
||||
|
|
|
@ -5,3 +5,5 @@
|
|||
*/
|
||||
|
||||
export { IndexPatternsFetcher } from '../../../../src/plugins/data/server';
|
||||
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
||||
|
|
|
@ -12,7 +12,7 @@ import { IndexManagementPluginSetup } from '../../index_management/server';
|
|||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
import { License } from './services';
|
||||
import { IndexPatternsFetcher } from './shared_imports';
|
||||
import { isEsError } from './lib/is_es_error';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { formatEsError } from './lib/format_es_error';
|
||||
import { getCapabilitiesForRollupIndices } from './lib/map_capabilities';
|
||||
import { mergeCapabilitiesWithFields } from './lib/merge_capabilities_with_fields';
|
||||
|
|
|
@ -12,5 +12,4 @@ export { cleanSettings } from './clean_settings';
|
|||
export { getManagedRepositoryName } from './get_managed_repository_name';
|
||||
export { getManagedPolicyNames } from './get_managed_policy_names';
|
||||
export { deserializeRestoreShard } from './restore_serialization';
|
||||
export { isEsError } from './is_es_error';
|
||||
export { wrapEsError } from './wrap_es_error';
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -23,7 +23,8 @@ import {
|
|||
import { PLUGIN } from '../common';
|
||||
import { License } from './services';
|
||||
import { ApiRoutes } from './routes';
|
||||
import { isEsError, wrapEsError } from './lib';
|
||||
import { wrapEsError } from './lib';
|
||||
import { isEsError } from './shared_imports';
|
||||
import { elasticsearchJsPlugin } from './client/elasticsearch_sr';
|
||||
import { Dependencies } from './types';
|
||||
import { SnapshotRestoreConfig } from './config';
|
||||
|
|
7
x-pack/plugins/snapshot_restore/server/shared_imports.ts
Normal file
7
x-pack/plugins/snapshot_restore/server/shared_imports.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
|
@ -4,7 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { License } from '../../services';
|
||||
import { isEsError, wrapEsError } from '../../lib';
|
||||
import { wrapEsError } from '../../lib';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
|
||||
const license = new License();
|
||||
license.getStatus = jest.fn().mockReturnValue({ isValid: true });
|
||||
|
|
|
@ -8,7 +8,8 @@ import { LicensingPluginSetup } from '../../licensing/server';
|
|||
import { SecurityPluginSetup } from '../../security/server';
|
||||
import { CloudSetup } from '../../cloud/server';
|
||||
import { License } from './services';
|
||||
import { isEsError, wrapEsError } from './lib';
|
||||
import { wrapEsError } from './lib';
|
||||
import { isEsError } from './shared_imports';
|
||||
|
||||
export interface Dependencies {
|
||||
licensing: LicensingPluginSetup;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
const esErrorsParent = legacyElasticsearch.errors._Abstract;
|
||||
|
||||
export function isEsError(err: Error) {
|
||||
return err instanceof esErrorsParent;
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { reduce, size } from 'lodash';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { isEsError } from '../../lib/is_es_error';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
// @ts-ignore
|
||||
import { Fields } from '../../models/fields/index';
|
||||
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { get } from 'lodash';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { isEsError } from '../../lib/is_es_error';
|
||||
import { isEsError } from '../../shared_imports';
|
||||
import { INDEX_NAMES } from '../../../common/constants';
|
||||
import { RouteDependencies } from '../../types';
|
||||
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
// @ts-ignore
|
||||
import { Settings } from '../../../models/settings/index';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { get } from 'lodash';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { isEsError } from '../../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../../shared_imports';
|
||||
// @ts-ignore
|
||||
import { WatchStatus } from '../../../../models/watch_status/index';
|
||||
import { RouteDependencies } from '../../../../types';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { get } from 'lodash';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
// @ts-ignore
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { get } from 'lodash';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
// @ts-ignore
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { get } from 'lodash';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
|
||||
import { RouteDependencies } from '../../../types';
|
||||
|
|
|
@ -9,7 +9,7 @@ import { IScopedClusterClient } from 'kibana/server';
|
|||
import { get } from 'lodash';
|
||||
import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll';
|
||||
import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
// @ts-ignore
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { get } from 'lodash';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
// @ts-ignore
|
||||
import { Watch } from '../../../models/watch/index';
|
||||
|
|
|
@ -8,7 +8,7 @@ import { schema } from '@kbn/config-schema';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { WATCH_TYPES } from '../../../../common/constants';
|
||||
import { serializeJsonWatch, serializeThresholdWatch } from '../../../../common/lib/serialization';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { IScopedClusterClient } from 'kibana/server';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import { IScopedClusterClient } from 'kibana/server';
|
|||
import { get } from 'lodash';
|
||||
import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll';
|
||||
import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants';
|
||||
import { isEsError } from '../../../lib/is_es_error';
|
||||
import { isEsError } from '../../../shared_imports';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
|
||||
// @ts-ignore
|
||||
|
|
7
x-pack/plugins/watcher/server/shared_imports.ts
Normal file
7
x-pack/plugins/watcher/server/shared_imports.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';
|
Loading…
Add table
Add a link
Reference in a new issue