-
Notifications
You must be signed in to change notification settings - Fork 8.1k
/
dashboard_saved_object.ts
107 lines (104 loc) · 3.73 KB
/
dashboard_saved_object.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* 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 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 { ANALYTICS_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server';
import { SavedObjectsType } from '@kbn/core/server';
import { dashboardAttributesSchema as dashboardAttributesSchemaV1 } from '../../common/content_management/v1';
import { dashboardAttributesSchema as dashboardAttributesSchemaV2 } from '../../common/content_management/v2';
import {
createDashboardSavedObjectTypeMigrations,
DashboardSavedObjectTypeMigrationsDeps,
} from './migrations/dashboard_saved_object_migrations';
export const createDashboardSavedObjectType = ({
migrationDeps,
}: {
migrationDeps: DashboardSavedObjectTypeMigrationsDeps;
}): SavedObjectsType => ({
name: 'dashboard',
indexPattern: ANALYTICS_SAVED_OBJECT_INDEX,
hidden: false,
namespaceType: 'multiple-isolated',
convertToMultiNamespaceTypeVersion: '8.0.0',
management: {
icon: 'dashboardApp',
defaultSearchField: 'title',
importableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getInAppUrl(obj) {
return {
path: `/app/dashboards#/view/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'dashboard.show',
};
},
},
modelVersions: {
1: {
changes: [],
schemas: {
forwardCompatibility: dashboardAttributesSchemaV1.extends({}, { unknowns: 'ignore' }),
create: dashboardAttributesSchemaV1,
},
},
2: {
changes: [
{
type: 'mappings_addition',
addedMappings: {
controlGroupInput: {
properties: {
showApplySelections: { type: 'boolean', index: false, doc_values: false },
},
},
},
},
],
schemas: {
forwardCompatibility: dashboardAttributesSchemaV2.extends({}, { unknowns: 'ignore' }),
create: dashboardAttributesSchemaV2,
},
},
},
mappings: {
properties: {
description: { type: 'text' },
hits: { type: 'integer', index: false, doc_values: false },
kibanaSavedObjectMeta: {
properties: { searchSourceJSON: { type: 'text', index: false } },
},
optionsJSON: { type: 'text', index: false },
panelsJSON: { type: 'text', index: false },
refreshInterval: {
properties: {
display: { type: 'keyword', index: false, doc_values: false },
pause: { type: 'boolean', index: false, doc_values: false },
section: { type: 'integer', index: false, doc_values: false },
value: { type: 'integer', index: false, doc_values: false },
},
},
controlGroupInput: {
properties: {
controlStyle: { type: 'keyword', index: false, doc_values: false },
chainingSystem: { type: 'keyword', index: false, doc_values: false },
panelsJSON: { type: 'text', index: false },
showApplySelections: { type: 'boolean', index: false, doc_values: false },
ignoreParentSettingsJSON: { type: 'text', index: false },
},
},
timeFrom: { type: 'keyword', index: false, doc_values: false },
timeRestore: { type: 'boolean', index: false, doc_values: false },
timeTo: { type: 'keyword', index: false, doc_values: false },
title: { type: 'text' },
version: { type: 'integer' },
},
},
schemas: {
'8.9.0': dashboardAttributesSchemaV1,
},
migrations: () => createDashboardSavedObjectTypeMigrations(migrationDeps),
});