-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathhealth_metric_vis.js
54 lines (50 loc) · 1.73 KB
/
health_metric_vis.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
import 'plugins/health_metric_vis/health_metric_vis.less';
import 'plugins/health_metric_vis/health_metric_vis_controller';
import VisVisTypeProvider from 'ui/vis/vis_type';
import TemplateVisTypeTemplateVisTypeProvider from 'ui/template_vis_type/template_vis_type';
import VisSchemasProvider from 'ui/vis/schemas';
import image from './images/icon-colored-number.svg'
require('ui/registry/vis_types').register(HealthMetricVisProvider);
function HealthMetricVisProvider(Private) {
const VisType = Private(VisVisTypeProvider);
const TemplateVisType = Private(TemplateVisTypeTemplateVisTypeProvider);
const Schemas = Private(VisSchemasProvider);
// return the visType object, which kibana will use to display and configure new
// Vis object of this type.
return new TemplateVisType({
name: 'health-metric',
title: 'Health Metric',
description: 'A numeric health metric, can show a number and color it accordingly.',
image,
template: require('plugins/health_metric_vis/health_metric_vis.html'),
category: VisType.CATEGORY.DATA,
params: {
defaults: {
handleNoResults: true,
fontSize: 60,
invertScale: false,
redThreshold: 0,
greenThreshold: 0,
redColor: "#fd482f",
yellowColor: "#ffa500",
greenColor: "#6dc066"
},
editor: require('plugins/health_metric_vis/health_metric_vis_params.html')
},
implementsRenderComplete: true,
schemas: new Schemas([
{
group: 'metrics',
name: 'metric',
title: 'Metric',
min: 1,
max: 1,
aggFilter: ['!derivative'],
defaults: [
{ type: 'count', schema: 'metric' }
]
}
])
});
}
export default HealthMetricVisProvider;