Sfoglia il codice sorgente

updated labels in RefGraph

Piotr Labudda 8 anni fa
parent
commit
d1e6809f8a
1 ha cambiato i file con 9 aggiunte e 2 eliminazioni
  1. 9 2
      SE/se-lib/Route/RefGraph.php.view.js

+ 9 - 2
SE/se-lib/Route/RefGraph.php.view.js

@@ -46,6 +46,9 @@ var _defaultVisJsOptions = {
 	}
 };
 
+function makeShortLabel(label) { // TODO: shorter name
+	return label;
+}
 
 (function () {
 	var form = document.getElementById('wfs_request')
@@ -139,6 +142,10 @@ function updateWfsResponse(features, featureTypeName) {
 				})
 
 				// view-source:http://visjs.org/examples/network/data/dynamicData.html
+				_nodes.update({
+					id: featureID,
+					label: makeShortLabel(selectedNode.id)
+				})
 				p5WFS_GetFeature(featureTypeName, wfsParams).then(function (features) {
 					if(DBG)console.log('features', features)
 					if (!features.length || 1 !== features.length) throw "Brak danych" // require 1 feature with recurse
@@ -189,7 +196,7 @@ function parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level) {
 		{
 			// _todoGraphData.nodes.add({ id: nodeId, label: nodeId })
 			if (!_todoGraphData[level]) _todoGraphData[level] = { nodes: [], edges: [] }
-			_todoGraphData[level].nodes.push({ id: nodeId, label: nodeId, group: objectName, _loaded: true })
+			_todoGraphData[level].nodes.push({ id: nodeId, label: makeShortLabel(nodeId), group: objectName, _loaded: true })
 			if (parentNodeId) {
 				// _graphData.edges.add({ id: parentNodeId+nodeId, from: parentNodeId, to: nodeId })
 				_todoGraphData[level].edges.push({ id: parentNodeId+nodeId, from: parentNodeId, to: nodeId })
@@ -216,7 +223,7 @@ function parseResponseXlinkListRec(_todoGraphData, json, typeName, parentNodeId,
 		{
 			// _graphData.nodes.add({ id: nodeId, label: nodeId })
 			if (!_todoGraphData[level]) _todoGraphData[level] = { nodes: [], edges: [] }
-			_todoGraphData[level].nodes.push({ id: nodeId, label: nodeId, group: objectName, _loaded: false })
+			_todoGraphData[level].nodes.push({ id: nodeId, label: makeShortLabel(nodeId) + ' (?)', group: objectName, _loaded: false })
 			if (parentNodeId) {
 				// _graphData.edges.add({ id: parentNodeId+nodeId, from: parentNodeId, to: nodeId })
 				_todoGraphData[level].edges.push({ id: parentNodeId+nodeId, from: parentNodeId, to: nodeId })