Bladeren bron

new version of lazy handler

DS 1 jaar geleden
bovenliggende
commit
4988308502
3 gewijzigde bestanden met toevoegingen van 1331 en 376 verwijderingen
  1. 1218 358
      Backend/services.js
  2. 8 9
      index.html
  3. 105 9
      js/myEvents.js

File diff suppressed because it is too large
+ 1218 - 358
Backend/services.js


+ 8 - 9
index.html

@@ -120,13 +120,8 @@
 					  </div>
 					<div class="row mb-3">
 						<label for="inputEmail3" class="col-sm-2 col-form-label">Namespace</label>
-						<div class="col-sm-10">						
-						  <select class="form-select form-select-sm" aria-label=".form-select-sm example" id="instancenamespace">
-							  <option selected>http://yourorganisation.org/namespacename/</option>
-							  <option value="1">One</option>
-							  <option value="2">Two</option>
-							  <option value="3">Three</option>
-							</select>
+						<div class="col-sm-10">
+						  <input type="email" class="form-control" id="instancenamespace">
 						</div>
 					  </div>
 					<div class="row mb-3">
@@ -718,8 +713,12 @@
 					'data' : {
 							'url': "http://127.0.0.1:3001/lazy",
 						//'url' : "https://www.jstree.com/fiddle/?lazy", 
-						'data' : function (node) { 
-							return { 'id' : node.id }; 
+						'data' : function (node) {
+							if(node.id == '#'){
+							return { 'id' : node.id, 'nsindex': 0, 'nodeclass':'Object'}; 
+							}else{
+							return { 'id' : node.id, 'nsindex': node.data.nsindex, 'nodeclass':node.data.nodeclass}; 
+							}
 						} 
 					}
 				}					

+ 105 - 9
js/myEvents.js

@@ -21,18 +21,92 @@ $('#jstree_demo_div').on("open_node.jstree", function (e, data) {
 
 $('#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);
+	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();
-		$('#instancenodeid').val(data.node.id);
-		$('#instanceeventnotifier').attr('placeholder','1 (EventNotifierSubscribeToEvents)');
+		$.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("");
-		$('#instancedisplayname2').val(data.node.text);
-		$('#instancebrowsename1').val(data.node.data.namespace);
-		$('#instancebrowsename2').val(data.node.data.browsename);
+
+		$.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);
@@ -42,6 +116,17 @@ $('#jstree_demo_div').on("select_node.jstree", function (e, data) {
 		$('#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);
@@ -49,6 +134,17 @@ $('#jstree_demo_div').on("select_node.jstree", function (e, data) {
 		$('#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);