myEvents.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. $( document ).ready(function() {
  2. console.log( "ready!" );
  3. $.ajax({
  4. url: 'http://localhost:3001/require/all',
  5. error: function() {
  6. console.log("Error");
  7. },
  8. dataType: 'text',
  9. success: function(data) {
  10. console.log("success");
  11. },
  12. type: 'GET'
  13. });
  14. });
  15. $('#jstree_demo_div').on("open_node.jstree", function (e, data) {
  16. console.log(data.node);
  17. });
  18. $('#jstree_demo_div').on("select_node.jstree", function (e, data) {
  19. console.log(data);
  20. if(data.node.data.nodeclass == "Object"){
  21. $('#instancename').val(data.node.text);
  22. $('#instancenamespace').val(data.node.data.namespace);
  23. $('#instancenodeclass').val(data.node.data.nodeclass);
  24. //$('#instancetypedefinition').val(data.node.data.);
  25. $('#instancenodeidtype').val();
  26. $('#instancenodeid').val(data.node.id);
  27. $('#instanceeventnotifier').attr('placeholder','1 (EventNotifierSubscribeToEvents)');
  28. $('#instancedisplayname1').val("");
  29. $('#instancedisplayname2').val(data.node.text);
  30. $('#instancebrowsename1').val(data.node.data.namespace);
  31. $('#instancebrowsename2').val(data.node.data.browsename);
  32. console.log("obj enabled");
  33. $('#objectattributesbutton').prop('disabled', false);
  34. $('#collapseTwo1').collapse('hide');
  35. $('#variableattributesbutton').prop('disabled',true);
  36. $('#collapseTwo2').collapse('hide');
  37. $('#methodattributesbutton').prop('disabled',true);
  38. }
  39. if(data.node.data.nodeclass == "Variable"){
  40. $('#variableattributesbutton').prop('disabled', false);
  41. $('#collapseTwo').collapse('hide');
  42. $('#objectattributesbutton').prop('disabled',true);
  43. $('#collapseTwo2').collapse('hide');
  44. $('#methodattributesbutton').prop('disabled',true);
  45. }
  46. if(data.node.data.nodeclass == "Method"){
  47. $('#methodattributesbutton').prop('disabled',false);
  48. $('#collapseTwo').collapse('hide');
  49. $('#objectattributesbutton').prop('disabled',true);
  50. $('#collapseTwo1').collapse('hide');
  51. $('#variableattributesbutton').prop('disabled',true);
  52. }
  53. /*$.ajax({
  54. url: 'http://127.0.0.1:3001',
  55. type: 'POST', // http method
  56. data: { key_id: name }, // data to submit
  57. success: function (data, status, xhr) {
  58. $('p').append('status: ' + status + ', data: ' + data);
  59. },
  60. error: function (jqXhr, textStatus, errorMessage) {
  61. $('p').append('Error: ' + errorMessage);
  62. }
  63. });*/
  64. });
  65. $('#nodesetfile').on("open", function (e, data) {
  66. console.log('hello');
  67. });
  68. $('#changeinstance').click(function () {
  69. console.log('hello');
  70. });
  71. $('#savenodespecification').click(function () {
  72. console.log('save this');
  73. console.log($('#instancename').val());
  74. console.log($('#instancenamespace').val());
  75. console.log($('#instancenodeclass').val());
  76. console.log($('#instancetypedefinition').val());
  77. console.log($('#instancenodeidtype').val());
  78. console.log($('#instancenodeid').val());
  79. console.log($('#instanceeventnotifier').attr('placeholder'));
  80. console.log($('#instancedisplayname1').val());
  81. console.log($('#instancedisplayname2').val());
  82. console.log($('#instancebrowsename1').val());
  83. });
  84. $('#numericnodeid').click(function () {
  85. console.log("It is number");
  86. $('#instancenodeidtype').text('Numeric')
  87. });
  88. $('#stringnodeid').click(function () {
  89. console.log("It is string");
  90. $('#instancenodeidtype').text('String')
  91. });
  92. $('#guidnodeid').click(function () {
  93. console.log("It is guid");
  94. $('#instancenodeidtype').text('Guid')
  95. });
  96. $('#opaquenodeid').click(function () {
  97. console.log("It is opaque");
  98. $('#instancenodeidtype').text('Opaque')
  99. });
  100. $('#instancebrowsename1').click(function () {
  101. console.log("Add the script");
  102. var sz = parseInt($('#namespaceidxbrowsename').attr("size"));
  103. console.log(sz);
  104. var num_ns = "6";
  105. var nnum = parseInt(num_ns);
  106. if(sz < nnum){
  107. var lin = "<li><a class='dropdown-item' href='#'>"+num_ns+"</a></li>"
  108. $('#namespaceidxbrowsename').append(lin);
  109. $('#namespaceidxbrowsename').attr("size",num_ns);
  110. }
  111. });
  112. $('#subscribeevents').click(function () {
  113. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
  114. $('#instanceeventnotifier').attr('placeholder', '13 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead|EventNotifierHistoryWrite)');
  115. }
  116. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
  117. $('#instanceeventnotifier').attr('placeholder', '1 (EventNotifierSubscribeToEvents)');
  118. }
  119. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
  120. $('#instanceeventnotifier').attr('placeholder', '4 (EventNotifierHistoryRead)');
  121. }
  122. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
  123. $('#instanceeventnotifier').attr('placeholder', '8 (EventNotifierHistoryWrite)');
  124. }
  125. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
  126. $('#instanceeventnotifier').attr('placeholder', '0 (None)');
  127. }
  128. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
  129. $('#instanceeventnotifier').attr('placeholder', '5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)');
  130. }
  131. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
  132. $('#instanceeventnotifier').attr('placeholder', '12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)');
  133. }
  134. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
  135. $('#instanceeventnotifier').attr('placeholder', '9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)');
  136. }
  137. });
  138. $('#historyread').click(function () {
  139. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
  140. $('#instanceeventnotifier').attr('placeholder', '13 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead|EventNotifierHistoryWrite)');
  141. }
  142. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
  143. $('#instanceeventnotifier').attr('placeholder', '1 (EventNotifierSubscribeToEvents)');
  144. }
  145. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
  146. $('#instanceeventnotifier').attr('placeholder', '4 (EventNotifierHistoryRead)');
  147. }
  148. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
  149. $('#instanceeventnotifier').attr('placeholder', '8 (EventNotifierHistoryWrite)');
  150. }
  151. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
  152. $('#instanceeventnotifier').attr('placeholder', '0 (None)');
  153. }
  154. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
  155. $('#instanceeventnotifier').attr('placeholder', '5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)');
  156. }
  157. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
  158. $('#instanceeventnotifier').attr('placeholder', '12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)');
  159. }
  160. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
  161. $('#instanceeventnotifier').attr('placeholder', '9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)');
  162. }
  163. });
  164. $('#historywrite').click(function () {
  165. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
  166. $('#instanceeventnotifier').attr('placeholder', '13 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead|EventNotifierHistoryWrite)');
  167. }
  168. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
  169. $('#instanceeventnotifier').attr('placeholder', '1 (EventNotifierSubscribeToEvents)');
  170. }
  171. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
  172. $('#instanceeventnotifier').attr('placeholder', '4 (EventNotifierHistoryRead)');
  173. }
  174. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
  175. $('#instanceeventnotifier').attr('placeholder', '8 (EventNotifierHistoryWrite)');
  176. }
  177. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==false ){
  178. $('#instanceeventnotifier').attr('placeholder', '0 (None)');
  179. }
  180. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==false ){
  181. $('#instanceeventnotifier').attr('placeholder', '5 (EventNotifierSubscribeToEvents|EventNotifierHistoryRead)');
  182. }
  183. if($('#subscribeevents').prop('checked')==false && $('#historyread').prop('checked')==true && $('#historywrite').prop('checked')==true ){
  184. $('#instanceeventnotifier').attr('placeholder', '12 (EventNotifierHistoryRead|EventNotifierHistoryWrite)');
  185. }
  186. if($('#subscribeevents').prop('checked')==true && $('#historyread').prop('checked')==false && $('#historywrite').prop('checked')==true ){
  187. $('#instanceeventnotifier').attr('placeholder', '9 (EventNotifierSubscribeToEvents|EventNotifierHistoryWrite)');
  188. }
  189. });