-
Notifications
You must be signed in to change notification settings - Fork 2
/
c8y-alarms-update.html
102 lines (94 loc) · 3 KB
/
c8y-alarms-update.html
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
<script type="text/x-red" data-template-name="c8y-alarm-update">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name </label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-row">
<label for="node-input-cumulocityConfig"><i class="fa fa-user"></i> Cumulocity Config</label>
<input type="text" id="node-input-cumulocityConfig">
</div>
<div class="form-row">
<label for="node-input-alarmId"><i class="fa fa-barcode"></i> Alarm Id </label>
<input type="text" id="node-input-alarmId" placeholder="">
</div>
<div class="form-row">
<label for="node-input-severity"><i class="fa fa-exclamation-triangle"></i> Severity </label>
<select type="text" id="node-input-severity" style="width:70%;">
<option selected value="noChange">(No change)</option>
<option value="CRITICAL">Critical</option>
<option value="MAJOR">Major</option>
<option value="MINOR">Minor</option>
<option value="WARNING">Warning</option>
</select>
</div>
<div class="form-row">
<label for="node-input-alarmStatus"><i class="fa clipboard-check"></i> Status </label>
<select type="text" id="node-input-alarmStatus" style="width:70%;">
<option selected value="noChange">(No change)</option>
<option value="ACTIVE">Active</option>
<option value="ACKNOWLEDGED">Acknowledged</option>
<option value="CLEARED">Cleared</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="c8y-alarm-update">
<p>Update a specific alarm in Cumulocity (by alarmId)</p>
<p>The tenant name must be configured in the node.</p>
<ul>
<li>Required inputs:
<ul>Cumulocity Configuration (add a new one or select from the list)</ul>
<ul>Alarm Id (number) - filter by device</ul>
</li>
</ul>
<p>
The output message contains the following properties:
<ul>
<li><code>statusCode</code> is the status code of the response, or the error code if the request could not be completed</li>
<li><code>headers</code> is an object containing the response headers</li>
</ul>
</p>
<p>More information about the Cumulocity API can be found <a href="http://cumulocity.com/guides/reference/alarms/">here </a>.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('c8y-alarm-update', {
category: 'cumulocity',
color: "rgb(106, 210, 252)",
defaults: {
name: {
value: ""
},
cumulocityConfig: {
type: "c8y-config",
required: true
},
alarmId: {
value: "",
required: true
},
alarmStatus: {
value: ""
},
severity: {
value: ""
}
},
inputs: 1,
outputs: 1,
icon: "cumulocity-logo.png",
label: function() {
return this.name || "Update C8Y Alarm";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function() {
$("#node-input-ret").change(function() {
if ($("#node-input-ret").val() === "obj") {
$("#tip-json").show();
} else {
$("#tip-json").hide();
}
});
}
});
</script>