|
105 | 105 | // This is the namespace for this version of this Node. |
106 | 106 | var nlcV1 = new NaturalLanguageClassifierV1(); |
107 | 107 |
|
108 | | - // This is the on edit prepare function, which will be |
109 | | - //invoked everytime the dialog is shown. |
110 | | - function nlconeditprepare() { |
| 108 | + nlcV1.CreateIListener = function(listen, action, opp) { |
| 109 | + opp = typeof opp === 'undefined' ? false : opp; |
| 110 | + listen.change(function(val){ |
| 111 | + var isSet = listen.prop('checked'); |
| 112 | + if (opp) { |
| 113 | + isSet = !isSet; |
| 114 | + } |
| 115 | + nluV1.setVisibility(action, isSet); |
| 116 | + }); |
| 117 | + } |
| 118 | + |
| 119 | + nlcV1.UIListeners = function () { |
111 | 120 | $('#node-input-mode').change(function () { |
112 | 121 | var mode = $('#node-input-mode').val(); |
113 | 122 | $('.form-row.mode.' + mode).show(); |
114 | 123 | $('.form-row.mode:not(.' + mode + ')').hide(); |
115 | | - }) |
| 124 | + }); |
| 125 | + |
| 126 | + nlcV1.CreateIListener($('#node-input-default-endpoint'), |
| 127 | + $('#node-input-service-endpoint'), true); |
| 128 | + }; |
| 129 | + |
| 130 | + nlcV1.checkForPrepare = function () { |
| 131 | + nlcV1.UIListeners(); |
| 132 | + }; |
| 133 | + |
| 134 | + // This is the on edit prepare function, which will be |
| 135 | + //invoked everytime the dialog is shown. |
| 136 | + function nlconeditprepare() { |
| 137 | + |
| 138 | + |
| 139 | + nlcV1.checkForPrepare(); |
116 | 140 | $.getJSON('watson-natural-language-classifier/vcap/') |
117 | 141 | .done(function (service) { |
118 | 142 | $('.credentials').toggle(!service); |
|
0 commit comments