Skip to content

Commit

Permalink
Index pattern management plugin - src/legacy/core_plugins/management …
Browse files Browse the repository at this point in the history
…=> new platform plugin (elastic#62594) (elastic#63019)

* implement index pattern management plugin in new platform
  • Loading branch information
mattkime authored Apr 8, 2020
1 parent 6d5c6d1 commit 8cd9059
Show file tree
Hide file tree
Showing 44 changed files with 183 additions and 296 deletions.
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"src/legacy/core_plugins/management",
"src/plugins/management"
],
"indexPatternManagement": "src/plugins/index_pattern_management",
"advancedSettings": "src/plugins/advanced_settings",
"kibana_legacy": "src/plugins/kibana_legacy",
"kibana_react": "src/legacy/core_plugins/kibana_react",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
* under the License.
*/

export * from './index_pattern_management';
export {
ProcessedImportResponse,
processImportResponse,
} from './management/sections/objects/lib/process_import_response';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React from 'react';
import { StepIndexPattern } from '../step_index_pattern';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
import { Header } from './components/header';
import { IndexPatternCreationConfig } from '../../../../../../../../management/public';
import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public';
import { coreMock } from '../../../../../../../../../../core/public/mocks';
import { dataPluginMock } from '../../../../../../../../../../plugins/data/public/mocks';
import { SavedObjectsFindResponsePublic } from '../../../../../../../../../../core/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { LoadingIndices } from './components/loading_indices';
import { StatusMessage } from './components/status_message';
import { IndicesList } from './components/indices_list';
import { Header } from './components/header';
import { IndexPatternCreationConfig } from '../../../../../../../../management/public';
import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public';
import { MatchedIndex } from '../../types';

interface StepIndexPatternProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
import { IndexPatternCreationConfig } from '../../../../../../../../management/public';
import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public';
import { IFieldType } from '../../../../../../../../../../plugins/data/public';

import { StepTimeField } from '../step_time_field';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Header } from './components/header';
import { TimeField } from './components/time_field';
import { AdvancedOptions } from './components/advanced_options';
import { ActionButtons } from './components/action_buttons';
import { IndexPatternCreationConfig } from '../../../../../../../../management/public';
import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public';
import { DataPublicPluginStart } from '../../../../../../../../../../plugins/data/public';

interface StepTimeFieldProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import uiRoutes from 'ui/routes';
import angularTemplate from './angular_template.html';
import { npStart } from 'ui/new_platform';
import { setup as managementSetup } from '../../../../../../management/public/legacy';
import { getCreateBreadcrumbs } from '../breadcrumbs';

import { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } from './render';
Expand All @@ -33,7 +32,7 @@ uiRoutes.when('/management/kibana/index_pattern', {
const kbnUrl = $injector.get('kbnUrl');
$scope.$$postDigest(() => {
const $routeParams = $injector.get('$routeParams');
const indexPatternCreationType = managementSetup.indexPattern.creation.getType(
const indexPatternCreationType = npStart.plugins.indexPatternManagement.creation.getType(
$routeParams.type
);
const services = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { getIndices } from './get_indices';
import { IndexPatternCreationConfig } from './../../../../../../../management/public';
import { IndexPatternCreationConfig } from '../../../../../../../../../plugins/index_pattern_management/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { LegacyApiCaller } from '../../../../../../../../../plugins/data/public/search';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { get, sortBy } from 'lodash';
import { IndexPatternCreationConfig } from '../../../../../../../management/public';
import { IndexPatternCreationConfig } from '../../../../../../../../../plugins/index_pattern_management/public';
import { DataPublicPluginStart } from '../../../../../../../../../plugins/data/public';
import { MatchedIndex } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { uiModules } from 'ui/modules';
import template from './edit_index_pattern.html';
import { fieldWildcardMatcher } from '../../../../../../../../plugins/kibana_utils/public';
import { subscribeWithScope } from '../../../../../../../../plugins/kibana_legacy/public';
import { setup as managementSetup } from '../../../../../../management/public/legacy';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { SourceFiltersTable } from './source_filters_table';
Expand Down Expand Up @@ -239,14 +238,12 @@ uiModules
$scope.editSectionsProvider = Private(IndicesEditSectionsProvider);
$scope.kbnUrl = Private(KbnUrlProvider);
$scope.indexPattern = $route.current.locals.indexPattern;
$scope.indexPatternListProvider = managementSetup.indexPattern.list;
$scope.indexPattern.tags = managementSetup.indexPattern.list.getIndexPatternTags(
$scope.indexPatternListProvider = npStart.plugins.indexPatternManagement.list;
$scope.indexPattern.tags = npStart.plugins.indexPatternManagement.list.getIndexPatternTags(
$scope.indexPattern,
$scope.indexPattern.id === config.get('defaultIndex')
);
$scope.getFieldInfo = managementSetup.indexPattern.list.getFieldInfo.bind(
managementSetup.indexPattern.list
);
$scope.getFieldInfo = npStart.plugins.indexPatternManagement.list.getFieldInfo;
docTitle.change($scope.indexPattern.title);

const otherPatterns = _.filter($route.current.locals.indexPatterns, pattern => {
Expand All @@ -257,7 +254,7 @@ uiModules
$scope.editSections = $scope.editSectionsProvider(
$scope.indexPattern,
$scope.fieldFilter,
managementSetup.indexPattern.list
npStart.plugins.indexPatternManagement.list
);
$scope.refreshFilters();
$scope.fields = $scope.indexPattern.getNonScriptedFields();
Expand Down Expand Up @@ -375,7 +372,7 @@ uiModules
$scope.editSections = $scope.editSectionsProvider(
$scope.indexPattern,
$scope.fieldFilter,
managementSetup.indexPattern.list
npStart.plugins.indexPatternManagement.list
);

if ($scope.fieldFilter === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import { management } from 'ui/management';
import { setup as managementSetup } from '../../../../../management/public/legacy';
import './create_index_pattern_wizard';
import './edit_index_pattern';
import uiRoutes from 'ui/routes';
Expand Down Expand Up @@ -111,7 +110,7 @@ uiModules
transclude: true,
template: indexTemplate,
link: async function($scope) {
const indexPatternCreationOptions = await managementSetup.indexPattern.creation.getIndexPatternCreationOptions(
const indexPatternCreationOptions = await npStart.plugins.indexPatternManagement.creation.getIndexPatternCreationOptions(
url => {
$scope.$evalAsync(() => kbnUrl.change(url));
}
Expand All @@ -124,7 +123,7 @@ uiModules
const id = pattern.id;
const title = pattern.get('title');
const isDefault = $scope.defaultIndex === id;
const tags = managementSetup.indexPattern.list.getIndexPatternTags(
const tags = npStart.plugins.indexPatternManagement.list.getIndexPatternTags(
pattern,
isDefault
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
import { mockManagementPlugin } from '../../../../../../../../management/public/np_ready/mocks';
import { mockManagementPlugin } from '../../../../../../../../../../plugins/index_pattern_management/public/mocks';
import { Query } from '@elastic/eui';

import { ObjectsTable, POSSIBLE_TYPES } from '../objects_table';
Expand All @@ -30,7 +30,7 @@ import { extractExportDetails } from '../../../lib/extract_export_details';

jest.mock('ui/kfetch', () => ({ kfetch: jest.fn() }));

jest.mock('../../../../../../../../management/public/legacy', () => ({
jest.mock('../../../../../../../../../../plugins/index_pattern_management/public', () => ({
setup: mockManagementPlugin.createSetupContract(),
start: mockManagementPlugin.createStartContract(),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
import { mockManagementPlugin } from '../../../../../../../../../../management/public/np_ready/mocks';
import { mockManagementPlugin } from '../../../../../../../../../../../../plugins/index_pattern_management/public/mocks';
import { Flyout } from '../flyout';

jest.mock('ui/kfetch', () => ({ kfetch: jest.fn() }));
Expand Down Expand Up @@ -48,7 +48,7 @@ jest.mock('../../../../../lib/resolve_saved_objects', () => ({
saveObjects: jest.fn(),
}));

jest.mock('../../../../../../../../../../management/public/legacy', () => ({
jest.mock('../../../../../../../../../../../../plugins/index_pattern_management/public', () => ({
setup: mockManagementPlugin.createSetupContract(),
start: mockManagementPlugin.createStartContract(),
}));
Expand Down
37 changes: 0 additions & 37 deletions src/legacy/core_plugins/management/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/legacy/core_plugins/management/package.json

This file was deleted.

38 changes: 0 additions & 38 deletions src/legacy/core_plugins/management/public/index.ts

This file was deleted.

45 changes: 0 additions & 45 deletions src/legacy/core_plugins/management/public/legacy.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/legacy/ui/public/new_platform/new_platform.karma_mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ export const npSetup = {
}),
},
},
indexPatternManagement: {
list: { addListConfig: sinon.fake() },
creation: { addCreationConfig: sinon.fake() },
},
discover: {
docViews: {
addDocView: sinon.fake(),
Expand Down Expand Up @@ -325,6 +329,17 @@ export const npStart = {
}),
},
},
indexPatternManagement: {
list: {
getType: sinon.fake(),
getIndexPatternCreationOptions: sinon.fake(),
},
creation: {
getIndexPatternTags: sinon.fake(),
getFieldInfo: sinon.fake(),
areScriptedFieldsEnabled: sinon.fake(),
},
},
embeddable: {
getEmbeddableFactory: sinon.fake(),
getEmbeddableFactories: sinon.fake(),
Expand Down
6 changes: 6 additions & 0 deletions src/legacy/ui/public/new_platform/new_platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ import {
AdvancedSettingsStart,
} from '../../../../plugins/advanced_settings/public';
import { ManagementSetup, ManagementStart } from '../../../../plugins/management/public';
import {
IndexPatternManagementSetup,
IndexPatternManagementStart,
} from '../../../../plugins/index_pattern_management/public';
import { BfetchPublicSetup, BfetchPublicStart } from '../../../../plugins/bfetch/public';
import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public';
import { TelemetryPluginSetup, TelemetryPluginStart } from '../../../../plugins/telemetry/public';
Expand Down Expand Up @@ -86,6 +90,7 @@ export interface PluginsSetup {
visualizations: VisualizationsSetup;
telemetry?: TelemetryPluginSetup;
savedObjectsManagement: SavedObjectsManagementPluginSetup;
indexPatternManagement: IndexPatternManagementSetup;
}

export interface PluginsStart {
Expand All @@ -107,6 +112,7 @@ export interface PluginsStart {
telemetry?: TelemetryPluginStart;
dashboard: DashboardStart;
savedObjectsManagement: SavedObjectsManagementPluginStart;
indexPatternManagement: IndexPatternManagementStart;
}

export const npSetup = {
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/index_pattern_management/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "indexPatternManagement",
"version": "kibana",
"server": false,
"ui": true,
"requiredPlugins": []
}
Loading

0 comments on commit 8cd9059

Please sign in to comment.