This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
connection.html
103 lines (95 loc) · 4.19 KB
/
connection.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
<script type="text/markdown" data-help-name="os-connection">
Configure a connection to OpenSearch
### Options
: Name (string) : This node instance's name
: Nodes (string) : Space seperated list of OpenSearch nodes to connect to
: Credential (select) : Type of credential to use
: Identity (string) : Username for 'Basic'; ID for 'API Key'
: Secret (string) : The credential secret (password)
: Adv. Config (YAML/JSON) : Passed to `new Client()` of `@opensearch-project/opensearch`
#### Adv. Config
This YAML/JSON config will be passwd to [`new Client()` of `@opensearch-project/opensearch`](https://github.com/opensearch-project/opensearch-js/blob/main/USER_GUIDE.md#initializing-a-client).
HOWEVER: Values/Settings in the dedicated fields will override their equivelent in Adv. Config.
Example:
```
proxy: http://localhost:8080
requestTimout: 60000
maxRetries: 2
```
</script>
<script type="text/javascript">
/* global RED:false, $:false */
RED.nodes.registerType('os-connection', {
category: 'config',
defaults: {
name: { value: '', required: true },
nodes: { value: '', required: true },
verifyservercert: { value: true, required: true },
advConfig: { value: '' },
},
credentials: {
cred: { type: 'text' },
ident: { type: 'text' },
secret: { type: 'password' },
},
paletteLabel: 'OpenSearch connection',
icon: 'opensearch.png',
label: function () {
return this.name || 'OpenSearch connection';
},
oneditprepare: function () {
this.advConfig_editor = RED.editor.createEditor({
id: 'node-config-input-advConfig-editor',
mode: 'ace/mode/yaml',
value: $('#node-config-input-advConfig').val(),
});
},
oneditsave: function () {
$('#node-config-input-advConfig').val(this.advConfig_editor.getValue());
this.advConfig_editor.destroy();
delete this.advConfig_editor;
},
oneditcancel: function () {
this.advConfig_editor.destroy();
delete this.advConfig_editor;
},
});
</script>
<script type="text/x-red" data-template-name="os-connection">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-pencil"></i> Name</label>
<input type="text" id="node-config-input-name">
</div>
<div class="form-row">
<label for="node-config-input-nodes"><i class="fa fa-anchor"></i> ES Nodes</label>
<input type="text" id="node-config-input-nodes" placeholder="http://localhost:9200 (spaces as separator)">
</div>
<div class="form-row">
<label for="node-config-input-cred"><i class="fa fa-sign-in"></i> Credential</label>
<select id="node-config-input-cred">
<option value="">None (-/-)</option>
<option value="basic"> Basic (UN/PW)</option>
<option value="apikey_b64">B64 API Key (-/b64_key)</option>
<option value="apikey_obj">API Key (id/key)</option>
<option value="bearer">Bearer token (-/token)</option>
</select>
</div>
<div class="form-row">
<label for="node-config-input-ident"><i class="fa fa-id-card-o"></i> Identity</label>
<input type="text" id="node-config-input-ident">
</div>
<div class="form-row">
<label for="node-config-input-secret"><i class="fa fa-key"></i> Secret</label>
<input type="password" id="node-config-input-secret">
</div>
<div class="form-row">
<input type="checkbox" id="node-config-input-verifyservercert" style="display: inline-block; width: auto; vertical-align: top;" />
<label for="node-config-input-verifyservercert" style="width: auto;">Verify server certificate</label>
</div>
<div class="form-row">
<label for="node-config-input-advConfig"><i class="fa fa-pencil-square-o"></i> Adv. Config</label>
<span style="float: right">YAML/JSON</span>
<input id="node-config-input-advConfig" type="hidden" >
<div id="node-config-input-advConfig-editor" class="node-text-editor" style="height: 300px; min-height:200px;"></div>
</div>
</script>