Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Index Patterns] Move rollup config to index pattern management #102145

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/plugins/index_pattern_management/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ import {
} from './plugin';
import { IndexPatternManagmentContext } from './types';

const createSetupContract = (): IndexPatternManagementSetup => ({
creation: {
addCreationConfig: jest.fn(),
} as any,
list: {
addListConfig: jest.fn(),
} as any,
});
const createSetupContract = (): IndexPatternManagementSetup => {};

const createStartContract = (): IndexPatternManagementStart => ({
creation: {
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/index_pattern_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ export class IndexPatternManagementPlugin
},
});

return this.indexPatternManagementService.setup({ httpClient: core.http });
return this.indexPatternManagementService.setup({
httpClient: core.http,
uiSettings: core.uiSettings,
});
}

public start(core: CoreStart, plugins: IndexPatternManagementStartDependencies) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { RollupPrompt } from './rollup_prompt';
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@

export { IndexPatternCreationConfig, IndexPatternCreationOption } from './config';
export { IndexPatternCreationManager } from './manager';
// @ts-ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollups had two js files that I'd prefer not to convert to typescript at this point. There are plans for rollup improvements that would make these files unnecessary.

export { RollupIndexPatternCreationConfig } from './rollup_creation_config';
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import { i18n } from '@kbn/i18n';

import { RollupPrompt } from './components/rollup_prompt';
import { IndexPatternCreationConfig } from '../../../../../src/plugins/index_pattern_management/public';
import { IndexPatternCreationConfig } from '.';

const rollupIndexPatternTypeName = i18n.translate(
'xpack.rollupJobs.editRollupIndexPattern.createIndex.defaultTypeName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@
* Side Public License, v 1.
*/

import { HttpSetup } from '../../../../core/public';
import { IndexPatternCreationManager, IndexPatternCreationConfig } from './creation';
import { IndexPatternListManager, IndexPatternListConfig } from './list';
import { HttpSetup, CoreSetup } from '../../../../core/public';
import {
IndexPatternCreationManager,
IndexPatternCreationConfig,
RollupIndexPatternCreationConfig,
} from './creation';
import {
IndexPatternListManager,
IndexPatternListConfig,
RollupIndexPatternListConfig,
} from './list';
interface SetupDependencies {
httpClient: HttpSetup;
uiSettings: CoreSetup['uiSettings'];
}

/**
Expand All @@ -27,17 +36,24 @@ export class IndexPatternManagementService {
this.indexPatternListConfig = new IndexPatternListManager();
}

public setup({ httpClient }: SetupDependencies) {
public setup({ httpClient, uiSettings }: SetupDependencies) {
const creationManagerSetup = this.indexPatternCreationManager.setup(httpClient);
creationManagerSetup.addCreationConfig(IndexPatternCreationConfig);

const indexPatternListConfigSetup = this.indexPatternListConfig.setup();
indexPatternListConfigSetup.addListConfig(IndexPatternListConfig);

// todo move to shared plugin
if (uiSettings.get('rollups:enableIndexPatterns')) {
creationManagerSetup.addCreationConfig(RollupIndexPatternCreationConfig);
indexPatternListConfigSetup.addListConfig(RollupIndexPatternListConfig);
}
/*
return {
creation: creationManagerSetup,
list: indexPatternListConfigSetup,
};
*/
}

public start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@

export { IndexPatternListConfig } from './config';
export { IndexPatternListManager } from './manager';
// @ts-ignore
export { RollupIndexPatternListConfig } from './rollup_list_config';
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { IndexPatternListConfig } from '../../../../../src/plugins/index_pattern_management/public';
import { IndexPatternListConfig } from '.';

function isRollup(indexPattern) {
return (
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/rollup/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"server": true,
"ui": true,
"requiredPlugins": [
"indexPatternManagement",
"management",
"licensing",
"features"
Expand Down
14 changes: 4 additions & 10 deletions x-pack/plugins/rollup/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import { rollupBadgeExtension, rollupToggleExtension } from './extend_index_mana
import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config';
// @ts-ignore
import { RollupIndexPatternListConfig } from './index_pattern_list/rollup_index_pattern_list_config';
import { CONFIG_ROLLUPS, UIM_APP_NAME } from '../common';
import { UIM_APP_NAME } from '../common';
import {
FeatureCatalogueCategory,
HomePublicPluginSetup,
} from '../../../../src/plugins/home/public';
import { ManagementSetup } from '../../../../src/plugins/management/public';
import { IndexManagementPluginSetup } from '../../index_management/public';
import { IndexPatternManagementSetup } from '../../../../src/plugins/index_pattern_management/public';
// @ts-ignore
import { setHttp, init as initDocumentation } from './crud_app/services/index';
import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services';
Expand All @@ -29,20 +28,13 @@ export interface RollupPluginSetupDependencies {
home?: HomePublicPluginSetup;
management: ManagementSetup;
indexManagement?: IndexManagementPluginSetup;
indexPatternManagement: IndexPatternManagementSetup;
usageCollection?: UsageCollectionSetup;
}

export class RollupPlugin implements Plugin {
setup(
core: CoreSetup,
{
home,
management,
indexManagement,
indexPatternManagement,
usageCollection,
}: RollupPluginSetupDependencies
{ home, management, indexManagement, usageCollection }: RollupPluginSetupDependencies
) {
setFatalErrors(core.fatalErrors);
if (usageCollection) {
Expand All @@ -54,12 +46,14 @@ export class RollupPlugin implements Plugin {
indexManagement.extensionsService.addToggle(rollupToggleExtension);
}

/*
const isRollupIndexPatternsEnabled = core.uiSettings.get(CONFIG_ROLLUPS);
if (isRollupIndexPatternsEnabled) {
indexPatternManagement.creation.addCreationConfig(RollupIndexPatternCreationConfig);
indexPatternManagement.list.addListConfig(RollupIndexPatternListConfig);
}
*/

if (home) {
home.featureCatalogue.register({
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/rollup/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"references": [
{ "path": "../../../src/core/tsconfig.json" },
// required plugins
{ "path": "../../../src/plugins/index_pattern_management/tsconfig.json" },
{ "path": "../../../src/plugins/management/tsconfig.json" },
{ "path": "../licensing/tsconfig.json" },
{ "path": "../features/tsconfig.json" },
Expand Down