Skip to content

Commit 78d28b5

Browse files
author
Tyler Smalley
committed
[Dashboard] Moves migrations to new platform
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
1 parent 3d41ca6 commit 78d28b5

25 files changed

+265
-205
lines changed

src/core/server/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export {
176176
SafeRouteMethod,
177177
} from './http';
178178
export { RenderingServiceSetup, IRenderOptions } from './rendering';
179-
export { Logger, LoggerFactory, LogMeta, LogRecord, LogLevel } from './logging';
179+
export { Logger, LoggerFactory, LogMeta, LogRecord, LogLevel, loggerMock } from './logging';
180180

181181
export {
182182
DiscoveredPlugin,
@@ -220,6 +220,7 @@ export {
220220
SavedObjectsMigrationLogger,
221221
SavedObjectsRawDoc,
222222
SavedObjectSanitizedDoc,
223+
SavedObjectUnsanitizedDoc,
223224
SavedObjectsRepositoryFactory,
224225
SavedObjectsResolveImportErrorsOptions,
225226
SavedObjectsSchema,

src/core/server/logging/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export { Logger, LogMeta } from './logger';
2121
export { LoggerFactory } from './logger_factory';
2222
export { LogRecord } from './log_record';
2323
export { LogLevel } from './log_level';
24+
export { loggerMock } from './logger.mock';
25+
2426
/** @internal */
2527
export { config, LoggingConfigType } from './logging_config';
2628
/** @internal */

src/core/server/saved_objects/migrations/core/document_migrator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ describe('DocumentMigrator', () => {
587587
migrations: {
588588
'1.2.3': (doc, { log }) => {
589589
log.info(logTestMsg);
590-
log.warning(logTestMsg);
590+
log.warn(logTestMsg);
591591
return doc;
592592
},
593593
},

src/core/server/saved_objects/migrations/core/migration_coordinator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function handleIndexExists(error: any, log: SavedObjectsMigrationLogger) {
9797

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

100-
log.warning(
100+
log.warn(
101101
`Another Kibana instance appears to be migrating the index. Waiting for ` +
102102
`that migration to complete. If no other Kibana instance is attempting ` +
103103
`migrations, you can get past this message by deleting index ${index} and ` +

src/core/server/saved_objects/migrations/core/migration_logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface SavedObjectsMigrationLogger {
3333
/**
3434
* @deprecated Use `warn` instead.
3535
*/
36-
warning: (msg: string) => void;
36+
warning?: (msg: string) => void;
3737
warn: (msg: string) => void;
3838
}
3939

src/legacy/core_plugins/kibana/index.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Fs from 'fs';
2121
import { resolve } from 'path';
2222
import { promisify } from 'util';
2323

24-
import { migrations } from './migrations';
2524
import { importApi } from './server/routes/api/import';
2625
import { exportApi } from './server/routes/api/export';
2726
import mappings from './mappings.json';
@@ -124,23 +123,6 @@ export default function(kibana) {
124123
],
125124

126125
savedObjectsManagement: {
127-
dashboard: {
128-
icon: 'dashboardApp',
129-
defaultSearchField: 'title',
130-
isImportableAndExportable: true,
131-
getTitle(obj) {
132-
return obj.attributes.title;
133-
},
134-
getEditUrl(obj) {
135-
return `/management/kibana/objects/savedDashboards/${encodeURIComponent(obj.id)}`;
136-
},
137-
getInAppUrl(obj) {
138-
return {
139-
path: `/app/kibana#/dashboard/${encodeURIComponent(obj.id)}`,
140-
uiCapabilitiesPath: 'dashboard.show',
141-
};
142-
},
143-
},
144126
url: {
145127
defaultSearchField: 'url',
146128
isImportableAndExportable: true,
@@ -181,8 +163,6 @@ export default function(kibana) {
181163

182164
mappings,
183165
uiSettingDefaults: getUiSettingDefaults(),
184-
185-
migrations,
186166
},
187167

188168
uiCapabilities: async function() {

src/legacy/core_plugins/kibana/mappings.json

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,4 @@
11
{
2-
"dashboard": {
3-
"properties": {
4-
"description": {
5-
"type": "text"
6-
},
7-
"hits": {
8-
"type": "integer"
9-
},
10-
"kibanaSavedObjectMeta": {
11-
"properties": {
12-
"searchSourceJSON": {
13-
"type": "text"
14-
}
15-
}
16-
},
17-
"optionsJSON": {
18-
"type": "text"
19-
},
20-
"panelsJSON": {
21-
"type": "text"
22-
},
23-
"refreshInterval": {
24-
"properties": {
25-
"display": {
26-
"type": "keyword"
27-
},
28-
"pause": {
29-
"type": "boolean"
30-
},
31-
"section": {
32-
"type": "integer"
33-
},
34-
"value": {
35-
"type": "integer"
36-
}
37-
}
38-
},
39-
"timeFrom": {
40-
"type": "keyword"
41-
},
42-
"timeRestore": {
43-
"type": "boolean"
44-
},
45-
"timeTo": {
46-
"type": "keyword"
47-
},
48-
"title": {
49-
"type": "text"
50-
},
51-
"version": {
52-
"type": "integer"
53-
}
54-
}
55-
},
562
"url": {
573
"properties": {
584
"accessCount": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
DEFAULT_PANEL_HEIGHT,
2828
SavedDashboardPanelTo60,
2929
SavedDashboardPanel730ToLatest,
30-
} from '../../../../../../plugins/dashboard/public';
30+
} from '../public';
3131

3232
test('6.0 migrates uiState, sort, scales, and gridData', async () => {
3333
const uiState = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
SavedDashboardPanel620,
3232
SavedDashboardPanel630,
3333
SavedDashboardPanel610,
34-
} from '../../../../../../plugins/dashboard/public';
34+
} from '../public';
3535

3636
const PANEL_HEIGHT_SCALE_FACTOR = 5;
3737
const PANEL_HEIGHT_SCALE_FACTOR_WITH_MARGINS = 4;

src/plugins/dashboard/public/application/lib/migrate_app_state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
SavedDashboardPanel,
3434
} from '../../types';
3535
// should be moved in src/plugins/dashboard/common right after https://github.com/elastic/kibana/pull/61895 is merged
36-
import { migratePanelsTo730 } from '../../../../../legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels';
36+
import { migratePanelsTo730 } from '../../../common/migrate_to_730_panels';
3737

3838
/**
3939
* Attempts to migrate the state stored in the URL into the latest version of it.

0 commit comments

Comments
 (0)