mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Fixed a bug that occured when editing nodes/edges, and jslintified
This commit is contained in:
parent
d99a9d4732
commit
69ab304624
|
@ -160,7 +160,13 @@ function ArangoAdapter(nodes, edges, config) {
|
|||
|
||||
getNRandom = function(n, callback) {
|
||||
var list = [],
|
||||
i = 0;
|
||||
i = 0,
|
||||
onSuccess = function(data) {
|
||||
list.push(data.document || {});
|
||||
if (list.length === n) {
|
||||
callback(list);
|
||||
}
|
||||
};
|
||||
for (i = 0; i < n; i++) {
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
@ -170,12 +176,7 @@ function ArangoAdapter(nodes, edges, config) {
|
|||
collection: nodeCollection
|
||||
}),
|
||||
contentType: "application/json",
|
||||
success: function(data) {
|
||||
list.push(data.document || {});
|
||||
if (list.length === n) {
|
||||
callback(list);
|
||||
}
|
||||
}
|
||||
success: onSuccess
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -169,7 +169,7 @@ function CommunityNode(parent, initial) {
|
|||
updateNodeArray();
|
||||
self._size++;
|
||||
},
|
||||
|
||||
|
||||
insertInitialNodes = function(ns) {
|
||||
_.each(ns, function(n) {
|
||||
nodes[n._id] = n;
|
||||
|
@ -409,11 +409,11 @@ function CommunityNode(parent, initial) {
|
|||
|
||||
addDistortion = function(distFunc) {
|
||||
if (self._expanded) {
|
||||
var oldFocus = distFunc.focus();
|
||||
var newFocus = [
|
||||
oldFocus[0] - self.position.x,
|
||||
oldFocus[1] - self.position.y
|
||||
];
|
||||
var oldFocus = distFunc.focus(),
|
||||
newFocus = [
|
||||
oldFocus[0] - self.position.x,
|
||||
oldFocus[1] - self.position.y
|
||||
];
|
||||
distFunc.focus(newFocus);
|
||||
_.each(nodeArray, function(n) {
|
||||
n.position = distFunc(n);
|
||||
|
@ -447,13 +447,14 @@ function CommunityNode(parent, initial) {
|
|||
|
||||
shapeEdges = function(g, addQue) {
|
||||
var idFunction = function(d) {
|
||||
return d._id;
|
||||
};
|
||||
return d._id;
|
||||
},
|
||||
line,
|
||||
interior;
|
||||
if (self._expanded) {
|
||||
var line,
|
||||
interior = g
|
||||
.selectAll(".link")
|
||||
.data(intEdgeArray, idFunction);
|
||||
interior = g
|
||||
.selectAll(".link")
|
||||
.data(intEdgeArray, idFunction);
|
||||
// Append the group and class to all new
|
||||
interior.enter()
|
||||
.append("g")
|
||||
|
@ -469,7 +470,7 @@ function CommunityNode(parent, initial) {
|
|||
},
|
||||
|
||||
collapseNode = function(n) {
|
||||
removeOutboundEdgesFromNode(n)
|
||||
removeOutboundEdgesFromNode(n);
|
||||
};
|
||||
|
||||
////////////////////////////////////
|
||||
|
|
|
@ -176,7 +176,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
|||
searchAttrExampleList.appendChild(entry);
|
||||
entry.onclick = function() {
|
||||
searchAttrField.value = r;
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -402,4 +402,4 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
|||
graphViewer.loadGraph(startNode);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,10 @@ var modalDialogHelper = modalDialogHelper || {};
|
|||
});
|
||||
},
|
||||
|
||||
insertDecissionInput = function(idPre, idPost, group, text, isDefault, interior, contentTh, table) {
|
||||
insertModalRow,
|
||||
|
||||
insertDecissionInput = function(idPre, idPost, group,
|
||||
text, isDefault, interior, contentTh, table) {
|
||||
var input = document.createElement("input"),
|
||||
id = idPre + idPost,
|
||||
lbl = document.createElement("label");
|
||||
|
@ -283,56 +286,57 @@ var modalDialogHelper = modalDialogHelper || {};
|
|||
addLineButton.id = id + "_addLine";
|
||||
addLineButton.className = "graphViewer-icon-button gv-icon-small add";
|
||||
if (list.length > 0) {
|
||||
input.value = o.objects[0];
|
||||
input.value = list[0];
|
||||
}
|
||||
for (i = 1; i < list.length; i++) {
|
||||
addNewLine(list[i]);
|
||||
}
|
||||
},
|
||||
|
||||
insertModalRow = function(table, idprefix, o) {
|
||||
var tr = document.createElement("tr"),
|
||||
labelTh = document.createElement("th"),
|
||||
contentTh = document.createElement("th");
|
||||
table.appendChild(tr);
|
||||
tr.appendChild(labelTh);
|
||||
labelTh.className = "collectionTh";
|
||||
if (o.text) {
|
||||
labelTh.appendChild(document.createTextNode(o.text + ":"));
|
||||
} else {
|
||||
labelTh.className += " capitalize";
|
||||
if (o.type && o.type === "extenadable") {
|
||||
labelTh.appendChild(document.createTextNode(o.id + ":"));
|
||||
} else {
|
||||
labelTh.appendChild(document.createTextNode(o.id + ":"));
|
||||
}
|
||||
}
|
||||
tr.appendChild(contentTh);
|
||||
contentTh.className = "collectionTh";
|
||||
switch(o.type) {
|
||||
case "text":
|
||||
contentTh.appendChild(createTextInput(idprefix + o.id));
|
||||
break;
|
||||
case "checkbox":
|
||||
contentTh.appendChild(createCheckboxInput(idprefix + o.id));
|
||||
break;
|
||||
case "list":
|
||||
contentTh.appendChild(createListInput(idprefix + o.id, o.objects));
|
||||
break;
|
||||
case "extendable":
|
||||
insertExtendableInput(idprefix, o.id, o.objects, contentTh, table, tr);
|
||||
break;
|
||||
case "decission":
|
||||
insertDecissionInput(idprefix, o.id, o.group, o.text, o.isDefault, o.interior, contentTh, table);
|
||||
labelTh.innerHTML = "";
|
||||
break;
|
||||
default:
|
||||
//Sorry unknown
|
||||
table.removeChild(tr);
|
||||
break;
|
||||
}
|
||||
return tr;
|
||||
};
|
||||
|
||||
insertModalRow = function(table, idprefix, o) {
|
||||
var tr = document.createElement("tr"),
|
||||
labelTh = document.createElement("th"),
|
||||
contentTh = document.createElement("th");
|
||||
table.appendChild(tr);
|
||||
tr.appendChild(labelTh);
|
||||
labelTh.className = "collectionTh";
|
||||
if (o.text) {
|
||||
labelTh.appendChild(document.createTextNode(o.text + ":"));
|
||||
} else {
|
||||
labelTh.className += " capitalize";
|
||||
if (o.type && o.type === "extenadable") {
|
||||
labelTh.appendChild(document.createTextNode(o.id + ":"));
|
||||
} else {
|
||||
labelTh.appendChild(document.createTextNode(o.id + ":"));
|
||||
}
|
||||
}
|
||||
tr.appendChild(contentTh);
|
||||
contentTh.className = "collectionTh";
|
||||
switch(o.type) {
|
||||
case "text":
|
||||
contentTh.appendChild(createTextInput(idprefix + o.id));
|
||||
break;
|
||||
case "checkbox":
|
||||
contentTh.appendChild(createCheckboxInput(idprefix + o.id));
|
||||
break;
|
||||
case "list":
|
||||
contentTh.appendChild(createListInput(idprefix + o.id, o.objects));
|
||||
break;
|
||||
case "extendable":
|
||||
insertExtendableInput(idprefix, o.id, o.objects, contentTh, table, tr);
|
||||
break;
|
||||
case "decission":
|
||||
insertDecissionInput(idprefix, o.id, o.group, o.text,
|
||||
o.isDefault, o.interior, contentTh, table);
|
||||
labelTh.innerHTML = "";
|
||||
break;
|
||||
default:
|
||||
//Sorry unknown
|
||||
table.removeChild(tr);
|
||||
break;
|
||||
}
|
||||
return tr;
|
||||
};
|
||||
|
||||
modalDialogHelper.modalDivTemplate = function (title, buttonTitle, idprefix, callback) {
|
||||
// Create needed Elements
|
||||
|
|
|
@ -251,7 +251,7 @@ function NodeShaperControls(list, shaper) {
|
|||
colourkey = $("#" + idprefix + "colour-attribute").attr("value"),
|
||||
selected = $("input[type='radio'][name='colour']:checked").attr("id");
|
||||
if (selected === idprefix + "samecolour") {
|
||||
colourkey = key
|
||||
colourkey = key;
|
||||
}
|
||||
shaper.changeTo({
|
||||
label: key,
|
||||
|
|
Loading…
Reference in New Issue