Skip to content

Commit 94319df

Browse files
authored
Merge pull request #185 from ylecleach/master
Urgent fix for Watson Language Translation node
2 parents a91283c + 1d56487 commit 94319df

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Node-RED Watson Nodes for IBM Bluemix
1111

1212
### New in version 0.4.12
1313
- Emergency fix for node.js version compatibility problem, in payload-utils
14+
- Emergency fix for Watson Language Translation node detected proactively. (not reported)
1415

1516
### New in version 0.4.11
1617
- Corrected word count for Japanese text in Personality Insights nodes.

services/language_translation/v2.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function (RED) {
3333
// Not ever used, and codeacy complains about it.
3434
// var services = cfenv.getAppEnv().services;
3535

36-
var username, password, sUsername, sPassword;
36+
var username = null, password = null, sUsername = null, sPassword = null;
3737

3838
var service = cfenv.getAppEnv().getServiceCreds(/language translation/i)
3939

@@ -93,6 +93,14 @@ module.exports = function (RED) {
9393
RED.nodes.createNode(this, config);
9494
var node = this;
9595

96+
// The dynamic nature of this node has caused problems with the password field. it is
97+
// hidden but not a credential. If it is treated as a credential, it gets lost when there
98+
// is a request to refresh the model list.
99+
// Credentials are needed for each of the modes.
100+
101+
username = sUsername || this.credentials.username;
102+
password = sPassword || this.credentials.password || config.password;
103+
96104
// this does nothing, but am keeping it with a commented out signature, as
97105
// it might come in handy in the future.
98106
this.on('close', function() {
@@ -106,15 +114,6 @@ module.exports = function (RED) {
106114

107115
var message = '';
108116

109-
// The dynamic nature of this node has caused problems with the password field. it is
110-
// hidden but not a credential. If it is treated as a credential, it gets lost when there
111-
// is a request to refresh the model list.
112-
//
113-
// Credentials are needed for each of the modes.
114-
115-
username = sUsername || this.credentials.username;
116-
password = sPassword || this.credentials.password || config.password;
117-
118117
if (!username || !password) {
119118
message = 'Missing Language Translation service credentials';
120119
node.error(message, msg);
@@ -221,6 +220,7 @@ module.exports = function (RED) {
221220
msg.payload = 'Model ' + model.name + ' successfully sent for training with id: ' + model.model_id;
222221
msg.trained_model_id = model.model_id;
223222
node.send(msg);
223+
node.status({});
224224
}
225225
}
226226
);

0 commit comments

Comments
 (0)