parent
3b3009b426
commit
f1a148c538
|
@ -60,7 +60,12 @@ export default function(kibana) {
|
|||
},
|
||||
|
||||
uiExports: {
|
||||
hacks: ['plugins/kibana/discover', 'plugins/kibana/dev_tools', 'plugins/kibana/visualize'],
|
||||
hacks: [
|
||||
'plugins/kibana/discover/legacy',
|
||||
'plugins/kibana/dev_tools',
|
||||
'plugins/kibana/visualize/legacy',
|
||||
'plugins/kibana/dashboard/legacy',
|
||||
],
|
||||
savedObjectTypes: ['plugins/kibana/dashboard/saved_dashboard/saved_dashboard_register'],
|
||||
app: {
|
||||
id: 'kibana',
|
||||
|
|
|
@ -51,6 +51,7 @@ function buildRestrictedPaths(shimmedPlugins) {
|
|||
from: [
|
||||
`src/legacy/core_plugins/kibana/public/${shimmedPlugin}/**/*`,
|
||||
`!src/legacy/core_plugins/kibana/public/${shimmedPlugin}/index.ts`,
|
||||
`!src/legacy/core_plugins/kibana/public/${shimmedPlugin}/legacy.ts`,
|
||||
],
|
||||
allowSameFolder: false,
|
||||
errorMessage: `kibana/public/${shimmedPlugin} is behaving like a NP plugin and does not allow deep imports. If you need something from within ${shimmedPlugin} in another plugin, consider re-exporting it from the top level index module`,
|
||||
|
|
|
@ -17,40 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { npSetup, npStart, legacyChrome } from './legacy_imports';
|
||||
import { DashboardPlugin, LegacyAngularInjectedDependencies } from './plugin';
|
||||
import { start as data } from '../../../data/public/legacy';
|
||||
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
|
||||
import './saved_dashboard/saved_dashboard_register';
|
||||
import './dashboard_config';
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import { DashboardPlugin } from './plugin';
|
||||
|
||||
export * from './np_ready/dashboard_constants';
|
||||
|
||||
/**
|
||||
* Get dependencies relying on the global angular context.
|
||||
* They also have to get resolved together with the legacy imports above
|
||||
*/
|
||||
async function getAngularDependencies(): Promise<LegacyAngularInjectedDependencies> {
|
||||
const injector = await legacyChrome.dangerouslyGetActiveInjector();
|
||||
|
||||
return {
|
||||
dashboardConfig: injector.get('dashboardConfig'),
|
||||
};
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const instance = new DashboardPlugin();
|
||||
instance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
getAngularDependencies,
|
||||
},
|
||||
});
|
||||
instance.start(npStart.core, {
|
||||
...npStart.plugins,
|
||||
data,
|
||||
npData: npStart.plugins.data,
|
||||
embeddables,
|
||||
navigation: npStart.plugins.navigation,
|
||||
});
|
||||
})();
|
||||
// Core will be looking for this when loading our plugin in the new platform
|
||||
export const plugin = (context: PluginInitializerContext) => {
|
||||
return new DashboardPlugin();
|
||||
};
|
||||
|
|
56
src/legacy/core_plugins/kibana/public/dashboard/legacy.ts
Normal file
56
src/legacy/core_plugins/kibana/public/dashboard/legacy.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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 { PluginInitializerContext } from 'kibana/public';
|
||||
import { npSetup, npStart, legacyChrome } from './legacy_imports';
|
||||
import { LegacyAngularInjectedDependencies } from './plugin';
|
||||
import { start as data } from '../../../data/public/legacy';
|
||||
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
|
||||
import './saved_dashboard/saved_dashboard_register';
|
||||
import './dashboard_config';
|
||||
import { plugin } from './index';
|
||||
|
||||
/**
|
||||
* Get dependencies relying on the global angular context.
|
||||
* They also have to get resolved together with the legacy imports above
|
||||
*/
|
||||
async function getAngularDependencies(): Promise<LegacyAngularInjectedDependencies> {
|
||||
const injector = await legacyChrome.dangerouslyGetActiveInjector();
|
||||
|
||||
return {
|
||||
dashboardConfig: injector.get('dashboardConfig'),
|
||||
};
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const instance = plugin({} as PluginInitializerContext);
|
||||
instance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
getAngularDependencies,
|
||||
},
|
||||
});
|
||||
instance.start(npStart.core, {
|
||||
...npStart.plugins,
|
||||
data,
|
||||
npData: npStart.plugins.data,
|
||||
embeddables,
|
||||
navigation: npStart.plugins.navigation,
|
||||
});
|
||||
})();
|
|
@ -22,7 +22,7 @@ import _ from 'lodash';
|
|||
import sinon from 'sinon';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
|
||||
// Load the kibana app dependencies.
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import ngMock from 'ng_mock';
|
||||
import { fieldCalculator } from '../../np_ready/components/field_chooser/lib/field_calculator';
|
||||
import expect from '@kbn/expect';
|
||||
|
|
|
@ -23,7 +23,7 @@ import _ from 'lodash';
|
|||
import sinon from 'sinon';
|
||||
import expect from '@kbn/expect';
|
||||
import $ from 'jquery';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import FixturesHitsProvider from 'fixtures/hits';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
import { SimpleSavedObject } from '../../../../../../../core/public';
|
||||
|
|
|
@ -22,7 +22,7 @@ import expect from '@kbn/expect';
|
|||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import 'ui/private';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
import hits from 'fixtures/real_hits';
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import expect from '@kbn/expect';
|
|||
import ngMock from 'ng_mock';
|
||||
import { getFakeRow, getFakeRowVals } from 'fixtures/fake_row';
|
||||
import $ from 'jquery';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
|
||||
describe('Doc Table', function() {
|
||||
|
|
|
@ -22,7 +22,7 @@ import ngMock from 'ng_mock';
|
|||
import { createStateStub } from './_utils';
|
||||
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
|
||||
import { createIndexPatternsStub } from '../../np_ready/angular/context/api/__tests__/_stubs';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
|
||||
describe('context app', function() {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
import { createStateStub } from './_utils';
|
||||
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
|
||||
import { createStateStub } from './_utils';
|
||||
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
|
||||
import { createStateStub } from './_utils';
|
||||
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
|
||||
|
|
|
@ -16,24 +16,13 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import chrome from 'ui/chrome';
|
||||
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import { npSetup, npStart } from 'ui/new_platform';
|
||||
import { DiscoverPlugin } from './plugin';
|
||||
|
||||
export { createSavedSearchesService } from './saved_searches/saved_searches';
|
||||
|
||||
// Core will be looking for this when loading our plugin in the new platform
|
||||
export const plugin = (context: PluginInitializerContext) => {
|
||||
return new DiscoverPlugin();
|
||||
};
|
||||
|
||||
// Legacy compatiblity part - to be removed at cutover, replaced by a kibana.json file
|
||||
export const pluginInstance = plugin({} as PluginInitializerContext);
|
||||
export const setup = pluginInstance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
chrome,
|
||||
},
|
||||
});
|
||||
export const start = pluginInstance.start(npStart.core, npStart.plugins);
|
||||
|
||||
export { createSavedSearchesService } from './saved_searches/saved_searches';
|
||||
|
|
32
src/legacy/core_plugins/kibana/public/discover/legacy.ts
Normal file
32
src/legacy/core_plugins/kibana/public/discover/legacy.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 chrome from 'ui/chrome';
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import { npSetup, npStart } from 'ui/new_platform';
|
||||
import { plugin } from './index';
|
||||
|
||||
// Legacy compatiblity part - to be removed at cutover, replaced by a kibana.json file
|
||||
export const pluginInstance = plugin({} as PluginInitializerContext);
|
||||
export const setup = pluginInstance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
chrome,
|
||||
},
|
||||
});
|
||||
export const start = pluginInstance.start(npStart.core, npStart.plugins);
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
|
||||
import { createIndexPatternsStub, createSearchSourceStub } from './_stubs';
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import expect from '@kbn/expect';
|
|||
import ngMock from 'ng_mock';
|
||||
import moment from 'moment';
|
||||
import * as _ from 'lodash';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
|
||||
import { createIndexPatternsStub, createContextSearchSourceStub } from './_stubs';
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import expect from '@kbn/expect';
|
|||
import ngMock from 'ng_mock';
|
||||
import moment from 'moment';
|
||||
import * as _ from 'lodash';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/index';
|
||||
import { pluginInstance } from 'plugins/kibana/discover/legacy';
|
||||
|
||||
import { createIndexPatternsStub, createContextSearchSourceStub } from './_stubs';
|
||||
|
||||
|
|
|
@ -22,11 +22,8 @@ import { npSetup, npStart } from 'ui/new_platform';
|
|||
import chrome from 'ui/chrome';
|
||||
import { IPrivate } from 'ui/private';
|
||||
import { HomePlugin, LegacyAngularInjectedDependencies } from './plugin';
|
||||
import { createUiStatsReporter, METRIC_TYPE } from '../../../ui_metric/public';
|
||||
import { TelemetryOptInProvider } from '../../../telemetry/public/services';
|
||||
|
||||
export const trackUiMetric = createUiStatsReporter('Kibana_home');
|
||||
|
||||
/**
|
||||
* Get dependencies relying on the global angular context.
|
||||
* They also have to get resolved together with the legacy imports above
|
||||
|
@ -54,9 +51,7 @@ let copiedLegacyCatalogue = false;
|
|||
instance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
trackUiMetric,
|
||||
metadata: npStart.core.injectedMetadata.getLegacyMetadata(),
|
||||
METRIC_TYPE,
|
||||
getFeatureCatalogueEntries: async () => {
|
||||
if (!copiedLegacyCatalogue) {
|
||||
const injector = await chrome.dangerouslyGetActiveInjector();
|
||||
|
|
|
@ -55,7 +55,6 @@ export interface HomeKibanaServices {
|
|||
savedObjectsClient: SavedObjectsClientContract;
|
||||
toastNotifications: NotificationsSetup['toasts'];
|
||||
banners: OverlayStart['banners'];
|
||||
METRIC_TYPE: any;
|
||||
trackUiMetric: (type: UiStatsMetricType, eventNames: string | string[], count?: number) => void;
|
||||
getBasePath: () => string;
|
||||
shouldShowTelemetryOptIn: boolean;
|
||||
|
|
|
@ -25,10 +25,6 @@ jest.mock('../../kibana_services', () => ({
|
|||
getServices: () => ({
|
||||
addBasePath: (path: string) => `root${path}`,
|
||||
trackUiMetric: () => {},
|
||||
METRIC_TYPE: {
|
||||
LOADED: 'loaded',
|
||||
CLICK: 'click',
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import {
|
|||
EuiIcon,
|
||||
EuiPortal,
|
||||
} from '@elastic/eui';
|
||||
import { METRIC_TYPE } from '@kbn/analytics';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { getServices } from '../../kibana_services';
|
||||
|
||||
|
@ -64,17 +65,17 @@ export class Welcome extends React.Component<Props> {
|
|||
}
|
||||
|
||||
private onSampleDataDecline = () => {
|
||||
this.services.trackUiMetric(this.services.METRIC_TYPE.CLICK, 'sampleDataDecline');
|
||||
this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataDecline');
|
||||
this.props.onSkip();
|
||||
};
|
||||
|
||||
private onSampleDataConfirm = () => {
|
||||
this.services.trackUiMetric(this.services.METRIC_TYPE.CLICK, 'sampleDataConfirm');
|
||||
this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataConfirm');
|
||||
this.redirecToSampleData();
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.services.trackUiMetric(this.services.METRIC_TYPE.LOADED, 'welcomeScreenMount');
|
||||
this.services.trackUiMetric(METRIC_TYPE.LOADED, 'welcomeScreenMount');
|
||||
this.props.onOptInSeen();
|
||||
document.addEventListener('keydown', this.hideOnEsc);
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, LegacyNavLink, Plugin, UiSettingsState } from 'kibana/public';
|
||||
import { UiStatsMetricType } from '@kbn/analytics';
|
||||
|
||||
import { DataPublicPluginStart } from 'src/plugins/data/public';
|
||||
import { setServices } from './kibana_services';
|
||||
import { KibanaLegacySetup } from '../../../../../plugins/kibana_legacy/public';
|
||||
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public';
|
||||
import {
|
||||
Environment,
|
||||
FeatureCatalogueEntry,
|
||||
|
@ -41,8 +41,6 @@ export interface HomePluginStartDependencies {
|
|||
|
||||
export interface HomePluginSetupDependencies {
|
||||
__LEGACY: {
|
||||
trackUiMetric: (type: UiStatsMetricType, eventNames: string | string[], count?: number) => void;
|
||||
METRIC_TYPE: any;
|
||||
metadata: {
|
||||
app: unknown;
|
||||
bundleId: string;
|
||||
|
@ -59,6 +57,7 @@ export interface HomePluginSetupDependencies {
|
|||
getFeatureCatalogueEntries: () => Promise<readonly FeatureCatalogueEntry[]>;
|
||||
getAngularDependencies: () => Promise<LegacyAngularInjectedDependencies>;
|
||||
};
|
||||
usageCollection: UsageCollectionSetup;
|
||||
kibana_legacy: KibanaLegacySetup;
|
||||
}
|
||||
|
||||
|
@ -71,6 +70,7 @@ export class HomePlugin implements Plugin {
|
|||
core: CoreSetup,
|
||||
{
|
||||
kibana_legacy,
|
||||
usageCollection,
|
||||
__LEGACY: { getAngularDependencies, ...legacyServices },
|
||||
}: HomePluginSetupDependencies
|
||||
) {
|
||||
|
@ -78,9 +78,11 @@ export class HomePlugin implements Plugin {
|
|||
id: 'home',
|
||||
title: 'Home',
|
||||
mount: async ({ core: contextCore }, params) => {
|
||||
const trackUiMetric = usageCollection.reportUiStats.bind(usageCollection, 'Kibana_home');
|
||||
const angularDependencies = await getAngularDependencies();
|
||||
setServices({
|
||||
...legacyServices,
|
||||
trackUiMetric,
|
||||
http: contextCore.http,
|
||||
toastNotifications: core.notifications.toasts,
|
||||
banners: contextCore.overlays.banners,
|
||||
|
|
|
@ -47,9 +47,9 @@ import 'uiExports/interpreter';
|
|||
import 'ui/autoload/all';
|
||||
import 'ui/kbn_top_nav';
|
||||
import './home';
|
||||
import './discover';
|
||||
import './visualize';
|
||||
import './dashboard';
|
||||
import './discover/legacy';
|
||||
import './visualize/legacy';
|
||||
import './dashboard/legacy';
|
||||
import './management';
|
||||
import './dev_tools';
|
||||
import 'ui/color_maps';
|
||||
|
|
|
@ -17,50 +17,15 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
IPrivate,
|
||||
legacyChrome,
|
||||
npSetup,
|
||||
npStart,
|
||||
VisEditorTypesRegistryProvider,
|
||||
} from './legacy_imports';
|
||||
import { VisualizePlugin, LegacyAngularInjectedDependencies } from './plugin';
|
||||
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
|
||||
import { start as visualizations } from '../../../visualizations/public/np_ready/public/legacy';
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import { VisualizePlugin } from './plugin';
|
||||
|
||||
export * from './np_ready/visualize_constants';
|
||||
export { showNewVisModal } from './np_ready/wizard';
|
||||
|
||||
/**
|
||||
* Get dependencies relying on the global angular context.
|
||||
* They also have to get resolved together with the legacy imports above
|
||||
*/
|
||||
async function getAngularDependencies(): Promise<LegacyAngularInjectedDependencies> {
|
||||
const injector = await legacyChrome.dangerouslyGetActiveInjector();
|
||||
|
||||
const Private = injector.get<IPrivate>('Private');
|
||||
|
||||
const editorTypes = Private(VisEditorTypesRegistryProvider);
|
||||
|
||||
return {
|
||||
legacyChrome,
|
||||
editorTypes,
|
||||
};
|
||||
}
|
||||
|
||||
(() => {
|
||||
const instance = new VisualizePlugin();
|
||||
instance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
getAngularDependencies,
|
||||
},
|
||||
});
|
||||
instance.start(npStart.core, {
|
||||
...npStart.plugins,
|
||||
embeddables,
|
||||
visualizations,
|
||||
});
|
||||
})();
|
||||
|
||||
export { createSavedVisLoader } from './saved_visualizations/saved_visualizations';
|
||||
|
||||
// Core will be looking for this when loading our plugin in the new platform
|
||||
export const plugin = (context: PluginInitializerContext) => {
|
||||
return new VisualizePlugin();
|
||||
};
|
||||
|
|
65
src/legacy/core_plugins/kibana/public/visualize/legacy.ts
Normal file
65
src/legacy/core_plugins/kibana/public/visualize/legacy.ts
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* 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 'ui/collapsible_sidebar'; // used in default editor
|
||||
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import {
|
||||
IPrivate,
|
||||
legacyChrome,
|
||||
npSetup,
|
||||
npStart,
|
||||
VisEditorTypesRegistryProvider,
|
||||
} from './legacy_imports';
|
||||
import { LegacyAngularInjectedDependencies } from './plugin';
|
||||
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
|
||||
import { start as visualizations } from '../../../visualizations/public/np_ready/public/legacy';
|
||||
import { plugin } from './index';
|
||||
|
||||
/**
|
||||
* Get dependencies relying on the global angular context.
|
||||
* They also have to get resolved together with the legacy imports above
|
||||
*/
|
||||
async function getAngularDependencies(): Promise<LegacyAngularInjectedDependencies> {
|
||||
const injector = await legacyChrome.dangerouslyGetActiveInjector();
|
||||
|
||||
const Private = injector.get<IPrivate>('Private');
|
||||
|
||||
const editorTypes = Private(VisEditorTypesRegistryProvider);
|
||||
|
||||
return {
|
||||
legacyChrome,
|
||||
editorTypes,
|
||||
};
|
||||
}
|
||||
|
||||
(() => {
|
||||
const instance = plugin({} as PluginInitializerContext);
|
||||
instance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
__LEGACY: {
|
||||
getAngularDependencies,
|
||||
},
|
||||
});
|
||||
instance.start(npStart.core, {
|
||||
...npStart.plugins,
|
||||
embeddables,
|
||||
visualizations,
|
||||
});
|
||||
})();
|
|
@ -20,7 +20,7 @@
|
|||
import angular from 'angular';
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import 'plugins/kibana/discover/index';
|
||||
import 'plugins/kibana/discover/legacy';
|
||||
|
||||
let $parentScope;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import 'ui/color_maps';
|
|||
import 'ui/agg_response';
|
||||
import 'ui/agg_types';
|
||||
import 'leaflet';
|
||||
import 'plugins/kibana/dashboard/legacy';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { localApplicationService } from 'plugins/kibana/local_application_service';
|
||||
|
||||
|
|
Loading…
Reference in a new issue