-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
Copy pathindex.js
82 lines (75 loc) · 2.37 KB
/
index.js
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
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { resolve } from 'path';
import { i18n } from '@kbn/i18n';
import migrations from './migrations';
import { initServer } from './server';
import mappings from './mappings.json';
export function graph(kibana) {
return new kibana.Plugin({
id: 'graph',
configPrefix: 'xpack.graph',
publicDir: resolve(__dirname, 'public'),
require: ['kibana', 'elasticsearch', 'xpack_main'],
uiExports: {
app: {
title: 'Graph',
order: 9000,
icon: 'plugins/graph/icon.png',
euiIconType: 'graphApp',
main: 'plugins/graph/app',
},
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
hacks: ['plugins/graph/hacks/toggle_app_link_in_nav'],
home: ['plugins/graph/register_feature'],
mappings,
migrations,
},
config(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
canEditDrillDownUrls: Joi.boolean().default(true),
savePolicy: Joi.string().valid(['config', 'configAndDataWithConsent', 'configAndData', 'none']).default('configAndData'),
}).default();
},
init(server) {
server.injectUiAppVars('graph', () => {
const config = server.config();
return {
graphSavePolicy: config.get('xpack.graph.savePolicy'),
canEditDrillDownUrls: config.get('xpack.graph.canEditDrillDownUrls')
};
});
server.plugins.xpack_main.registerFeature({
id: 'graph',
name: i18n.translate('xpack.graph.featureRegistry.graphFeatureName', {
defaultMessage: 'Graph',
}),
icon: 'graphApp',
navLinkId: 'graph',
app: ['graph', 'kibana'],
catalogue: ['graph'],
privileges: {
all: {
savedObject: {
all: ['graph-workspace'],
read: ['config', 'index-pattern'],
},
ui: ['save', 'delete'],
},
read: {
savedObject: {
all: [],
read: ['config', 'index-pattern', 'graph-workspace'],
},
ui: [],
}
}
});
initServer(server);
},
});
}