Skip to content

Commit 049defc

Browse files
committed
Add NLC Namespace
1 parent c6b60ec commit 049defc

File tree

1 file changed

+22
-17
lines changed
  • services/natural_language_classifier

1 file changed

+22
-17
lines changed

services/natural_language_classifier/v1.html

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,30 @@
9999
</script>
100100

101101
<script type="text/javascript">
102+
// Need to simulate a namespace, so that some of the variables don't leak across nodes
103+
function NaturalLanguageClassifierV1 () {}
102104

103-
// This is the on edit prepare function, which will be
104-
//invoked everytime the dialog is shown.
105-
function nlconeditprepare() {
106-
$('#node-input-mode').change(function () {
107-
var mode = $('#node-input-mode').val();
108-
$('.form-row.mode.' + mode).show();
109-
$('.form-row.mode:not(.' + mode + ')').hide();
110-
})
111-
$.getJSON('watson-natural-language-classifier/vcap/')
112-
.done(function (service) {
113-
$('.credentials').toggle(!service);
114-
})
115-
.fail(function () {
116-
$('.credentials').show();
117-
}).always(function () {
118-
$('#credentials-check').hide();
105+
// This is the namespace for this version of this Node.
106+
var nlcV1 = new NaturalLanguageClassifierV1();
107+
108+
// This is the on edit prepare function, which will be
109+
//invoked everytime the dialog is shown.
110+
function nlconeditprepare() {
111+
$('#node-input-mode').change(function () {
112+
var mode = $('#node-input-mode').val();
113+
$('.form-row.mode.' + mode).show();
114+
$('.form-row.mode:not(.' + mode + ')').hide();
119115
})
120-
}
116+
$.getJSON('watson-natural-language-classifier/vcap/')
117+
.done(function (service) {
118+
$('.credentials').toggle(!service);
119+
})
120+
.fail(function () {
121+
$('.credentials').show();
122+
}).always(function () {
123+
$('#credentials-check').hide();
124+
})
125+
}
121126

122127

123128
(function() {

0 commit comments

Comments
 (0)