forked from joeartsea/node-red-contrib-aws
-
Notifications
You must be signed in to change notification settings - Fork 59
/
IotData.html
137 lines (117 loc) · 3.84 KB
/
IotData.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
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
130
131
132
133
134
135
136
<!--
Copyright 2021 Daniel Thomas.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="AWS IotData">
<style scoped>
.hiddenAttrs {display:none;}
.visibleAttrs {display:block;}
</style>
<div class="form-row">
<label for="node-input-aws"><i class="fa fa-user"></i> AWS</label>
<input type="text" id="node-input-aws">
</div>
<div class="form-row">
<label for="node-input-operation"><i class="fa fa-wrench"></i> Operation</label>
<select type="text" id="node-input-operation">
<option value="DeleteThingShadow">DeleteThingShadow</option>
<option value="GetThingShadow">GetThingShadow</option>
<option value="ListNamedShadowsForThing">ListNamedShadowsForThing</option>
<option value="Publish">Publish</option>
<option value="UpdateThingShadow">UpdateThingShadow</option>
;
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i>Name</label>
<input type="text" id="node-input-name" placeholder="Name"></input>
</div>
<div class="form-row">
<label for="node-input-endPoint"><i class="fa fa-tag"></i>Endpoint (*)</label>
<input type="text" id="node-input-endPoint" placeholder="">
</input>
</div>
<hr/>
<div id="AttrHolder">
<div class="form-row" id='thingNameAttr' class='hiddenAttrs'>
<label for="node-input-thingName"><i class="fa fa-tag"></i>thingName</label>
<input type="text" id="node-input-thingName" placeholder="thingName"></input>
</div>
<div class="form-row" id='topicAttr' class='hiddenAttrs'>
<label for="node-input-topic"><i class="fa fa-tag"></i>topic</label>
<input type="text" id="node-input-topic" placeholder="topic"></input>
</div>
<div class="form-row" id='payloadAttr' class='hiddenAttrs'>
<label for="node-input-payload"><i class="fa fa-tag"></i>payload</label>
<input type="text" id="node-input-payload" placeholder="payload"></input>
</div>
</div>
<script>
var nodeOps={
DeleteThingShadow:[
'#thingNameAttr'
],
GetThingShadow:[
'#thingNameAttr'
],
ListNamedShadowsForThing:[
'#thingNameAttr'
],
Publish:[
'#topicAttr'
],
UpdateThingShadow:[
'#thingNameAttr','#payloadAttr'
]
};
$('#node-input-operation').on('change',function(){
$('#AttrHolder').children().addClass('hiddenAttrs').removeClass('visibleAttrs');
if (nodeOps[this.value])
$(nodeOps[this.value].join()).addClass('visibleAttrs').removeClass('hiddenAttrs');
});
</script>
</script>
<script type="text/x-red" data-help-name="amazon IotData">
<p>
AWS AWS IoT Data Plane
</p>
<p>
<b>Descriptions to be added</b<
</p>
<p>
NOTE: Parameters must be specified in the message, using the case specified in the AWS API documentation (normally UpperCaseLeading)..
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('AWS IotData',{
category: 'AWS',
color:"#C0DEED",
defaults: {
aws: {type:"amazon config",required:true},
operation: { value: 'DeleteThingShadow' },
thingName: { value: ""} ,
topic: { value: ""} ,
payload: { value: ""} ,
endPoint: { value: "" },
name: { value: "" }
},
inputs:1,
outputs: 2,
outputLabels: ["data","err"],
icon: "aws.png",
align: "right",
label: function() {
return this.name || "IotData " + this.operation;
},
oneditprepare: function () {
}
});
</script>