Commit 92c144ba authored by Fintan Mc Gee's avatar Fintan Mc Gee

FIxd issue where names and unpdated datat were not saved on sere ( added...

FIxd issue where names and unpdated datat were not saved on sere ( added functinality ot u'date node data on the server)
parent 9769f464
......@@ -292,21 +292,6 @@ angular.module('blizaarModule.controllers', [])
};
// add neighbours of the specified node to the UI (query to back end)
// $scope.expandNode = function(selectedNode) {
// console.log(" in Regular Expand Node");
// dataService.expandNode(filteringService.getFilterNodeList(), filteringService.getFilterEdgeList(), selectedNode).then(function (data) {
// // $scope.model.expandNodeMessage = data;
//
//
// tooltipService.showTextAsTooltip(data, $scope.model.mouseEvent);
// // Send the message once the dom is ready
// angular.element(document).ready(function () {
// $rootScope.$broadcast ('refreshGraph');
// });
// });
// };
$scope.expandNode = function(selectedNode) {
console.log(" in New Expand Node");
//(nodeLabels, relationshipTypes, targetNode, includeEdges,attributeConstraints)
......
......@@ -111,6 +111,14 @@ angular.module('blizaarModule.controllers')
//graphLayeringService.doLayeringByGraphType(dataSource,false); // false is to prevent a new layout
// no layering as layering should be as saved
//updateBioAttributes
if(dataSource === "Bio") {
graphLayeringService.createBioNodeInfoAndBarAttributes();
} else if (dataSource ==="histograph"){
graphLayeringService.createDHNodeInfoAndBarAttributes()
}
graphFileAndRenderingService.renderUserServerGraph();
});
};
......
......@@ -30,8 +30,9 @@ angular.module('blizaarModule.controllers')
nodeLinkList:{name: "nodeLinkList",fullName: "Node Link List",enabled: true, index:1},
smallMultiples:{name: "smallMultiples",fullName: "Small Multiples",enabled: true, index:12},
layerComparison:{name: "layerComparison",fullName: "Layer Comparison",enabled: true, index:13},
admin: {name: "admin",fullName: "Admin",enabled: true, index:14},
svgView:{name: "svgView", fullName:"SVG",enabled: true, index:15}};
nodeLinkAttribute:{name: "nodeLinkAttribute", fullName: "Node Link Attribute",enabled:true, index: 14},
admin: {name: "admin",fullName: "Admin",enabled: true, index:15},
svgView:{name: "svgView", fullName:"SVG",enabled: true, index:16}};
$scope.isActive = function(viewLocation){
return viewLocation === $location.path();
......
......@@ -14,6 +14,7 @@ angular.module('blizaarModule.controllers')
$scope.model = {};
$scope.model.nodeLinkLayerName = "";
$scope.model.availableLayers = [];
$scope.model.selectedAspect = "Master"
/**************************************
* initializeNodeLinkDisplay()
......@@ -23,12 +24,29 @@ angular.module('blizaarModule.controllers')
* Date: 24/01/2019
*******************************/
$scope.initializeNodeLinkDisplay = function(){
$scope.model.availableLayers = multiLayerGraphService.getLayerNames();
if( $scope.model.availableLayers.length ) {
$scope.model.nodeLinkLayerName = $scope.model.availableLayers[0];
$scope.model.availableLayers = [];
$scope.model.nodeLinkLayerName = $scope.getCurrentlySelectedLayer();
$scope.model.selectedAspect = $scope.getGlobalSelectedAspect()
if(multiLayerGraphService.getGraph()) {
//$scope.model.selectedLayer = $scope.getCurrentlySelectedLayer();
if($scope.model.selectedAspect) {
$scope.model.availableLayers = [];
multiLayerGraphService.getGraph().getAspectLayers($scope.model.selectedAspect).forEach(function (layer) {
//if (layer.name !== $scope.model.selectedLayer) {
$scope.model.availableLayers.push(layer.name);
//}
});
if ($scope.model.availableLayers.indexOf($scope.model.nodeLinkLayerName ) > -1) {
$scope.model.nodeLinkLayerName = $scope.model.availableLayers[0];
}
}
}
};
$scope.$watch('model.nodeLinkLayerName', function(newData,oldData){
......@@ -41,6 +59,7 @@ angular.module('blizaarModule.controllers')
if(newData !== oldData) {
$scope.setCurrentlySelectedLayer($scope.model.nodeLinkLayerName);
$scope.refreshGraph()
}
});
......@@ -48,6 +67,12 @@ angular.module('blizaarModule.controllers')
return ["label", "type", "title"];
};
$scope.$on('refreshGraph', function(){
$scope.initializeNodeLinkDisplay();
// createChart();
})
$scope.initializeNodeLinkDisplay();
......
......@@ -38,6 +38,7 @@ angular.module('blizaarModule.directives')
if(params !== undefined && params.width !== undefined) {
chartWidth = parseInt(params.width);
}
var chartHeight = null;
if(params !== undefined && params.height !== undefined) {
chartHeight = parseInt(params.height);
......
......@@ -367,7 +367,7 @@ angular.module('blizaarModule.directives')
scope.$on('selectionChanged', function(selectionEvent, selectionData){
doRefresh(true);
if(selectinData) {
if(selectionData) {
if (selectionData.add.length) {
}
......
......@@ -2555,16 +2555,23 @@ var MultiLayerGraph = function (nodes, links, layerName) {
return labelFound;
}
// coppys all distinct attibutes for source to target without overwiritng existing ones.
// retuns a simple objet containin all ne values
g.copyDistinctNodeAttributes= function(sourceUId, targetUId) {
var sourceNode = g.node[sourceUId],
targetNode = g.node[targetUId];
var updateObj = {};
if(sourceNode && targetNode) {
for(var nodeAttrib in sourceNode) {
if(!targetNode.hasOwnProperty(nodeAttrib)) {
targetNode[nodeAttrib] = sourceNode[nodeAttrib];
updateObj[nodeAttrib] = sourceNode[nodeAttrib];
}
}
}
return updateObj;
}
......
......@@ -879,7 +879,7 @@ angular.module('blizaarModule.services')
* Created By : Fintan McGee (LIST)
* Date: 03/03/2016
*******************************/
updateNodeDataToServer : function(nodeLayerName,nodeUids,nodePropName,nodePropValue) {
updateNodeDataToServer : function(nodeLayerName,nodeUids,nodePropObj) {
if(!Array.isArray(nodeUids)) {
nodeUids = [nodeUids];
......@@ -889,11 +889,10 @@ angular.module('blizaarModule.services')
method: 'post',
url: '/updateNodeData', // url where to get data.
headers: { 'Content-Type': 'application/json' }, // set the headers so angular passing info as form data (not request payload)
data: { graphName: self.currentGraphName,
data: { graphName: self.currenytGraphName,
nodeLayerName:nodeLayerName,
nodeUids: nodeUids,
nodePropName:nodePropName,
nodePropValue: nodePropValue
nodePropObj: nodePropObj // used when multiple fields are to be updated, key
}
})// Success case
.then(function (response) {
......
This diff is collapsed.
......@@ -4,13 +4,14 @@
* This service is used to display information about hovered node
*/
angular.module('blizaarModule.services')
.factory('nodeInfoService', ['multiLayerGraphService',function (multiLayerGraphService) {
.factory('nodeInfoService', ['multiLayerGraphService', 'dataService',function (multiLayerGraphService,dataService) {
return {
nodesAttributes : ["thumbnail","wikipedia_link", "wikidata_link","type", "id","description", "abstract_en" ],
nodeImages :["thumbnail"],
nodeHyperLinks: ["wikipedia_link", "wikidata_link"],
nodeChartAttributes: [],
linksAttributes : [],
UnicAttributes : {},
......@@ -58,7 +59,19 @@ angular.module('blizaarModule.services')
getLinkAttributeIndex : function(att){
return this.linksAttributes.indexOf(att);
},
showCustomInfoForNode : function(node, layerName){
showCustomInfoForNode : function(node, layerName) {
if (dataService.currentGraphName === "histograph"){
this.showCustomInfoForDHNode(node, layerName);
}
if (dataService.currentGraphName === "Bio"){
//this.showCustomInfoForBioNode(node, layerName);
this.showCustomInfoForDHNode(node, layerName);
}
},
showCustomInfoForBioNode : function(node, layerName){
// Remove old one
//();
......@@ -132,6 +145,82 @@ angular.module('blizaarModule.services')
nodeInfoDiv.style('top',y_pos+"px")
}
// console.log("TooltipDrawn");
}
},
showCustomInfoForDHNode : function(node, layerName){
// Remove old one
//();
// get the #tooltip div
//
if(!layerName) {
layerName = "MasterLayer";
}
var nodeInfo = d3.select('#nodeInfo');
var nodeInfoText = "";
// tooltipText = " (" + d3.event.pageX+ "," + d3.event.pageY+ ")<br>"; // DEBUG text
for(var i=0;i<this.nodesAttributes.length;i++){
if(typeof(node[this.nodesAttributes[i]]) !== 'undefined')
if(this.nodeImages.indexOf(this.nodesAttributes[i]) > -1){
// nodeInfoText += "<b>" + this.nodesAttributes[i] + ": </b><img src=\"" + node[this.nodesAttributes[i]] + "\" height=\"150\"><br>";
nodeInfoText += "<b>" + this.nodesAttributes[i] + ": </b><img src=\"" + multiLayerGraphService.getNodePropertyValue(node.uid,this.nodesAttributes[i],layerName) + "\" height=\"150\"><br>";
}
else if(this.nodeHyperLinks.indexOf(this.nodesAttributes[i]) > -1) {
nodeInfoText += "<b><a href=\"" +multiLayerGraphService.getNodePropertyValue(node.uid,this.nodesAttributes[i],layerName)+ "\" target = \"_blank\">" + this.nodesAttributes[i] + "</a></b>:<br>";
}
else {
nodeInfoText += "<b>" + this.nodesAttributes[i] + ": </b>" + multiLayerGraphService.getNodePropertyValue(node.uid,this.nodesAttributes[i],layerName)+ "<br>";
}
}
//tooltipText+="<b>"+"Zserie"+": </b>"+node["zseri"]+"<br>";
if(nodeInfoText === "")
return;
var x_pos = d3.event.pageX +10, y_pos = d3.event.pageY+10;
var nodeInfoId = "nodeInfo_" +node.uid
var nodeInfoDiv = nodeInfo.append('div')
.attr('class', 'tooltip')
.attr('id',nodeInfoId)
.style('opacity', '0.9')
.style('left', x_pos+"px")
.style('top',y_pos+"px")
.style('width', "500px")
// .style('pointer-events', 'none')
.on("contextmenu", function(data) {
d3.event.preventDefault();
console.log("Nodie Info click: " + JSON.stringify(data));
nodeInfo.selectAll("#" + nodeInfoId).transition()
.duration(100)
.style("opacity", 1e-6)
.remove();
})
.call(d3.drag()
.on("drag", dragged))
.html(nodeInfoText);
function dragged(d) {
console.log("Draggin;")
var event_info = d3.event;
var oldLeft = parseInt(d3.select(this).style("left"));
var oldTop = parseInt(d3.select(this).style("top"));
d3.select(this).style("left", oldLeft + event_info.dx + "px").style("top", oldTop + event_info.dy + "px");
}
var bounds = nodeInfoDiv.node().getBoundingClientRect();
if(bounds.x > window.innerWidth / 2) {
x_pos = x_pos - bounds.width -20;
nodeInfoDiv.style('left', x_pos+"px")
}
if(bounds.y > window.innerHeight / 2) {
y_pos = y_pos - bounds.height -20;
nodeInfoDiv.style('top',y_pos+"px")
}
// console.log("TooltipDrawn");
}
};
}]);
\ No newline at end of file
......@@ -18,9 +18,9 @@ module.exports = {
Rserve_host: "127.0.0.1",
Rserve_port: "6311",
views: {
admin: ["loadData", "svgView","nodeLink", "canvas2dView", "sigmaView","webglView","hiveplotList","Multiple_Edges", "hiveplot", "setGraphQBE", "list","nodeLinkList","DHList", "bioList","smallMultiples","layerComparison","admin"],
admin: ["loadData", "svgView","nodeLink", "canvas2dView", "sigmaView","webglView","hiveplotList","Multiple_Edges", "hiveplot", "setGraphQBE", "list","nodeLinkList","nodeLinkAttribute","DHList", "bioList","smallMultiples","layerComparison","admin"],
cvce: ["DHList","nodeLink","setGraphQBE", "svgView", "hiveplot","hiveplotList","nodeLinkList","smallMultiples","layerComparison"],
biology:[ "setGraphQBE","bioList","nodeLink","svgView", "hiveplot","hiveplotList", "nodeLinkList","smallMultiples","layerComparison"],
biology:[ "setGraphQBE","bioList","nodeLink","svgView", "hiveplot","hiveplotList", "nodeLinkList","nodeLinkAttribute","smallMultiples","layerComparison"],
//default: ["loadData", "svgView", "Multiple_Edges", "hiveplot", "setGraphQBE", "list","DHList","bioList","nodeLinkList","smallMultiples"]
default: []
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment