|
183 | 183 |
|
184 | 184 | // convert an id in the form it-ko into Italian - Korean for display |
185 | 185 | function changeIdToText(id) { |
186 | | - console.log('in changeIdToText'); |
187 | 186 | var txt = ""; |
188 | 187 | var langs = id.split('-'); |
189 | 188 | var first = true; |
|
201 | 200 | // Function to be used at the start, as don't want to expose any fields, unless the model is |
202 | 201 | // available. The model it self can only be fetched if the credentials are available. |
203 | 202 | function hideAll() { |
204 | | - console.log('in hideAll'); |
205 | 203 | if (!models) { |
206 | 204 | $('#credentials-not-found').show(); |
207 | 205 | $('#node-input-action').parent().hide(); |
|
222 | 220 | // are shown without the user having to close the dialog. |
223 | 221 | // Problem is that the onchange is only invoked when the user tabs to another field. |
224 | 222 | function checkVisibility() { |
225 | | - console.log('in checkVisibility'); |
226 | 223 | if (models) { |
227 | 224 | $('#node-input-action').parent().show(); |
228 | 225 | checkActionSelected(); |
|
238 | 235 | // Retrieve the available models from the server, if data is returned, then |
239 | 236 | // can enable the dynamic selection fields. |
240 | 237 | function checkModels() { |
241 | | - console.log('in checkModels'); |
242 | 238 | var u = $('#node-input-username').val(); |
243 | 239 | var p = $('#node-input-password').val(); |
244 | 240 |
|
|
256 | 252 | // Simple check that is only invoked if the service is not bound into bluemix. In this case the |
257 | 253 | // user has to provide credentials. Once there are credentials, then the models are retrieved. |
258 | 254 | function getCredentials() { |
259 | | - console.log('in getCredentials'); |
260 | 255 | var u = $('#node-input-username').val(); |
261 | 256 | var p = $('#node-input-password').val(); |
262 | 257 |
|
|
274 | 269 | // destination language selection field is dynamically repopulated, and reselected if the |
275 | 270 | // previously selection is still in the new list. |
276 | 271 | function langDestAvailable() { |
277 | | - console.log('in langDestAvailable'); |
278 | 272 | if (!domain_type) { return; } |
279 | 273 |
|
280 | 274 | var pair_lang = domain_type.map(function (a) { |
|
308 | 302 | // Populates the domains selection field. |
309 | 303 | // If domains have already been retrieved then no need to refetch them. |
310 | 304 | function checkDomains() { |
311 | | - console.log('in checkDomains'); |
312 | 305 | if (!domains) { |
313 | 306 | domains = models.map(function (a) { |
314 | 307 | return a.domain; |
|
339 | 332 |
|
340 | 333 | // Populates the base model field. These are the models that are available to be customised. |
341 | 334 | function checkBaseModels() { |
342 | | - console.log('in checkBaseModels'); |
343 | 335 | if (!basemodels && models) { |
344 | 336 | basemodels = models.filter(function (model) { |
345 | 337 | return model.customizable === true; |
|
369 | 361 | // new model is triggerd, but that is a little complicated and needs to be done on |
370 | 362 | // a clear mind. |
371 | 363 | function checkCustomsAvailable() { |
372 | | - console.log('in checkCustomsAvailable'); |
373 | 364 | if (!custommodels && models) { |
374 | 365 | custommodels = models.filter(function (m) { |
375 | 366 | return (m.base_model_id && ('' != m.base_model_id)); |
|
400 | 391 | // UI Handler for the Mode / switch. |
401 | 392 | // Princliple function is to show / hide the appropriate fields. |
402 | 393 | function checkActionSelected() { |
403 | | - console.log('in checkActionSelected'); |
404 | 394 | action = $('#node-input-action').val(); |
405 | 395 | if (models) { |
406 | 396 | $('#credentials-not-found').hide(); |
|
446 | 436 | // UI Handler for the domain switch |
447 | 437 | // Repopulate the source and languages based on the available translations for the domain |
448 | 438 | function checkDomainSelected(){ |
449 | | - console.log('in checkDomainSelected'); |
450 | 439 | $('#node-input-srclang').empty(); |
451 | 440 | $('#node-input-destlang').empty(); |
452 | 441 | if (models && domains) { |
|
486 | 475 |
|
487 | 476 | // Register the handlers for the fields |
488 | 477 | function UIListeners() { |
489 | | - console.log('in UIListeners'); |
490 | 478 | $('#node-input-username').change(function(val){ |
491 | 479 | getCredentials(); |
492 | 480 | if (have_credentials) { |
|
533 | 521 | // So hidden (text) fields are being used to squirrel away the values, so that |
534 | 522 | // they can be restored. |
535 | 523 | function restoreHidden() { |
536 | | - console.log('in restoreHidden'); |
537 | 524 | domain_selected = $('#node-input-domainhidden').val(); |
538 | 525 | $('select#node-input-domain').val(domain_selected); |
539 | 526 | srclang_selected = $('#node-input-srclanghidden').val(); |
|
550 | 537 | // This is the on edit prepare function, which will be invoked everytime the dialog |
551 | 538 | // is shown. |
552 | 539 | function oneditprepare() { |
553 | | - console.log('in oneditprepare'); |
554 | | - |
555 | 540 | hideAll(); |
556 | 541 | restoreHidden(); |
557 | 542 |
|
|
596 | 581 |
|
597 | 582 | // Save the values in the dyanmic lists to the hidden fields. |
598 | 583 | function oneditsave(){ |
599 | | - console.log('in oneditsave'); |
600 | 584 | $('#node-input-domainhidden').val(domain_selected); |
601 | 585 | $('#node-input-srclanghidden').val(srclang_selected); |
602 | 586 | $('#node-input-destlanghidden').val(destlang_selected); |
|
0 commit comments