Skip to content
Closed
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
3 changes: 2 additions & 1 deletion src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export {
SafeRouteMethod,
} from './http';
export { RenderingServiceSetup, IRenderOptions } from './rendering';
export { Logger, LoggerFactory, LogMeta, LogRecord, LogLevel } from './logging';
export { Logger, LoggerFactory, LogMeta, LogRecord, LogLevel, loggerMock } from './logging';

export {
DiscoveredPlugin,
Expand Down Expand Up @@ -220,6 +220,7 @@ export {
SavedObjectsMigrationLogger,
SavedObjectsRawDoc,
SavedObjectSanitizedDoc,
SavedObjectUnsanitizedDoc,
SavedObjectsRepositoryFactory,
SavedObjectsResolveImportErrorsOptions,
SavedObjectsSchema,
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/logging/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export { Logger, LogMeta } from './logger';
export { LoggerFactory } from './logger_factory';
export { LogRecord } from './log_record';
export { LogLevel } from './log_level';
export { loggerMock } from './logger.mock';

/** @internal */
export { config, LoggingConfigType } from './logging_config';
/** @internal */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ describe('DocumentMigrator', () => {
migrations: {
'1.2.3': (doc, { log }) => {
log.info(logTestMsg);
log.warning(logTestMsg);
log.warn(logTestMsg);
return doc;
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function handleIndexExists(error: any, log: SavedObjectsMigrationLogger) {

const index = _.get(error, 'body.error.index');

log.warning(
log.warn(
`Another Kibana instance appears to be migrating the index. Waiting for ` +
`that migration to complete. If no other Kibana instance is attempting ` +
`migrations, you can get past this message by deleting index ${index} and ` +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface SavedObjectsMigrationLogger {
/**
* @deprecated Use `warn` instead.
*/
warning: (msg: string) => void;
warning?: (msg: string) => void;
warn: (msg: string) => void;
}

Expand Down
20 changes: 0 additions & 20 deletions src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { migrations } from './migrations';
import { importApi } from './server/routes/api/import';
import { exportApi } from './server/routes/api/export';
import mappings from './mappings.json';
Expand Down Expand Up @@ -124,23 +123,6 @@ export default function(kibana) {
],

savedObjectsManagement: {
dashboard: {
icon: 'dashboardApp',
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/kibana/objects/savedDashboards/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
path: `/app/kibana#/dashboard/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'dashboard.show',
};
},
},
url: {
defaultSearchField: 'url',
isImportableAndExportable: true,
Expand Down Expand Up @@ -181,8 +163,6 @@ export default function(kibana) {

mappings,
uiSettingDefaults: getUiSettingDefaults(),

migrations,
},

uiCapabilities: async function() {
Expand Down
54 changes: 0 additions & 54 deletions src/legacy/core_plugins/kibana/mappings.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,4 @@
{
"dashboard": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"url": {
"properties": {
"accessCount": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
DEFAULT_PANEL_HEIGHT,
SavedDashboardPanelTo60,
SavedDashboardPanel730ToLatest,
} from '../../../../../../plugins/dashboard/public';
} from '../public';

test('6.0 migrates uiState, sort, scales, and gridData', async () => {
const uiState = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
SavedDashboardPanel620,
SavedDashboardPanel630,
SavedDashboardPanel610,
} from '../../../../../../plugins/dashboard/public';
} from '../public';

const PANEL_HEIGHT_SCALE_FACTOR = 5;
const PANEL_HEIGHT_SCALE_FACTOR_WITH_MARGINS = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
SavedDashboardPanel,
} from '../../types';
// should be moved in src/plugins/dashboard/common right after https://github.com/elastic/kibana/pull/61895 is merged
import { migratePanelsTo730 } from '../../../../../legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels';
import { migratePanelsTo730 } from '../../../common/migrate_to_730_panels';

/**
* Attempts to migrate the state stored in the URL into the latest version of it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
* under the License.
*/

import { Doc } from './types';
import { PluginInitializerContext } from '../../../core/server';
import { DashboardsPlugin } from './plugin';

export function isDoc(doc: { [key: string]: unknown } | Doc): doc is Doc {
return (
typeof doc.id === 'string' &&
typeof doc.type === 'string' &&
doc.attributes !== null &&
typeof doc.attributes === 'object' &&
doc.references !== null &&
typeof doc.references === 'object'
);
// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.

export function plugin(initializerContext: PluginInitializerContext) {
return new DashboardsPlugin(initializerContext);
}

export { DashboardsPluginSetup, DashboardsPluginStart } from './types';
53 changes: 53 additions & 0 deletions src/plugins/dashboard/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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,
CoreSetup,
CoreStart,
Plugin,
Logger,
} from '../../../core/server';

import { dashboardSavedObjectType } from './saved_objects';

import { DashboardsPluginSetup, DashboardsPluginStart } from './types';

export class DashboardsPlugin implements Plugin<DashboardsPluginSetup, DashboardsPluginStart> {
private readonly logger: Logger;

constructor(initializerContext: PluginInitializerContext) {
this.logger = initializerContext.logger.get();
}

public setup(core: CoreSetup) {
this.logger.debug('dashboards: Setup');

core.savedObjects.registerType(dashboardSavedObjectType);

return {};
}

public start(core: CoreStart) {
this.logger.debug('dashboards: Started');
return {};
}

public stop() {}
}
39 changes: 39 additions & 0 deletions src/plugins/dashboard/server/saved_objects/dashboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 { SavedObjectsType } from 'kibana/server';
import { dashboardSavedObjectTypeMigrations } from './dashboard_migrations';

export const dashboardSavedObjectType: SavedObjectsType = {
name: 'dashboard',
hidden: false,
namespaceAgnostic: false,
mappings: {
properties: {
description: { type: 'text' },
kibanaSavedObjectMeta: { properties: { searchSourceJSON: { type: 'text' } } },
savedSearchRefName: { type: 'keyword' },
title: { type: 'text' },
uiStateJSON: { type: 'text' },
version: { type: 'integer' },
visState: { type: 'text' },
},
},
migrations: dashboardSavedObjectTypeMigrations,
};
Loading