@5minds/node-red-contrib-processcube-elasticsearch 0.3.3-develop-ed2d61-m66bryff → 0.3.3-feature-3f08f9-m4mvvtkj

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,15 @@
1
1
  <script type="text/javascript">
2
2
  RED.nodes.registerType('elastic-search-logger', {
3
3
  category: 'config',
4
- credentials: {
5
- username: { type: 'text' },
6
- password: { type: 'password' },
7
- index: { type: 'text' },
8
- },
9
4
  defaults: {
10
5
  name: { value: '' },
11
- url: { value: 'http://localhost:9200' },
6
+ url: { value: 'http://engine:8000' },
12
7
  urlType: { value: 'str' },
8
+ username: { value: '' },
13
9
  usernameType: { value: 'str' },
10
+ password: { value: '' },
14
11
  passwordType: { value: 'str' },
12
+ index: { value: '' },
15
13
  indexType: { value: 'str' },
16
14
  filename: { value: 'log-elastic.log', required: true },
17
15
  maxsize: {
@@ -35,35 +33,52 @@
35
33
  oneditprepare: function () {
36
34
  // URL
37
35
  $('#node-config-input-url').typedInput({
38
- type: this.urlType,
36
+ default: 'str',
39
37
  types: ['str', 'env'],
40
- typeField: '#node-config-input-urlType',
41
- value: this.url,
42
38
  });
43
39
 
44
40
  // Username
45
41
  $('#node-config-input-username').typedInput({
46
- type: this.usernameType,
47
- types: ['str', 'cred', 'env'],
48
- typeField: '#node-config-input-usernameType',
49
- value: this.credentials.username,
42
+ default: 'str',
43
+ types: ['str', 'env'],
50
44
  });
51
45
 
52
46
  // Password
53
47
  $('#node-config-input-password').typedInput({
54
- type: this.passwordType,
55
- types: ['str', 'cred', 'env'],
56
- typeField: '#node-config-input-passwordType',
57
- value: this.credentials.password,
48
+ default: 'str',
49
+ types: ['str', 'env'],
58
50
  });
59
51
 
60
52
  // Index
61
53
  $('#node-config-input-index').typedInput({
62
- type: this.indexType,
54
+ default: 'str',
63
55
  types: ['str', 'env'],
64
- typeField: '#node-config-input-indexType',
65
- value: this.credentials.index,
66
56
  });
57
+
58
+ $('#node-config-input-url').typedInput('value', this.url);
59
+ $('#node-config-input-url').typedInput('type', this.urlType);
60
+
61
+ $('#node-config-input-username').typedInput('value', this.username);
62
+ $('#node-config-input-username').typedInput('type', this.usernameType);
63
+
64
+ $('#node-config-input-password').typedInput('value', this.password);
65
+ $('#node-config-input-password').typedInput('type', this.passwordType);
66
+
67
+ $('#node-config-input-index').typedInput('value', this.index);
68
+ $('#node-config-input-index').typedInput('type', this.indexType);
69
+ },
70
+ oneditsave: function () {
71
+ this.url = $('#node-config-input-url').typedInput('value');
72
+ this.urlType = $('#node-config-input-url').typedInput('type');
73
+
74
+ this.username = $('#node-config-input-username').typedInput('value');
75
+ this.usernameType = $('#node-config-input-username').typedInput('type');
76
+
77
+ this.password = $('#node-config-input-password').typedInput('value');
78
+ this.passwordType = $('#node-config-input-password').typedInput('type');
79
+
80
+ this.index = $('#node-config-input-index').typedInput('value');
81
+ this.indexType = $('#node-config-input-index').typedInput('type');
67
82
  },
68
83
  });
69
84
  </script>
@@ -80,22 +95,18 @@
80
95
  <div class="form-row" style="padding-left:20px;">
81
96
  <label for="node-config-input-url"><i class="fa fa-plug"></i> Elastic URL</label>
82
97
  <input type="text" id="node-config-input-url" />
83
- <input type="hidden" id="node-config-input-urlType" />
84
98
  </div>
85
99
  <div class="form-row" style="padding-left:20px;">
86
100
  <label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
87
101
  <input type="text" id="node-config-input-username" />
88
- <input type="hidden" id="node-config-input-usernameType" />
89
102
  </div>
90
103
  <div class="form-row" style="padding-left:20px;">
91
104
  <label for="node-config-input-password"><i class="fa fa-key"></i> Password</label>
92
105
  <input type="text" id="node-config-input-password" />
93
- <input type="hidden" id="node-config-input-passwordType" />
94
106
  </div>
95
107
  <div class="form-row" style="padding-left:20px;">
96
108
  <label for="node-config-input-index"><i class="fa fa-tag"></i> Index</label>
97
109
  <input type="text" id="node-config-input-index" />
98
- <input type="hidden" id="node-config-input-indexType" />
99
110
  </div>
100
111
  </div>
101
112
  </script>
@@ -15,29 +15,29 @@ module.exports = function (RED) {
15
15
  this.error('Elastic search url is not set');
16
16
  }
17
17
 
18
- let user = RED.util.evaluateNodeProperty(this.credentials.username, config.usernameType, this);
19
- if (user == '') {
18
+ this.credentials.username = RED.util.evaluateNodeProperty(config.username, config.usernameType, this);
19
+ if (this.credentials.username == '') {
20
20
  this.error('Elastic search username is not set');
21
21
  }
22
22
 
23
- let password = RED.util.evaluateNodeProperty(this.credentials.password, config.passwordType, this);
24
- if (password == '') {
23
+ this.credentials.password = RED.util.evaluateNodeProperty(config.password, config.passwordType, this);
24
+ if (this.credentials.password == '') {
25
25
  this.error('Elastic search password is not set');
26
26
  }
27
27
 
28
- let index = RED.util.evaluateNodeProperty(this.credentials.index, config.indexType, this);
29
- if (index == '') {
28
+ this.credentials.index = RED.util.evaluateNodeProperty(config.index, config.indexType, this);
29
+ if (this.credentials.index == '') {
30
30
  this.error('Elastic search index is not set');
31
31
  }
32
32
 
33
- index = index.toLowerCase();
33
+ this.credentials.index = this.credentials.index.toLowerCase();
34
34
  if (url) {
35
35
  const elasticSearchTransport = new winstonElasticSearch.ElasticsearchTransport({
36
36
  clientOpts: {
37
- node: url,
37
+ node: this.credentials.url,
38
38
  auth: {
39
- username: user,
40
- password: password,
39
+ username: this.credentials.username,
40
+ password: this.credentials.password,
41
41
  },
42
42
  ssl: {
43
43
  // accept any
@@ -45,7 +45,7 @@ module.exports = function (RED) {
45
45
  },
46
46
  },
47
47
  transformer: (logData) => setElasticFields(logData, this),
48
- index: index,
48
+ index: this.credentials.index,
49
49
  });
50
50
 
51
51
  transports.push(elasticSearchTransport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube-elasticsearch",
3
- "version": "0.3.3-develop-ed2d61-m66bryff",
3
+ "version": "0.3.3-feature-3f08f9-m4mvvtkj",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for Elasticsearch",
6
6
  "scripts": {