$( document ).ready(function() {
console.log( "ready!" );
$.ajax({
url: 'http://localhost:3001/require/all',
error: function() {
console.log("Error");
},
dataType: 'text',
success: function(data) {
console.log("success");
},
type: 'GET'
});
});
$('#jstree_demo_div').on("open_node.jstree", function (e, data) {
console.log(data.node);
});
$('#jstree_demo_div').on("select_node.jstree", function (e, data) {
console.log(data);
if(data.node.data.nodeclass == "Object"){
$('#instancename').val(data.node.text);
$('#instancenamespace').val(data.node.data.namespace);
$('#instancenodeclass').val(data.node.data.nodeclass);
//$('#instancetypedefinition').val(data.node.data.);
$('#instancenodeidtype').val();
$('#instancenodeid').val(data.node.id);
$('#instanceeventnotifier').attr('placeholder','1 (EventNotifierSubscribeToEvents)');
$('#instancedisplayname1').val("");
$('#instancedisplayname2').val(data.node.text);
$('#instancebrowsename1').val(data.node.data.namespace);
$('#instancebrowsename2').val(data.node.data.browsename);
console.log("obj enabled");
$('#objectattributesbutton').prop('disabled', false);
$('#collapseTwo1').collapse('hide');
$('#variableattributesbutton').prop('disabled',true);
$('#collapseTwo2').collapse('hide');
$('#methodattributesbutton').prop('disabled',true);
}
if(data.node.data.nodeclass == "Variable"){
$('#variableattributesbutton').prop('disabled', false);
$('#collapseTwo').collapse('hide');
$('#objectattributesbutton').prop('disabled',true);
$('#collapseTwo2').collapse('hide');
$('#methodattributesbutton').prop('disabled',true);
}
if(data.node.data.nodeclass == "Method"){
$('#methodattributesbutton').prop('disabled',false);
$('#collapseTwo').collapse('hide');
$('#objectattributesbutton').prop('disabled',true);
$('#collapseTwo1').collapse('hide');
$('#variableattributesbutton').prop('disabled',true);
}
/*$.ajax({
url: 'http://127.0.0.1:3001',
type: 'POST', // http method
data: { key_id: name }, // data to submit
success: function (data, status, xhr) {
$('p').append('status: ' + status + ', data: ' + data);
},
error: function (jqXhr, textStatus, errorMessage) {
$('p').append('Error: ' + errorMessage);
}
});*/
});
$('#nodesetfile').on("open", function (e, data) {
console.log('hello');
});
$('#changeinstance').click(function () {
console.log('hello');
});
$('#savenodespecification').click(function () {
console.log('save this');
console.log($('#instancename').val());
console.log($('#instancenamespace').val());
console.log($('#instancenodeclass').val());
console.log($('#instancetypedefinition').val());
console.log($('#instancenodeidtype').val());
console.log($('#instancenodeid').val());
console.log($('#instanceeventnotifier').attr('placeholder'));
console.log($('#instancedisplayname1').val());
console.log($('#instancedisplayname2').val());
console.log($('#instancebrowsename1').val());
});
$('#numericnodeid').click(function () {
console.log("It is number");
$('#instancenodeidtype').text('Numeric')
});
$('#stringnodeid').click(function () {
console.log("It is string");
$('#instancenodeidtype').text('String')
});
$('#guidnodeid').click(function () {
console.log("It is guid");
$('#instancenodeidtype').text('Guid')
});
$('#opaquenodeid').click(function () {
console.log("It is opaque");
$('#instancenodeidtype').text('Opaque')
});
$('#instancebrowsename1').click(function () {
console.log("Add the script");
var sz = parseInt($('#namespaceidxbrowsename').attr("size"));
console.log(sz);
var num_ns = "6";
var nnum = parseInt(num_ns);
if(sz < nnum){
var lin = "
"+num_ns+""
$('#namespaceidxbrowsename').append(lin);
$('#namespaceidxbrowsename').attr("size",num_ns);
}
});
$('#subscribeevents').click(function () {
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '13 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead|EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '1 (EventNotifierSubscribeToEvents)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '4 (EventNotifierHistoryRead)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '8 (EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '0 (None)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)');
}
});
$('#historyread').click(function () {
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '13 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead|EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '1 (EventNotifierSubscribeToEvents)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '4 (EventNotifierHistoryRead)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '8 (EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '0 (None)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)');
}
});
$('#historywrite').click(function () {
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '13 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead|EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '1 (EventNotifierSubscribeToEvents)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '4 (EventNotifierHistoryRead)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '8 (EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '0 (None)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
$('#instanceeventnotifier').attr('placeholder', '5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)');
}
if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)');
}
if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
$('#instanceeventnotifier').attr('placeholder', '9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)');
}
});