Skip to content

Commit b59c6a8

Browse files
committed
Allow Endpoint to be set in NLC Configuration
1 parent 049defc commit b59c6a8

File tree

1 file changed

+28
-4
lines changed
  • services/natural_language_classifier

1 file changed

+28
-4
lines changed

services/natural_language_classifier/v1.html

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,38 @@
105105
// This is the namespace for this version of this Node.
106106
var nlcV1 = new NaturalLanguageClassifierV1();
107107

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 () {
111120
$('#node-input-mode').change(function () {
112121
var mode = $('#node-input-mode').val();
113122
$('.form-row.mode.' + mode).show();
114123
$('.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();
116140
$.getJSON('watson-natural-language-classifier/vcap/')
117141
.done(function (service) {
118142
$('.credentials').toggle(!service);

0 commit comments

Comments
 (0)