-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattempt.html
More file actions
52 lines (50 loc) · 1.85 KB
/
Copy pathattempt.html
File metadata and controls
52 lines (50 loc) · 1.85 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
<script type="text/javascript">
RED.nodes.registerType("attempt", {
category: "common",
paletteLabel: "attempt",
color: '#F07A4C',
icon: "font-awesome/fa-repeat",
defaults: {
name: { value: "" },
attempts: { value: 3, validate: RED.validators.number() },
delay: { value: 1000, validate: RED.validators.number() }
},
inputs: 1,
outputs: 2,
label: function () {
return this.name || `${this.attempts} attempts`;
}
});
</script>
<script type="text/html" data-template-name="attempt">
<div class="form-row">
<div class="form-row">
<label for="node-input-name">Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-tips" style="width: auto">Pay attention: works properly only with connected Catch node.</div>
</div>
<div class="form-row">
<label for="node-input-name">Attempts</label>
<input type="number" id="node-input-attempts" min="2" max="100">
</div>
<div class="form-row">
<label for="node-input-name">Delay</label>
<input type="number" min="100" max="60000" id="node-input-delay">
</div>
</script>
<script type="text/html" data-help-name="attempt">
<p>This node simplifies message retry logic in case of errors.</p>
<h1>How it works:</h1>
<ul>
<li>The incoming message is passed to the first output.</li>
<li>If the node connected to the first output throws an error, the message is retried after a delay.</li>
<li>The number of attempts and delay are configurable.</li>
<li>If all attempts fail, the message is sent to the second output.</li>
</ul>
<h1>Important:</h1>
<ul>
<li>A <b>Catch node</b> must be connected to the <b>input</b> of the <b>Attempt node</b> to handle errors.</li>
<li>In the Catch node’s settings, ensure <b>only the node connected to the first output</b> is selected.</li>
</ul>
</script>