Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { watcher } from './plugins/watcher';
import { grokdebugger } from './plugins/grokdebugger';
import { dashboardMode } from './plugins/dashboard_mode';
import { logstash } from './plugins/logstash';
import { beats } from './plugins/beats';
import { beats } from './plugins/beats_management';
import { apm } from './plugins/apm';
import { licenseManagement } from './plugins/license_management';
import { cloud } from './plugins/cloud';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*/

export const PLUGIN = {
ID: 'beats',
ID: 'beats_management',
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function beats(kibana: any) {
},
publicDir: resolve(__dirname, 'public'),
uiExports: {
managementSections: ['plugins/beats'],
managementSections: ['plugins/beats_management'],
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { PageRouter } from './routes';
// TODO use theme provided from parentApp when kibana supports it
import '@elastic/eui/dist/eui_theme_light.css';

async function startApp(libs: any) {
function startApp(libs: any) {
const history = createHashHistory();
libs.framework.registerManagementSection('beats', 'beats', 'Beats Management', BASE_PATH);
libs.framework.registerManagementSection('beats', 'Beats Management', BASE_PATH);
libs.framework.render(<PageRouter history={history} />);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter {
private management: any;
private adapterService: KibanaAdapterServiceProvider;
private rootComponent: React.ReactElement<any> | null = null;
private uiModule: IModule;

constructor(uiModule: IModule, management: any) {
this.adapterService = new KibanaAdapterServiceProvider();
this.management = management;
this.uiModule = uiModule;
this.appState = {};
this.register(uiModule);
}

public setUISettings = (key: string, value: any) => {
Expand All @@ -43,19 +44,24 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter {
this.adapterService.callOrBuffer(() => (this.rootComponent = component));
};

public registerManagementSection(
sectionName: string,
pluginId: string,
displayName: string,
basePath: string
) {
const esSection = this.management.getSection(sectionName);
esSection.register(pluginId, {
public registerManagementSection(pluginId: string, displayName: string, basePath: string) {
const registerSection = () =>
this.management.register(pluginId, {
display: displayName,
order: 30,
});
const getSection = () => this.management.getSection(pluginId);

const section = this.management.hasItem(pluginId) ? getSection() : registerSection();

section.register(pluginId, {
visible: true,
display: displayName,
order: 30,
url: `#/${basePath}`,
});

this.register(this.uiModule);
}

private register = (adapterModule: IModule) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ export interface FrameworkAdapter {
// Insstance vars
appState?: object;
kbnVersion?: string;
registerManagementSection(
sectionName: string,
pluginId: string,
displayName: string,
basePath: string
): void;
registerManagementSection(pluginId: string, displayName: string, basePath: string): void;

// Methods
setUISettings(key: string, value: any): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

// @ts-ignore
import { createEsTestCluster } from '@kbn/test';
import { config as beatsPluginConfig, configPrefix } from '../../../../..';
// @ts-ignore
import * as kbnTestServer from '../../../../../../../../src/test_utils/kbn_server';
import { config as beatsPluginConfig, configPrefix } from '../../../../../index';
import { KibanaBackendFrameworkAdapter } from '../kibana_framework_adapter';
import { contractTests } from './test_contract';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { get } from 'lodash';
import { INDEX_NAMES } from '../../../../common/constants';
import { FrameworkUser } from './../framework/adapter_types';
import { FrameworkUser } from '../framework/adapter_types';

import { BeatTag } from '../../../../common/domain_types';
import { DatabaseAdapter } from '../database/adapter_types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { BeatsTagAssignment, CMBeatsAdapter } from '../adapters/beats/adapter_ty
import { FrameworkUser } from '../adapters/framework/adapter_types';

import { CMAssignmentReturn } from '../adapters/beats/adapter_types';
import { BeatsRemovalReturn } from '../adapters/beats/adapter_types';
import { BeatEnrollmentStatus, CMDomainLibs } from '../lib';
import { BeatsRemovalReturn } from './../adapters/beats/adapter_types';

export class CMBeatsDomain {
private adapter: CMBeatsAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { UNIQUENESS_ENFORCING_TYPES } from '../../../common/constants';
import { ConfigurationBlock } from '../../../common/domain_types';
import { FrameworkUser } from '../adapters/framework/adapter_types';

import { entries } from '../../utils/polyfills';
import { CMTagsAdapter } from '../adapters/tags/adapter_types';
import { entries } from './../../utils/polyfills';

export class CMTagsDomain {
private adapter: CMTagsAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { sign as signToken, verify as verifyToken } from 'jsonwebtoken';
import moment from 'moment';
import uuid from 'uuid';
import { BackendFrameworkAdapter } from '../adapters/framework/adapter_types';
import { FrameworkUser } from '../adapters/framework/adapter_types';
import { CMTokensAdapter } from '../adapters/tokens/adapter_types';
import { FrameworkUser } from './../adapters/framework/adapter_types';

const RANDOM_TOKEN_1 = 'b48c4bda384a40cb91c6eb9b8849e77f';
const RANDOM_TOKEN_2 = '80a3819e3cd64f4399f1d4886be7a08b';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Joi from 'joi';
import { omit } from 'lodash';
import { FrameworkRequest } from '../../lib/adapters/framework/adapter_types';
import { CMServerLibs } from '../../lib/lib';
import { BeatEnrollmentStatus } from '../../lib/lib';
import { wrapEsError } from '../../utils/error_wrappers';
import { BeatEnrollmentStatus } from './../../lib/lib';

// TODO: add license check pre-hook
// TODO: write to Kibana audit log file
Expand Down