-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathplugin.js
executable file
·87 lines (85 loc) · 2.59 KB
/
plugin.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
83
84
85
86
87
import SummaryWidgetMetadataProvider from './src/telemetry/SummaryWidgetMetadataProvider.js';
import SummaryWidgetTelemetryProvider from './src/telemetry/SummaryWidgetTelemetryProvider.js';
import SummaryWidgetViewProvider from './src/views/SummaryWidgetViewProvider.js';
import SummaryWidgetsCompositionPolicy from './SummaryWidgetsCompositionPolicy.js';
export default function plugin() {
const widgetType = {
name: 'Summary Widget',
description: 'A compact status update for collections of telemetry-producing items',
cssClass: 'icon-summary-widget',
initialize: function (domainObject) {
domainObject.composition = [];
domainObject.configuration = {
ruleOrder: ['default'],
ruleConfigById: {
default: {
name: 'Default',
label: 'Unnamed Rule',
message: '',
id: 'default',
icon: ' ',
style: {
color: '#ffffff',
'background-color': '#38761d',
'border-color': 'rgba(0,0,0,0)'
},
description: 'Default appearance for the widget',
conditions: [
{
object: '',
key: '',
operation: '',
values: []
}
],
jsCondition: '',
trigger: 'any',
expanded: 'true'
}
},
testDataConfig: [
{
object: '',
key: '',
value: ''
}
]
};
domainObject.openNewTab = 'thisTab';
domainObject.telemetry = {};
},
form: [
{
key: 'url',
name: 'URL',
control: 'textfield',
required: false,
cssClass: 'l-input-lg'
},
{
key: 'openNewTab',
name: 'Tab to Open Hyperlink',
control: 'select',
options: [
{
value: 'thisTab',
name: 'Open in this tab'
},
{
value: 'newTab',
name: 'Open in a new tab'
}
],
cssClass: 'l-inline'
}
]
};
return function install(openmct) {
openmct.types.addType('summary-widget', widgetType);
let compositionPolicy = new SummaryWidgetsCompositionPolicy(openmct);
openmct.composition.addPolicy(compositionPolicy.allow.bind(compositionPolicy));
openmct.telemetry.addProvider(new SummaryWidgetMetadataProvider(openmct));
openmct.telemetry.addProvider(new SummaryWidgetTelemetryProvider(openmct));
openmct.objectViews.addProvider(new SummaryWidgetViewProvider(openmct));
};
}