@@ -33,7 +33,7 @@ module.exports = function (RED) {
33
33
// Not ever used, and codeacy complains about it.
34
34
// var services = cfenv.getAppEnv().services;
35
35
36
- var username , password , sUsername , sPassword ;
36
+ var username = null , password = null , sUsername = null , sPassword = null ;
37
37
38
38
var service = cfenv . getAppEnv ( ) . getServiceCreds ( / l a n g u a g e t r a n s l a t i o n / i)
39
39
@@ -93,6 +93,14 @@ module.exports = function (RED) {
93
93
RED . nodes . createNode ( this , config ) ;
94
94
var node = this ;
95
95
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
+
96
104
// this does nothing, but am keeping it with a commented out signature, as
97
105
// it might come in handy in the future.
98
106
this . on ( 'close' , function ( ) {
@@ -106,15 +114,6 @@ module.exports = function (RED) {
106
114
107
115
var message = '' ;
108
116
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
-
118
117
if ( ! username || ! password ) {
119
118
message = 'Missing Language Translation service credentials' ;
120
119
node . error ( message , msg ) ;
@@ -221,6 +220,7 @@ module.exports = function (RED) {
221
220
msg . payload = 'Model ' + model . name + ' successfully sent for training with id: ' + model . model_id ;
222
221
msg . trained_model_id = model . model_id ;
223
222
node . send ( msg ) ;
223
+ node . status ( { } ) ;
224
224
}
225
225
}
226
226
) ;
0 commit comments