[7.x] Enforce shimmed plugin boundaries (#52633) (#53716)

* Enforce shimmed plugin boundaries (#52633)

* resolve conflicts around field chooser
This commit is contained in:
Joe Reuter 2019-12-20 23:41:28 +01:00 committed by GitHub
parent 776aa23b06
commit 3beace99eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
360 changed files with 551 additions and 384 deletions

View file

@ -1,3 +0,0 @@
rules:
no-console: 2
'import/no-default-export': error

View file

@ -0,0 +1,72 @@
/*
* 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.
*/
const path = require('path');
/**
* Builds custom restricted paths configuration for the shimmed plugins within the kibana plugin.
* These custom rules extend the default checks in the top level `eslintrc.js` by also checking two other things:
* * Making sure nothing within np_ready imports from the `ui` directory
* * Making sure no other code is importing things deep from within the shimmed plugins
* @param shimmedPlugins List of plugin names within the kibana plugin that are partially np ready
* @returns zones configuration for the no-restricted-paths linter
*/
function buildRestrictedPaths(shimmedPlugins) {
return shimmedPlugins.map(shimmedPlugin => ([{
target: [
`src/legacy/core_plugins/kibana/public/${shimmedPlugin}/np_ready/**/*`,
],
from: [
'ui/**/*',
'src/legacy/ui/**/*',
'src/legacy/core_plugins/kibana/public/**/*',
'src/legacy/core_plugins/data/public/**/*',
'!src/legacy/core_plugins/data/public/index.ts',
`!src/legacy/core_plugins/kibana/public/${shimmedPlugin}/**/*`,
],
allowSameFolder: false,
errorMessage: `${shimmedPlugin} is a shimmed plugin that is not allowed to import modules from the legacy platform. If you need legacy modules for the transition period, import them either in the legacy_imports, kibana_services or index module.`,
}, {
target: [
'src/**/*',
`!src/legacy/core_plugins/kibana/public/${shimmedPlugin}/**/*`,
'x-pack/**/*',
],
from: [
`src/legacy/core_plugins/kibana/public/${shimmedPlugin}/**/*`,
`!src/legacy/core_plugins/kibana/public/${shimmedPlugin}/index.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`,
}])).reduce((acc, part) => [...acc, ...part], []);
}
module.exports = {
rules: {
'no-console': 2,
'import/no-default-export': 'error',
'@kbn/eslint/no-restricted-paths': [
'error',
{
basePath: path.resolve(__dirname, '../../../../../'),
zones: buildRestrictedPaths(['visualize', 'discover', 'dashboard', 'devTools', 'home']),
},
],
},
};

View file

@ -18,7 +18,10 @@
*/
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { DashboardEmptyScreen, DashboardEmptyScreenProps } from '../dashboard_empty_screen';
import {
DashboardEmptyScreen,
DashboardEmptyScreenProps,
} from '../np_ready/dashboard_empty_screen';
// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { searchSourceMock } from '../../../../../ui/public/courier/search_source/mocks';
import { searchSourceMock } from 'ui/courier/search_source/mocks';
import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard';
export function getSavedDashboardMock(

View file

@ -30,6 +30,8 @@ import { start as embeddables } from '../../../embeddable_api/public/np_ready/pu
import './saved_dashboard/saved_dashboards';
import './dashboard_config';
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

View file

@ -57,7 +57,7 @@ export { createTopNavDirective, createTopNavHelper } from 'ui/kbn_top_nav/kbn_to
// @ts-ignore
export { PromiseServiceCreator } from 'ui/promises/promises';
// @ts-ignore
export { KbnUrlProvider, RedirectWhenMissingProvider } from 'ui/url';
export { KbnUrlProvider, RedirectWhenMissingProvider } from 'ui/url/index';
// @ts-ignore
export { confirmModalFactory } from 'ui/modals/confirm_modal';
export { configureAppAngularModule } from 'ui/legacy_compat';
@ -65,3 +65,5 @@ export { stateMonitorFactory, StateMonitor } from 'ui/state_management/state_mon
export { ensureDefaultIndexPattern } from 'ui/legacy_compat';
export { unhashUrl } from '../../../../../plugins/kibana_utils/public';
export { IInjector } from 'ui/chrome';
export { VISUALIZE_EMBEDDABLE_TYPE } from '../visualize_embeddable';
export { registerTimefilterWithGlobalStateFactory } from 'ui/timefilter/setup_router';

View file

@ -37,7 +37,7 @@ jest.mock(
jest.mock('ui/new_platform');
import { migratePanelsTo730 } from './migrate_to_730_panels';
import { SavedDashboardPanelTo60, SavedDashboardPanel730ToLatest } from '../types';
import { SavedDashboardPanelTo60, SavedDashboardPanel730ToLatest } from '../np_ready/types';
import {
RawSavedDashboardPanelTo60,
RawSavedDashboardPanel610,

View file

@ -34,7 +34,7 @@ import {
SavedDashboardPanel620,
SavedDashboardPanel630,
SavedDashboardPanel610,
} from '../types';
} from '../np_ready/types';
const PANEL_HEIGHT_SCALE_FACTOR = 5;
const PANEL_HEIGHT_SCALE_FACTOR_WITH_MARGINS = 4;

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { GridData } from '../types';
import { GridData } from '../np_ready/types';
import { Doc, DocPre700 } from '../../../migrations/types';
export interface SavedObjectAttributes {

View file

@ -19,7 +19,6 @@
import { EuiConfirmModal, EuiIcon } from '@elastic/eui';
import angular, { IModule } from 'angular';
import { IPrivate } from 'ui/private';
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
import {
AppMountContext,
@ -28,7 +27,7 @@ import {
SavedObjectsClientContract,
IUiSettingsClient,
} from 'kibana/public';
import { Storage } from '../../../../../plugins/kibana_utils/public';
import { Storage } from '../../../../../../plugins/kibana_utils/public';
import {
GlobalStateProvider,
StateManagementConfigProvider,
@ -43,14 +42,15 @@ import {
RedirectWhenMissingProvider,
confirmModalFactory,
configureAppAngularModule,
} from './legacy_imports';
IPrivate,
} from '../legacy_imports';
// @ts-ignore
import { initDashboardApp } from './legacy_app';
import { IEmbeddableStart } from '../../../../../plugins/embeddable/public';
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public';
import { DataPublicPluginStart as NpDataStart } from '../../../../../plugins/data/public';
import { SharePluginStart } from '../../../../../plugins/share/public';
import { IEmbeddableStart } from '../../../../../../plugins/embeddable/public';
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../../plugins/navigation/public';
import { DataPublicPluginStart as NpDataStart } from '../../../../../../plugins/data/public';
import { SharePluginStart } from '../../../../../../plugins/share/public';
export interface RenderDeps {
core: LegacyCoreStart;

View file

@ -25,10 +25,10 @@ import {
AppState as TAppState,
IInjector,
KbnUrl,
} from './legacy_imports';
} from '../legacy_imports';
import { ViewMode } from '../../../embeddable_api/public/np_ready/public';
import { SavedObjectDashboard } from './saved_dashboard/saved_dashboard';
import { ViewMode } from '../../../../embeddable_api/public/np_ready/public';
import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard';
import { DashboardAppState, SavedDashboardPanel, ConfirmModalFn } from './types';
import {
IIndexPattern,
@ -36,7 +36,7 @@ import {
Query,
esFilters,
SavedQuery,
} from '../../../../../../src/plugins/data/public';
} from '../../../../../../plugins/data/public';
import { DashboardAppController } from './dashboard_app_controller';
import { RenderDeps } from './application';

View file

@ -37,9 +37,10 @@ import {
KbnUrl,
SavedObjectSaveOpts,
unhashUrl,
} from './legacy_imports';
import { FilterStateManager, IndexPattern } from '../../../data/public';
import { Query, SavedQuery, IndexPatternsContract } from '../../../../../plugins/data/public';
VISUALIZE_EMBEDDABLE_TYPE,
} from '../legacy_imports';
import { FilterStateManager, IndexPattern } from '../../../../data/public';
import { Query, SavedQuery, IndexPatternsContract } from '../../../../../../plugins/data/public';
import {
DashboardContainer,
@ -47,14 +48,14 @@ import {
DashboardContainerFactory,
DashboardContainerInput,
DashboardPanelState,
} from '../../../dashboard_embeddable_container/public/np_ready/public';
} from '../../../../dashboard_embeddable_container/public/np_ready/public';
import {
isErrorEmbeddable,
ErrorEmbeddable,
ViewMode,
openAddPanelFlyout,
EmbeddableFactoryNotFoundError,
} from '../../../embeddable_api/public/np_ready/public';
} from '../../../../embeddable_api/public/np_ready/public';
import { DashboardAppState, NavAction, ConfirmModalFn, SavedDashboardPanel } from './types';
import { showOptionsPopover } from './top_nav/show_options_popover';
@ -67,13 +68,12 @@ import { getTopNavConfig } from './top_nav/get_top_nav_config';
import { TopNavIds } from './top_nav/top_nav_ids';
import { getDashboardTitle } from './dashboard_strings';
import { DashboardAppScope } from './dashboard_app';
import { VISUALIZE_EMBEDDABLE_TYPE } from '../visualize/embeddable';
import { convertSavedDashboardPanelToPanelState } from './lib/embeddable_saved_object_converters';
import { RenderDeps } from './application';
import {
SavedObjectFinderProps,
SavedObjectFinderUi,
} from '../../../../../plugins/kibana_react/public';
} from '../../../../../../plugins/kibana_react/public';
export interface DashboardAppControllerDependencies extends RenderDeps {
$scope: DashboardAppScope;

View file

@ -19,8 +19,8 @@
import './np_core.test.mocks';
import { DashboardStateManager } from './dashboard_state_manager';
import { getAppStateMock, getSavedDashboardMock } from './__tests__';
import { AppStateClass } from './legacy_imports';
import { getAppStateMock, getSavedDashboardMock } from '../__tests__';
import { AppStateClass } from '../legacy_imports';
import { DashboardAppState } from './types';
import { TimeRange, TimefilterContract, InputTimeRange } from 'src/plugins/data/public';
import { ViewMode } from 'src/plugins/embeddable/public';

View file

@ -23,23 +23,23 @@ import _ from 'lodash';
import { Moment } from 'moment';
import { DashboardContainer } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { ViewMode } from '../../../../../../src/plugins/embeddable/public';
import { ViewMode } from '../../../../../../plugins/embeddable/public';
import {
stateMonitorFactory,
StateMonitor,
AppStateClass as TAppStateClass,
migrateLegacyQuery,
} from './legacy_imports';
} from '../legacy_imports';
import {
Query,
esFilters,
TimefilterContract as Timefilter,
} from '../../../../../../src/plugins/data/public';
} from '../../../../../../plugins/data/public';
import { getAppStateDefaults, migrateAppState } from './lib';
import { convertPanelStateToSavedDashboardPanel } from './lib/embeddable_saved_object_converters';
import { FilterUtils } from './lib/filter_utils';
import { SavedObjectDashboard } from './saved_dashboard/saved_dashboard';
import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard';
import { SavedDashboardPanel, DashboardAppState, DashboardAppStateDefaults } from './types';

View file

@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
import { ViewMode } from '../../../../../../src/plugins/embeddable/public';
import { ViewMode } from '../../../../../../plugins/embeddable/public';
/**
* @param title {string} the current title of the dashboard

View file

@ -17,8 +17,8 @@
* under the License.
*/
import { State } from './legacy_imports';
import { DataPublicPluginStart as NpDataStart } from '../../../../../plugins/data/public';
import { State } from '../legacy_imports';
import { DataPublicPluginStart as NpDataStart } from '../../../../../../plugins/data/public';
/**
* Helper function to sync the global state with the various state providers

View file

@ -18,9 +18,12 @@
*/
import { i18n } from '@kbn/i18n';
import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links';
import { CoreStart } from 'kibana/public';
export function addHelpMenuToAppChrome(chrome) {
export function addHelpMenuToAppChrome(
chrome: CoreStart['chrome'],
docLinks: CoreStart['docLinks']
) {
chrome.setHelpExtension({
appName: i18n.translate('kbn.dashboard.helpMenu.appName', {
defaultMessage: 'Dashboards',
@ -28,7 +31,7 @@ export function addHelpMenuToAppChrome(chrome) {
links: [
{
linkType: 'documentation',
href: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/dashboard.html`,
href: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/dashboard.html`,
},
],
});

View file

@ -22,23 +22,35 @@ import { i18n } from '@kbn/i18n';
import dashboardTemplate from './dashboard_app.html';
import dashboardListingTemplate from './listing/dashboard_listing_ng_wrapper.html';
import { ensureDefaultIndexPattern } from './legacy_imports';
import {
ensureDefaultIndexPattern,
registerTimefilterWithGlobalStateFactory,
} from '../legacy_imports';
import { initDashboardAppDirective } from './dashboard_app';
import { DashboardConstants, createDashboardEditUrl } from './dashboard_constants';
import {
InvalidJSONProperty,
SavedObjectNotFound,
} from '../../../../../plugins/kibana_utils/public';
} from '../../../../../../plugins/kibana_utils/public';
import { DashboardListing, EMPTY_FILTER } from './listing/dashboard_listing';
import { addHelpMenuToAppChrome } from './help_menu/help_menu_util';
import { registerTimefilterWithGlobalStateFactory } from '../../../../ui/public/timefilter/setup_router';
import { syncOnMount } from './global_state_sync';
export function initDashboardApp(app, deps) {
initDashboardAppDirective(app, deps);
app.directive('dashboardListing', function(reactDirective) {
return reactDirective(DashboardListing);
return reactDirective(DashboardListing, [
['core', { watchDepth: 'reference' }],
['createItem', { watchDepth: 'reference' }],
['getViewUrl', { watchDepth: 'reference' }],
['editItem', { watchDepth: 'reference' }],
['findItems', { watchDepth: 'reference' }],
['deleteItems', { watchDepth: 'reference' }],
['listingLimit', { watchDepth: 'reference' }],
['hideWriteControls', { watchDepth: 'reference' }],
['initialFilter', { watchDepth: 'reference' }],
]);
});
function createNewDashboardCtrl($scope) {
@ -116,6 +128,7 @@ export function initDashboardApp(app, deps) {
},
]);
addHelpMenuToAppChrome(deps.chrome, deps.core.docLinks);
$scope.core = deps.core;
},
resolve: {
dash: function($rootScope, $route, redirectWhenMissing, kbnUrl) {

View file

@ -19,7 +19,7 @@
import _ from 'lodash';
import moment, { Moment } from 'moment';
import { esFilters } from '../../../../../../plugins/data/public';
import { esFilters } from '../../../../../../../plugins/data/public';
/**
* @typedef {Object} QueryFilter

View file

@ -17,8 +17,8 @@
* under the License.
*/
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard';
import { ViewMode } from '../../../../../../../plugins/embeddable/public';
import { SavedObjectDashboard } from '../../saved_dashboard/saved_dashboard';
import { DashboardAppStateDefaults } from '../types';
export function getAppStateDefaults(

View file

@ -19,7 +19,7 @@
import semver from 'semver';
import { i18n } from '@kbn/i18n';
import { createUiStatsReporter, METRIC_TYPE } from '../../../../ui_metric/public';
import { createUiStatsReporter, METRIC_TYPE } from '../../../../../ui_metric/public';
import {
DashboardAppState,
SavedDashboardPanelTo60,
@ -29,7 +29,7 @@ import {
SavedDashboardPanel640To720,
SavedDashboardPanel620,
} from '../types';
import { migratePanelsTo730 } from '../migrations/migrate_to_730_panels';
import { migratePanelsTo730 } from '../../migrations/migrate_to_730_panels';
/**
* Attempts to migrate the state stored in the URL into the latest version of it.

View file

@ -18,7 +18,7 @@
*/
import { TimefilterContract } from 'src/plugins/data/public';
import { SavedObjectSaveOpts } from '../legacy_imports';
import { SavedObjectSaveOpts } from '../../legacy_imports';
import { updateSavedDashboard } from './update_saved_dashboard';
import { DashboardStateManager } from '../dashboard_state_manager';

View file

@ -19,9 +19,9 @@
import _ from 'lodash';
import { RefreshInterval, TimefilterContract } from 'src/plugins/data/public';
import { AppState } from '../legacy_imports';
import { AppState } from '../../legacy_imports';
import { FilterUtils } from './filter_utils';
import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard';
import { SavedObjectDashboard } from '../../saved_dashboard/saved_dashboard';
export function updateSavedDashboard(
savedDashboard: SavedObjectDashboard,

View file

@ -23,9 +23,8 @@ import PropTypes from 'prop-types';
import { FormattedMessage, I18nProvider } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { EuiLink, EuiButton, EuiEmptyPrompt } from '@elastic/eui';
import { npStart } from 'ui/new_platform';
import { TableListView } from '../../../../../../../src/plugins/kibana_react/public';
import { TableListView } from '../../../../../../../plugins/kibana_react/public';
export const EMPTY_FILTER = '';
@ -60,8 +59,8 @@ export class DashboardListing extends React.Component {
tableListTitle={i18n.translate('kbn.dashboard.listing.dashboardsTitle', {
defaultMessage: 'Dashboards',
})}
toastNotifications={npStart.core.notifications.toasts}
uiSettings={npStart.core.uiSettings}
toastNotifications={this.props.core.notifications.toasts}
uiSettings={this.props.core.uiSettings}
/>
</I18nProvider>
);

View file

@ -42,17 +42,6 @@ jest.mock(
{ virtual: true }
);
jest.mock('ui/new_platform', () => {
return {
npStart: {
core: {
notifications: { toasts: {} },
uiSettings: { get: jest.fn(() => 10) },
},
},
};
});
import React from 'react';
import { shallow } from 'enzyme';
@ -83,6 +72,7 @@ test('renders empty page in before initial fetch to avoid flickering', () => {
getViewUrl={() => {}}
listingLimit={1000}
hideWriteControls={false}
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);
expect(component).toMatchSnapshot();
@ -100,6 +90,7 @@ describe('after fetch', () => {
listingLimit={1000}
hideWriteControls={false}
initialFilter="my dashboard"
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);
@ -121,6 +112,7 @@ describe('after fetch', () => {
getViewUrl={() => {}}
listingLimit={1000}
hideWriteControls={false}
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);
@ -142,6 +134,7 @@ describe('after fetch', () => {
getViewUrl={() => {}}
listingLimit={1}
hideWriteControls={false}
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);
@ -163,6 +156,7 @@ describe('after fetch', () => {
getViewUrl={() => {}}
listingLimit={1}
hideWriteControls={true}
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);
@ -184,6 +178,7 @@ describe('after fetch', () => {
getViewUrl={() => {}}
listingLimit={1}
hideWriteControls={false}
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);

View file

@ -1,4 +1,5 @@
<dashboard-listing
core="core"
create-item="create"
get-view-url="getViewUrl"
edit-item="editItem"

View file

@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
import { ViewMode } from '../../../../../../plugins/embeddable/public';
import { ViewMode } from '../../../../../../../plugins/embeddable/public';
import { TopNavIds } from './top_nav_ids';
import { NavAction } from '../types';

View file

@ -20,7 +20,7 @@
import React from 'react';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
jest.mock('../legacy_imports', () => ({
jest.mock('../../legacy_imports', () => ({
SavedObjectSaveModal: () => null,
}));

View file

@ -21,7 +21,7 @@ import React, { Fragment } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFormRow, EuiTextArea, EuiSwitch } from '@elastic/eui';
import { SavedObjectSaveModal } from '../legacy_imports';
import { SavedObjectSaveModal } from '../../legacy_imports';
interface SaveOptions {
newTitle: string;

View file

@ -18,7 +18,7 @@
*/
import { ViewMode } from 'src/plugins/embeddable/public';
import { AppState } from './legacy_imports';
import { AppState } from '../legacy_imports';
import {
RawSavedDashboardPanelTo60,
RawSavedDashboardPanel610,
@ -26,8 +26,8 @@ import {
RawSavedDashboardPanel630,
RawSavedDashboardPanel640To720,
RawSavedDashboardPanel730ToLatest,
} from './migrations/types';
import { Query, esFilters } from '../../../../../plugins/data/public';
} from '../migrations/types';
import { Query, esFilters } from '../../../../../../plugins/data/public';
export type NavAction = (anchorElement?: any) => void;

View file

@ -26,14 +26,14 @@ import {
SavedObjectsClientContract,
} from 'kibana/public';
import { i18n } from '@kbn/i18n';
import { RenderDeps } from './application';
import { RenderDeps } from './np_ready/application';
import { DataStart } from '../../../data/public';
import { DataPublicPluginStart as NpDataStart } from '../../../../../plugins/data/public';
import { IEmbeddableStart } from '../../../../../plugins/embeddable/public';
import { Storage } from '../../../../../plugins/kibana_utils/public';
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public';
import { DashboardConstants } from './dashboard_constants';
import { SharePluginStart } from '../../../../../plugins/share/public';
import { DashboardConstants } from './np_ready/dashboard_constants';
import {
HomePublicPluginSetup,
FeatureCatalogueCategory,
@ -105,7 +105,7 @@ export class DashboardPlugin implements Plugin {
dashboardCapabilities: contextCore.application.capabilities.dashboard,
localStorage: new Storage(localStorage),
};
const { renderApp } = await import('./application');
const { renderApp } = await import('./np_ready/application');
return renderApp(params.element, params.appBasePath, deps);
},
};

View file

@ -20,9 +20,9 @@ import { SearchSourceContract } from 'ui/courier';
import { SavedObject, SavedObjectKibanaServices } from 'ui/saved_objects/types';
import { createSavedObjectClass } from 'ui/saved_objects/saved_object';
import { extractReferences, injectReferences } from './saved_dashboard_references';
import { createDashboardEditUrl } from '../dashboard_constants';
import { esFilters, Query, RefreshInterval } from '../../../../../../plugins/data/public';
import { createDashboardEditUrl } from '..';
export interface SavedObjectDashboard extends SavedObject {
id?: string;

View file

@ -20,7 +20,7 @@
import _ from 'lodash';
import { pluginInstance } from 'plugins/kibana/discover/index';
import ngMock from 'ng_mock';
import { fieldCalculator } from '../../components/field_chooser/lib/field_calculator';
import { fieldCalculator } from '../../np_ready/components/field_chooser/lib/field_calculator';
import expect from '@kbn/expect';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

View file

@ -20,7 +20,7 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { getSort } from '../../lib/get_sort';
import { getSort } from '../../../np_ready/angular/doc_table/lib/get_sort';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
const defaultSort = [{ time: 'desc' }];

View file

@ -20,8 +20,8 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { createStateStub } from './_utils';
import { getQueryParameterActions } from '../actions';
import { createIndexPatternsStub } from '../../api/__tests__/_stubs';
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 { npStart } from 'ui/new_platform';

View file

@ -21,7 +21,7 @@ import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { pluginInstance } from 'plugins/kibana/discover/index';
import { createStateStub } from './_utils';
import { getQueryParameterActions } from '../actions';
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
describe('context app', function() {
beforeEach(() => pluginInstance.initializeInnerAngular());

View file

@ -22,7 +22,7 @@ import ngMock from 'ng_mock';
import { pluginInstance } from 'plugins/kibana/discover/index';
import { createStateStub } from './_utils';
import { getQueryParameterActions } from '../actions';
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
describe('context app', function() {
beforeEach(() => pluginInstance.initializeInnerAngular());

View file

@ -22,7 +22,7 @@ import ngMock from 'ng_mock';
import { pluginInstance } from 'plugins/kibana/discover/index';
import { createStateStub } from './_utils';
import { getQueryParameterActions } from '../actions';
import { getQueryParameterActions } from '../../np_ready/angular/context/query_parameters/actions';
describe('context app', function() {
beforeEach(() => pluginInstance.initializeInnerAngular());

View file

@ -1,26 +1,2 @@
// Discover plugin styles
@import 'mixins';
// Prefix all styles with "dsc" to avoid conflicts.
// Examples
// dscTable
// dscTable__footer
// monChart__legend--small
// monChart__legend-isLoading
@import 'components/fetch_error/index';
@import 'components/field_chooser/index';
@import 'angular/directives/index';
@import 'angular/doc_table/index';
@import 'hacks';
@import 'discover';
@import 'embeddable/index';
// Doc Viewer
@import 'components/doc_viewer/index';
// Context styles
@import 'angular/context/index';
@import 'np_ready/index';

View file

@ -1,2 +0,0 @@
@import './doc_table';
@import './components/index';

View file

@ -1,2 +0,0 @@
@import './table_header';
@import './table_row/index';

View file

@ -1,3 +0,0 @@
@import './cell';
@import './details';
@import './open';

View file

@ -26,14 +26,13 @@ import {
} from 'kibana/public';
import * as docViewsRegistry from 'ui/registry/doc_views';
import { FilterManager, TimefilterContract, IndexPatternsContract } from 'src/plugins/data/public';
import { createSavedSearchesService } from './saved_searches';
// @ts-ignore
import { createSavedSearchesService } from '../saved_searches';
// @ts-ignore
import { DiscoverStartPlugins } from '../plugin';
import { DataStart } from '../../../../data/public';
import { EuiUtilsStart } from '../../../../../../plugins/eui_utils/public';
import { SavedSearch } from '../types';
import { SharePluginStart } from '../../../../../../plugins/share/public';
import { DiscoverStartPlugins } from './plugin';
import { DataStart } from '../../../data/public';
import { EuiUtilsStart } from '../../../../../plugins/eui_utils/public';
import { SharePluginStart } from '../../../../../plugins/share/public';
import { SavedSearch } from './np_ready/types';
export interface DiscoverServices {
addBasePath: (path: string) => string;

View file

@ -69,24 +69,24 @@ import { configureAppAngularModule } from 'ui/legacy_compat';
import { IndexPatterns } from '../../../../../plugins/data/public';
import { Storage } from '../../../../../plugins/kibana_utils/public';
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public';
import { createDocTableDirective } from './angular/doc_table/doc_table';
import { createTableHeaderDirective } from './angular/doc_table/components/table_header';
import { createDocTableDirective } from './np_ready/angular/doc_table/doc_table';
import { createTableHeaderDirective } from './np_ready/angular/doc_table/components/table_header';
import {
createToolBarPagerButtonsDirective,
createToolBarPagerTextDirective,
} from './angular/doc_table/components/pager';
import { createTableRowDirective } from './angular/doc_table/components/table_row';
import { createPagerFactory } from './angular/doc_table/lib/pager/pager_factory';
import { createInfiniteScrollDirective } from './angular/doc_table/infinite_scroll';
import { createDocViewerDirective } from './angular/doc_viewer';
import { createFieldSearchDirective } from './components/field_chooser/discover_field_search_directive';
import { createIndexPatternSelectDirective } from './components/field_chooser/discover_index_pattern_directive';
import { createStringFieldProgressBarDirective } from './components/field_chooser/string_progress_bar';
} from './np_ready/angular/doc_table/components/pager';
import { createTableRowDirective } from './np_ready/angular/doc_table/components/table_row';
import { createPagerFactory } from './np_ready/angular/doc_table/lib/pager/pager_factory';
import { createInfiniteScrollDirective } from './np_ready/angular/doc_table/infinite_scroll';
import { createDocViewerDirective } from './np_ready/angular/doc_viewer';
import { createFieldSearchDirective } from './np_ready/components/field_chooser/discover_field_search_directive';
import { createIndexPatternSelectDirective } from './np_ready/components/field_chooser/discover_index_pattern_directive';
import { createStringFieldProgressBarDirective } from './np_ready/components/field_chooser/string_progress_bar';
// @ts-ignore
import { createFieldChooserDirective } from './components/field_chooser/field_chooser';
import { createFieldChooserDirective } from './np_ready/components/field_chooser/field_chooser';
// @ts-ignore
import { createDiscoverFieldDirective } from './components/field_chooser/discover_field';
import { createDiscoverFieldDirective } from './np_ready/components/field_chooser/discover_field';
import { DiscoverStartPlugins } from './plugin';
/**

View file

@ -17,7 +17,7 @@
* under the License.
*/
import angular from 'angular'; // just used in embeddables and discover controller
import { DiscoverServices } from './helpers/build_services';
import { DiscoverServices } from './build_services';
let angularModule: any = null;
let services: DiscoverServices | null = null;
@ -47,6 +47,10 @@ export function setServices(newServices: any) {
services = newServices;
}
// import directives that
import 'ui/directives/css_truncate';
import 'ui/directives/field_name';
// EXPORT legacy static dependencies, should be migrated when available in a new version;
export { angular };
export { wrapInI18nContext } from 'ui/i18n';
@ -59,6 +63,9 @@ export {
hasSearchStategyForIndexPattern,
isDefaultTypeIndexPattern,
SearchSource,
EsQuerySortValue,
SortDirection,
SearchSourceContract,
} from '../../../../ui/public/courier';
// @ts-ignore
export { intervalOptions } from 'ui/agg_types/buckets/_interval_options';
@ -78,6 +85,8 @@ export { tabifyAggResponse } from 'ui/agg_response/tabify';
export { vislibSeriesResponseHandlerProvider } from 'ui/vis/response_handlers/vislib';
export { ensureDefaultIndexPattern } from 'ui/legacy_compat';
export { unhashUrl } from '../../../../../plugins/kibana_utils/public';
// @ts-ignore
export { formatMsg, formatStack } from 'ui/notify/lib/index';
// EXPORT types
export { Vis } from 'ui/vis';
@ -90,3 +99,6 @@ export {
export { ElasticSearchHit } from 'ui/registry/doc_views_types';
export { DocViewRenderProps, DocViewRenderFn } from 'ui/registry/doc_views';
export { Adapters } from 'ui/inspector/types';
export { DocView, DocViewInput } from 'ui/registry/doc_views_types';
export { registerTimefilterWithGlobalStateFactory } from 'ui/timefilter/setup_router';
export { IInjector } from 'ui/chrome';

View file

@ -0,0 +1,15 @@
// Discover plugin styles
@import 'mixins';
@import 'discover';
@import 'hacks';
// Prefix all styles with "dsc" to avoid conflicts.
// Examples
// dscTable
// dscTable__footer
// monChart__legend--small
// monChart__legend-isLoading
@import 'components/index';
@import 'angular/index';
@import 'embeddable/index';

View file

@ -0,0 +1,3 @@
@import 'directives/index';
@import 'doc_table/index';
@import 'context/index';

View file

@ -19,12 +19,12 @@
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
import { getAngularModule, getServices, subscribeWithScope } from './../kibana_services';
import { getAngularModule, getServices, subscribeWithScope } from '../../kibana_services';
import './context_app';
import contextAppRouteTemplate from './context.html';
import { getRootBreadcrumbs } from '../helpers/breadcrumbs';
import { FilterStateManager } from '../../../../data/public/filter/filter_manager';
import { FilterStateManager } from '../../../../../data/public';
const { chrome } = getServices();
const k7Breadcrumbs = $route => {

View file

@ -19,7 +19,7 @@
import sinon from 'sinon';
import moment from 'moment';
import { SearchSource } from '../../../../kibana_services';
import { SearchSource } from '../../../../../kibana_services';
export function createIndexPatternsStub() {
return {

View file

@ -17,14 +17,14 @@
* under the License.
*/
import { IndexPattern, SearchSource } from '../../../kibana_services';
import { IndexPattern, SearchSource } from '../../../../kibana_services';
import { reverseSortDir, SortDirection } from './utils/sorting';
import { extractNanos, convertIsoToMillis } from './utils/date_conversion';
import { fetchHitsInInterval } from './utils/fetch_hits_in_interval';
import { generateIntervals } from './utils/generate_intervals';
import { getEsQuerySearchAfter } from './utils/get_es_query_search_after';
import { getEsQuerySort } from './utils/get_es_query_sort';
import { esFilters, IndexPatternsContract } from '../../../../../../../../plugins/data/public';
import { esFilters, IndexPatternsContract } from '../../../../../../../../../plugins/data/public';
export type SurrDocType = 'successors' | 'predecessors';
export interface EsHitRecord {

View file

@ -20,7 +20,7 @@ import {
EsQuerySortValue,
SortDirection,
SearchSourceContract,
} from '../../../../../../../../ui/public/courier';
} from '../../../../../kibana_services';
import { convertTimeValueToIso } from './date_conversion';
import { EsHitRecordList } from '../context';
import { IntervalValue } from './generate_intervals';

View file

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { SortDirection } from '../../../../../../../../ui/public/courier';
import { SortDirection } from '../../../../../kibana_services';
export type IntervalValue = number | null;

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { EsQuerySortValue, SortDirection } from '../../../../../../../../ui/public/courier/types';
import { EsQuerySortValue, SortDirection } from '../../../../../kibana_services';
/**
* Returns `EsQuerySort` which is used to sort records in the ES query

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { IndexPattern } from '../../../../kibana_services';
import { IndexPattern } from '../../../../../kibana_services';
export enum SortDirection {
asc = 'asc',

View file

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { getAngularModule, wrapInI18nContext } from '../../../../kibana_services';
import { getAngularModule, wrapInI18nContext } from '../../../../../kibana_services';
import { ActionBar } from './action_bar';
getAngularModule().directive('contextActionBar', function(reactDirective: any) {

View file

@ -20,13 +20,13 @@
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { getServices, SearchSource } from '../../../kibana_services';
import { getServices, SearchSource } from '../../../../kibana_services';
import { fetchAnchorProvider } from '../api/anchor';
import { fetchContextProvider } from '../api/context';
import { getQueryParameterActions } from '../query_parameters';
import { FAILURE_REASONS, LOADING_STATUS } from './constants';
import { MarkdownSimple } from '../../../../../../kibana_react/public';
import { MarkdownSimple } from '../../../../../../../kibana_react/public';
export function QueryActionsProvider(Promise) {
const fetchAnchor = fetchAnchorProvider(getServices().indexPatterns, new SearchSource());

Some files were not shown because too many files have changed in this diff Show more