123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- $( 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'
- });
- });
- $('#New').click(function () {
- console.log('New project');
- var ul = 'http://127.0.0.1:3001/';
- $.ajax({
- url: ul+'new_project',
- type: 'GET', // http method
- success: function (resp, status, xhr) {
- console.log('Success');
- },
- error: function (errorMessage) {
- console.log('Error: ' + errorMessage);
- }
- });
- });
- $('#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.nsindex;
- var nid = data.node.id;
- var nc = data.node.data.nodeclass;
- $('#instancenodeid').val(data.node.id);
- $('#instancenodeidtype').val(data.node.data.nodeidtype);
- $('#instancename').val(data.node.text);
- $('#instancenamespace').val(data.node.data.nsindex +":"+data.node.data.nsurl );
- $('#instancedisplayname1').val("");
- $('#instancedisplayname2').val(data.node.data.displayname);
- $('#instancebrowsename1').text(x);
- $('#instancebrowsename2').val(":"+data.node.data.displayname);
-
- $('#instancenodeclass').val(nc);
- if(nc == "Object"){
- //$('#instancetypedefinition').val(data.node.data.eventnotifier);
-
- var plc = "";
- switch(data.node.data.eventnotifier){
- 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);
-
- 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"){
- $('#datatype').val(data.node.data.datatype);
- $('#variablevalue').val(data.node.data.value);
- $('#variablevaluerank').val(data.node.data.valuerank);
- $('#variablearraydimensions').val(data.node.data.arraydimensions);
- var aclev = data.node.data.accesslevel;
- var plc = "";
- switch(aclev){
- 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 = "";
- }
- $('#instanceaccesslevel').val(data.node.data.accesslevel);
- $('#accesslevelex').val(data.node.data.accesslevelex);
- $('#variablehistorizing').val(data.node.data.historizing);
- $('#minimumsamplinginterval').val(data.node.data.minsamplinginterval);
-
- $('#variableattributesbutton').prop('disabled', false);
- $('#collapseTwo').collapse('hide');
- $('#objectattributesbutton').prop('disabled',true);
- $('#collapseTwo2').collapse('hide');
- $('#methodattributesbutton').prop('disabled',true);
- }
- if(data.node.data.nodeclass == "Method"){
- //$('#writemask').val(data.node.data.accesslevelex);
- if(data.node.data.executable == 1){
- $('#executablemethodcheck').prop('checked', true);
- }else if(data.node.data.executable == 0){
- $('#executablemethodcheck').prop('checked', false);
- }
- $('#methodattributesbutton').prop('disabled',false);
- $('#collapseTwo').collapse('hide');
- $('#objectattributesbutton').prop('disabled',true);
- $('#collapseTwo1').collapse('hide');
- $('#variableattributesbutton').prop('disabled',true);
- }
-
- });
-
- $('#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 = "<li><a class='dropdown-item' href='#'>"+num_ns+"</a></li>"
- $('#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)');
- }
- });
|