-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredis.html
214 lines (204 loc) · 6.5 KB
/
redis.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<script type="text/javascript">
"use strict";
/*global RED*/
RED.nodes.registerType('contrib-redis-config', {
category: 'config',
defaults: {
host: {
value: "{{REDIS_SERVER}}",
required: true
},
port: {
value: "{{REDIS_PORT}}",
required: true
},
dbase: {
value: "{{REDIS_DB}}",
required: true
},
pass: {
value: "{{REDIS_PASSWORD}}",
required: false
}
},
label: function() {
return this.host + ":" + this.port + "/" + this.dbase;
}
});
</script>
<script type="text/x-red" data-template-name="contrib-redis-config">
<div class="form-row">
<label for="node-config-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-config-input-host">
</div>
<div class="form-row">
<label for="node-config-input-port"><i class="fa fa-server"></i> Port</label>
<input type="text" id="node-config-input-port">
</div>
<div class="form-row">
<label for="node-config-input-dbase"><i class="fa fa-random"></i> DB</label>
<input type="text" id="node-config-input-dbase">
</div>
<div class="form-row">
<label for="node-config-input-pass"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-config-input-pass">
</div>
</script>
<script type="text/javascript">
/*global RED*/
RED.nodes.registerType('redis-sub', {
category: 'Contrib',
inputs:0,
outputs: 1,
color: "#FFAAAA",
icon: "redis.png",
paletteLabel: "redis-sub",
defaults: {
server: {
value: "",
type: "contrib-redis-config"
},
name: {
value: ""
},
channel: {
value: "",
required: true
}
},
label: function() {
return this.name || "Contrib Redis Sub";
}
});
</script>
<script type="text/x-red" data-template-name="redis-sub">
<div class="form-row">
<label for="node-input-server"><i class="fa fa-globe"></i> Server</label>
<input type="text" id="node-input-server" placeholder="Server">
</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">
</div>
<div class="form-row">
<label for="node-input-channel"><i class="icon-tasks"></i> Channel</label>
<input type="text" id="node-input-channel" placeholder="Channel">
</div>
</script>
<script type="text/x-red" data-help-name="redis-sub">
<p>Contrib redis sub</p>
<p>Acts as subscriber</p>
<p>The Channel is channel name.</p>
<p>msg.payload = redis.sub(Channel)</p>
</script>
<script type="text/javascript">
/*global RED*/
RED.nodes.registerType('redis-pub', {
category: 'Contrib',
color: "#C0DEED",
inputs:1,
outputs:0,
icon: "redis.png",
align: "right",
paletteLabel: "redis-pub",
defaults: {
server: {
value: "",
type: "contrib-redis-config"
},
name: {
value: ""
},
channel: {
value: "",
required: true
}
},
label: function() {
return this.name || "Contrib Redis Pub";
}
});
</script>
<script type="text/x-red" data-template-name="redis-pub">
<div class="form-row">
<label for="node-input-server"><i class="fa fa-globe"></i> Server</label>
<input type="text" id="node-input-server" placeholder="Server">
</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">
</div>
<div class="form-row">
<label for="node-input-channel"><i class="icon-tasks"></i> Channel</label>
<input type="text" id="node-input-channel" placeholder="Channel">
</div>
</script>
<script type="text/x-red" data-help-name="redis-pub">
<p>Contrib redis pub</p>
<p>Acts as publish</p>
<p>The channel is channel name.</p>
<p>redis.pub(Channel) = msg.payload</p>
</script>
<script type="text/javascript">
/*global RED*/
RED.nodes.registerType('redis-hash', {
category: 'Contrib',
color: "#FFAAAA",
inputs:1,
outputs:1,
icon: "redis.png",
paletteLabel: "redis-hash",
defaults: {
server: {
value: "",
type: "contrib-redis-config"
},
name: {
value: ""
},
hash: {
value: "",
required: true
},
key: {
value: "",
required: true
},
postfix: {
value: ""
}
},
label: function() {
return this.name || "Contrib Redis Hash";
}
});
</script>
<script type="text/x-red" data-template-name="redis-hash">
<div class="form-row">
<label for="node-input-server"><i class="fa fa-globe"></i> Server</label>
<input type="text" id="node-input-server" placeholder="Server">
</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">
</div>
<div class="form-row">
<label for="node-input-hash"><i class="icon-tasks"></i> Hash</label>
<input type="text" id="node-input-hash" placeholder="Hash">
</div>
<div class="form-row">
<label for="node-input-key"><i class="icon-tasks"></i> Key</label>
<input type="text" id="node-input-key" placeholder="Key">
</div>
<div class="form-row">
<label for="node-input-postfix"><i class="icon-tasks"></i> Postfix</label>
<input type="text" id="node-input-postfix" placeholder="Postfix">
</div>
</script>
<script type="text/x-red" data-help-name="redis-hash">
<p>Contrib redis hash map</p>
<p>Acts as hash map</p>
<p>Add a description field for the payload.</p>
<p>The default value for Postfix is Name.</p>
<p>msg.payload[Key + Postfix] = redis.hash(Key)</p>
</script>