-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhmi-alarm.html
More file actions
executable file
·129 lines (124 loc) · 4.22 KB
/
hmi-alarm.html
File metadata and controls
executable file
·129 lines (124 loc) · 4.22 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<script type="text/javascript">
RED.nodes.registerType('hmi-alarm out',{
category: 'exor',
color: '#a6bbcf',
defaults:
{
sse: {value: "", type:"hmi-sse"},
hmiID: {value:""},
name: {value:""},
all: {value: false}
},
inputs:0,
outputs:1,
icon: "inject.png",
label: function()
{
return this.name || "hmi-alarm";
},
button:
{
toggle: "active",
onclick: function()
{
var lebel = this.name || "hmi-alarm";
this.active = true;
$.ajax(
{
url: "hmi-alarm/" + this.id + "/" + (this.active ? "enable" : "disable"),
type : "POST",
success : function(resp, textStatus, xhr)
{
if (xhr.status == 200)
{
RED.notify(node._("debug.notification.activated",
{label:label}), "success");
}
else if (xhr.status == 201)
{
RED.notify(node._("debug.notification.deactived",
{label:label}), "success");
}
},
error: function(jqXHR, textStatus, errorThrown)
{
if (jqXHR.status == 404)
{
RED.notify(node._("common.notification.error",
{message: node._("common.notification.errors.not-deployed")}), "error");
}
else if(jqXHR.status == 0)
{
RED.notify(node._("common.notification.error",
{message: node._("common.notification.errors.not-response")}), "error");
}
else
{
RED.notify(node._("common.notification.error",
{message: node._("common.notification.errors.unexpected",
{status: err.status, message: err.response})}), "error");
}
}
});
}
}
});
</script>
<script type="text/x-red" data-template-name="hmi-alarm out">
<div class="form-row">
<label for="node-input-sse"><i class="icon-tag"></i> SSE</label>
<input type="text" id="node-input-sse" placeholder="Id">
</div>
<div class="form-row">
<label for="node-input-all"><i class="icon-tag"></i> All Tag</label>
<input type="checkbox" id="node-input-all" value="all">
</div>
<div class="form-row">
<label for="node-input-hmiID"><i class="icon-tag"></i> Id</label>
<input type="text" id="node-input-hmiID" placeholder="Id">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="hmi-alarm out">
<p>Subscribe one alarm or all alarms</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('hmi-alarm in',{
category: 'exor',
color: '#a6bbcf',
defaults:
{
sse: {value: "", type:"hmi-sse"},
hmiID: {value:""},
name: {value:""},
all: {value: false}
},
inputs:1,
outputs:0,
icon: "inject.png",
label: function()
{
return this.name || "hmi-alarm";
}
});
</script>
<script type="text/x-red" data-template-name="hmi-alarm in">
<div class="form-row">
<label for="node-input-sse"><i class="icon-tag"></i> SSE</label>
<input type="text" id="node-input-sse" placeholder="SSE">
</div>
<div class="form-row">
<label for="node-input-hmiID"><i class="icon-tag"></i> Id</label>
<input type="text" id="node-input-hmiID" placeholder="Id">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="hmi-tag in">
<p>Subscribe one alarm</p>
</script>