forked from SAP-archive/yaas-node-red-contrib-yaas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pubsub.html
166 lines (160 loc) · 6.45 KB
/
pubsub.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
<script type="text/javascript">
RED.nodes.registerType('pubsub_read',{
category: 'yaas',
color: '#1b91e2',
defaults: {
name: {value:""},
yaasCredentials: {type:"yaas-credentials", required:true},
event_type : {value:"order.order-created", required:true},
interval : {value:1000},
number_of_events: {value:1},
topic_owner_client : {value:"hybris"},
auto_commit : {value:true, required:true}
},
inputs:0,
outputs:1,
icon: "yaas.png",
paletteLabel : 'pubsub read',
label: function() {
if (this.topic_owner_client) {
this.str = this.topic_owner_client + '.' + this.event_type;
} else if (this.yaasCredentials) {
this.str = RED.nodes.node(this.yaasCredentials).application_id + '.' + this.event_type;
}
return this.name || this.str;
}
});
</script>
<script type="text/x-red" data-template-name="pubsub_read">
<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-yaasCredentials"><i class="fa"></i> YaaS Credentials</label>
<input type="text" id="node-input-yaasCredentials">
</div>
<div class="form-row">
<label for="node-input-topic_owner_client"><i class="fa fa-comments-o"></i> Topic Owner Client</label>
<input type="text" id="node-input-topic_owner_client" placeholder="Application Id / Identifier (optional)">
</div>
<div class="form-row">
<label for="node-input-event_type"><i class="fa fa-comments-o"></i> Event Type</label>
<input type="text" id="node-input-event_type" placeholder="Event Type">
</div>
<div class="form-row">
<label for="node-input-number_of_events"><i class="fa"></i> Number of Events</label>
<input type="number" id="node-input-number_of_events" placeholder="default: 1">
</div>
<div class="form-row">
<label for="node-input-interval"><i class="fa fa-comments-o"></i> Interval</label>
<input type="number" id="node-input-interval" placeholder="interval in ms">
</div>
<div class="form-row">
<label for="node-input-auto_commit"><i class="fa"></i> Auto Commit</label>
<input type="checkbox" id="node-input-auto_commit">
</div>
</script>
<script type="text/x-red" data-help-name="pubsub_read">
<p>
Subscribe to PubSub to <b>read</b> events from the configured <i>Event Type</i>.
</p>
<p>
If no <i>Topic Owner Client</i> is defined, the <i>Application ID</i> from the <i>YaaS Credentials</i> is used.
</p>
<p>
See also <a href="https://devportal.yaas.io/services/pubsub/latest/index.html" target="_blank">PubSub documentation</a>.
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('pubsub_publish',{
category: 'yaas',
color: '#1b91e2',
defaults: {
name: {value:""},
yaasCredentials: {type:"yaas-credentials", required:true},
event_type : {value:"", required:true}
},
inputs:1,
outputs:0,
icon: "yaas.png",
align : "right",
paletteLabel : 'pubsub publish',
label: function() {
if (this.yaasCredentials) {
this.str = RED.nodes.node(this.yaasCredentials).application_id + '.' + this.event_type;
}
return this.name || this.str;
}
});
</script>
<script type="text/x-red" data-template-name="pubsub_publish">
<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-yaasCredentials"><i class="fa"></i> Credentials</label>
<input type="text" id="node-input-yaasCredentials">
</div>
<div class="form-row">
<label for="node-input-event_type"><i class="fa fa-comments-o"></i> Event Type</label>
<input type="text" id="node-input-event_type" placeholder="Topic">
</div>
</script>
<script type="text/x-red" data-help-name="pubsub_publish">
<p>
Publish an event to the configured <i>Event Type</i>.
The <i>Application ID</i> from the <i>YaaS Credentials</i> is used as <i>Topic Owner Client</i> for the PubSub <b>publish</b> event.
</p>
<p>
See also <a href="https://devportal.yaas.io/services/pubsub/latest/index.html" target="_blank">PubSub documentation</a>.
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('pubsub_commit',{
category: 'yaas',
color: '#1b91e2',
defaults: {
name: {value:""},
yaasCredentials: {type:"yaas-credentials", required:true},
event_type : {value:"button_pressed", required:true}
},
inputs:1,
outputs:0,
icon: "yaas.png",
align : "right",
paletteLabel : 'pubsub commit',
label: function() {
if (this.yaasCredentials) {
this.str = RED.nodes.node(this.yaasCredentials).application_id + '.' + this.event_type;
}
return this.name || this.str;
}
});
</script>
<script type="text/x-red" data-template-name="pubsub_commit">
<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-yaasCredentials"><i class="fa"></i> Credentials</label>
<input type="text" id="node-input-yaasCredentials">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-comments-o"></i> Event Type</label>
<input type="text" id="node-input-event_type" placeholder="Event Type">
</div>
</script>
<script type="text/x-red" data-help-name="pubsub_commit">
<p>
Events which are not committed are redelivered after the defined time. This node <b>commit</b>s this configured <i>Event Type<i>.
</p>
<p>
Note: needs input from <code>pubsub (no commit)</code>
</p>
<p>
See also <a href="https://devportal.yaas.io/services/pubsub/latest/index.html" target="_blank">PubSub documentation</a>.
</p>
</script>