$( 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); var x = data.node.data.idx; var nid = data.node.id; var nc = data.node.data.nodeclass; if(nc == "Object"){ var ul = 'http://127.0.0.1:3001/look/'+x+'/'+nid+'/'+nc+'/'; $.ajax({ url: ul+'name', type: 'GET', // http method success: function (resp, status, xhr) { $('#instancename').val(resp.result); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ' + errorMessage); } }); //$('#instancename').val(data.node.text); $.ajax({ url: ul+'nsurl', type: 'GET', // http method success: function (resp, status, xhr) { $('#instancenamespace').val(resp.result); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ' + errorMessage); } }); $('#instancenodeclass').val(nc); //$('#instancetypedefinition').val(data.node.data.); $('#instancenodeidtype').val(); $.ajax({ url: ul+'nodeidtype', type: 'GET', // http method success: function (resp, status, xhr) { $('#instancenodeidtype').val(resp.result); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ' + errorMessage); } }); $('#instancenodeid').val(nid); $.ajax({ url: ul+'eventnotifier', type: 'GET', // http method success: function (resp, status, xhr) { var plc = ""; switch(resp.result){ case 0: plc = "0 (None)"; break; case 1: plc = "1 (EventNotifierSubscribeToEvents)"; break; case 4: plc = "4 (EventNotifierHistoryRead)"; break; case 5: plc = "5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)"; break; case 8: plc = "8 (EventNotifierHistoryWrite)"; break; case 9: plc = "9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)"; break; case 12: plc = "12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)"; break; default: plc = ""; } $('#instanceeventnotifier').attr('placeholder',plc); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ' + errorMessage); } }); $('#instancedisplayname1').val(""); $.ajax({ url: ul+'displayname', type: 'GET', // http method success: function (resp, status, xhr) { $('#instancedisplayname2').val(resp.result); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ' + errorMessage); } }); //$('#instancedisplayname2').val(data.node.text); $.ajax({ url: ul+'displayname', type: 'GET', // http method success: function (resp, status, xhr) { $('#instancebrowsename2').val(resp.result); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ' + errorMessage); } }); 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"){ /*$.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); } });*/ $('#variableattributesbutton').prop('disabled', false); $('#collapseTwo').collapse('hide'); $('#objectattributesbutton').prop('disabled',true); $('#collapseTwo2').collapse('hide'); $('#methodattributesbutton').prop('disabled',true); } if(data.node.data.nodeclass == "Method"){ /*$.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); } });*/ $('#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)'); } });