mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
ba7dbbea17
|
@ -289,7 +289,7 @@ pack-win64:
|
||||||
$(MAKE) pack-winXX BITS=64 TARGET="Visual Studio 12 Win64"
|
$(MAKE) pack-winXX BITS=64 TARGET="Visual Studio 12 Win64"
|
||||||
|
|
||||||
pack-win32-relative:
|
pack-win32-relative:
|
||||||
$(MAKE) pack-winXX BITS=32 TARGET="Visual Studio 12" MOREOPTS='-D "USE_RELATIVE=ON"'
|
$(MAKE) pack-winXX BITS=32 TARGET="Visual Studio 12" MOREOPTS='-D "USE_RELATIVE=ON" -D "USER_MAINTAINER_MODE=ON" -D "USE_BACKTRACE=ON"'
|
||||||
|
|
||||||
pack-win64-relative:
|
pack-win64-relative:
|
||||||
$(MAKE) pack-winXX BITS=64 TARGET="Visual Studio 12 Win64" MOREOPTS='-D "USE_RELATIVE=ON" -D "USER_MAINTAINER_MODE=ON" -D "USE_BACKTRACE=ON"'
|
$(MAKE) pack-winXX BITS=64 TARGET="Visual Studio 12 Win64" MOREOPTS='-D "USE_RELATIVE=ON" -D "USER_MAINTAINER_MODE=ON" -D "USE_BACKTRACE=ON"'
|
||||||
|
|
|
@ -2517,6 +2517,8 @@ div .tile, div .bigtile {
|
||||||
div .tile {
|
div .tile {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
width: 228px; }
|
width: 228px; }
|
||||||
|
div .tile-graph .tile-icon:hover {
|
||||||
|
cursor: pointer; }
|
||||||
div .bigtile {
|
div .bigtile {
|
||||||
height: 309px;
|
height: 309px;
|
||||||
width: 456px; }
|
width: 456px; }
|
||||||
|
@ -5112,6 +5114,8 @@ div .tile, div .bigtile {
|
||||||
div .tile {
|
div .tile {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
width: 228px; }
|
width: 228px; }
|
||||||
|
div .tile-graph .tile-icon:hover {
|
||||||
|
cursor: pointer; }
|
||||||
div .bigtile {
|
div .bigtile {
|
||||||
height: 309px;
|
height: 309px;
|
||||||
width: 456px; }
|
width: 456px; }
|
||||||
|
|
|
@ -270,8 +270,8 @@ function GharialAdapter(nodes, edges, viewer, config) {
|
||||||
self.NODES_TO_DISPLAY = 30;
|
self.NODES_TO_DISPLAY = 30;
|
||||||
self.TOTAL_NODES = 0;
|
self.TOTAL_NODES = 0;
|
||||||
|
|
||||||
self.customNodes = [];
|
self.definedNodes = [];
|
||||||
self.extraNodes = [];
|
self.randomNodes = [];
|
||||||
|
|
||||||
self.loadRandomNode = function(callback) {
|
self.loadRandomNode = function(callback) {
|
||||||
var collections = _.shuffle(self.getNodeCollections()), i;
|
var collections = _.shuffle(self.getNodeCollections()), i;
|
||||||
|
@ -282,7 +282,7 @@ function GharialAdapter(nodes, edges, viewer, config) {
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
_.each(list, function(node) {
|
_.each(list, function(node) {
|
||||||
self.extraNodes.push(node);
|
self.randomNodes.push(node);
|
||||||
});
|
});
|
||||||
self.loadInitialNode(list[0]._id, callback);
|
self.loadInitialNode(list[0]._id, callback);
|
||||||
return;
|
return;
|
||||||
|
@ -298,18 +298,19 @@ function GharialAdapter(nodes, edges, viewer, config) {
|
||||||
self.loadNode(nodeId, insertInitialCallback(callback));
|
self.loadNode(nodeId, insertInitialCallback(callback));
|
||||||
};
|
};
|
||||||
|
|
||||||
self.addCustomNodes = function () {
|
self.getRandomNodes = function () {
|
||||||
|
|
||||||
var nodeArray = [];
|
var nodeArray = [];
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
|
||||||
//if no extra nodes available, get "NODES_TO_DISPLAY"-random nodes
|
if (self.definedNodes.length > 0) {
|
||||||
if (self.customNodes.length > 0) {
|
_.each(self.definedNodes, function(node) {
|
||||||
nodes = self.customNodes;
|
nodes.push(node);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//else: get defined nodes
|
if (self.randomNodes.length > 0) {
|
||||||
else if (self.extraNodes.length > 0) {
|
_.each(self.randomNodes, function(node) {
|
||||||
nodes = self.extraNodes;
|
nodes.push(node);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
@ -335,7 +336,11 @@ function GharialAdapter(nodes, edges, viewer, config) {
|
||||||
example: nodeId
|
example: nodeId
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
|
|
||||||
_.each(self.addCustomNodes(), function(node) {
|
var nodes = [];
|
||||||
|
nodes = self.getRandomNodes();
|
||||||
|
|
||||||
|
if (nodes.length > 0) {
|
||||||
|
_.each(nodes, function(node) {
|
||||||
sendQuery(queries.traversal, {
|
sendQuery(queries.traversal, {
|
||||||
example: node.vertex._id
|
example: node.vertex._id
|
||||||
}, function(res2) {
|
}, function(res2) {
|
||||||
|
@ -345,6 +350,14 @@ function GharialAdapter(nodes, edges, viewer, config) {
|
||||||
parseResultOfTraversal(res, callback);
|
parseResultOfTraversal(res, callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendQuery(queries.traversal, {
|
||||||
|
example: nodeId
|
||||||
|
}, function(res) {
|
||||||
|
parseResultOfTraversal(res, callback);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -359,6 +372,35 @@ function GharialAdapter(nodes, edges, viewer, config) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getNodeExampleFromTreeByAttributeValue = function(attribute, value, callback) {
|
||||||
|
var example = {};
|
||||||
|
|
||||||
|
example[attribute] = value;
|
||||||
|
sendQuery(queries.traversal, {
|
||||||
|
example: example
|
||||||
|
}, function(res) {
|
||||||
|
|
||||||
|
if (res[0][0] === undefined) {
|
||||||
|
throw "No suitable nodes have been found.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_.each(res[0][0], function(node) {
|
||||||
|
var nodeToAdd = {};
|
||||||
|
nodeToAdd._key = node.vertex._key;
|
||||||
|
nodeToAdd._id = node.vertex._id;
|
||||||
|
nodeToAdd._rev = node.vertex._rev;
|
||||||
|
absAdapter.insertNode(nodeToAdd);
|
||||||
|
callback(nodeToAdd);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
self.loadAdditionalNodeByAttributeValue = function(attribute, value, callback) {
|
||||||
|
self.getNodeExampleFromTreeByAttributeValue(attribute, value, callback);
|
||||||
|
};
|
||||||
|
|
||||||
self.loadInitialNodeByAttributeValue = function(attribute, value, callback) {
|
self.loadInitialNodeByAttributeValue = function(attribute, value, callback) {
|
||||||
absAdapter.cleanUp();
|
absAdapter.cleanUp();
|
||||||
self.loadNodeFromTreeByAttributeValue(attribute, value, insertInitialCallback(callback));
|
self.loadNodeFromTreeByAttributeValue(attribute, value, insertInitialCallback(callback));
|
||||||
|
|
|
@ -191,7 +191,7 @@ function GraphViewer(svg, width, height, adapterConfig, config) {
|
||||||
//expand all wanted nodes
|
//expand all wanted nodes
|
||||||
if (expand) {
|
if (expand) {
|
||||||
_.each(nodes, function(node) {
|
_.each(nodes, function(node) {
|
||||||
_.each(adapter.extraNodes, function(compare) {
|
_.each(adapter.randomNodes, function(compare) {
|
||||||
if (node._id === compare._id) {
|
if (node._id === compare._id) {
|
||||||
node._expanded = true;
|
node._expanded = true;
|
||||||
}
|
}
|
||||||
|
@ -234,13 +234,33 @@ function GraphViewer(svg, width, height, adapterConfig, config) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.loadGraphWithAdditionalNode = function(attribute, value, callback) {
|
||||||
|
adapter.loadAdditionalNodeByAttributeValue(attribute, value, function (node) {
|
||||||
|
if (node.errorCode) {
|
||||||
|
callback(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node._expanded = true;
|
||||||
|
self.start();
|
||||||
|
if (_.isFunction(callback)) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
this.loadGraphWithAttributeValue = function(attribute, value, callback) {
|
this.loadGraphWithAttributeValue = function(attribute, value, callback) {
|
||||||
|
|
||||||
|
//clear random and defined nodes
|
||||||
|
adapter.randomNodes = [];
|
||||||
|
adapter.definedNodes = [];
|
||||||
|
|
||||||
adapter.loadInitialNodeByAttributeValue(attribute, value, function (node) {
|
adapter.loadInitialNodeByAttributeValue(attribute, value, function (node) {
|
||||||
if (node.errorCode) {
|
if (node.errorCode) {
|
||||||
callback(node);
|
callback(node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node._expanded = true;
|
node._expanded = true;
|
||||||
|
|
||||||
self.start();
|
self.start();
|
||||||
if (_.isFunction(callback)) {
|
if (_.isFunction(callback)) {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
@ -52,8 +52,6 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
edgeShaperUI,
|
edgeShaperUI,
|
||||||
adapterUI,
|
adapterUI,
|
||||||
slider,
|
slider,
|
||||||
searchAttrField,
|
|
||||||
searchAttrField2,
|
|
||||||
searchAttrExampleList,
|
searchAttrExampleList,
|
||||||
searchAttrExampleList2,
|
searchAttrExampleList2,
|
||||||
//mousePointerBox = document.createElement("div"),
|
//mousePointerBox = document.createElement("div"),
|
||||||
|
@ -79,6 +77,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
searchValueField = document.createElement("input"),
|
searchValueField = document.createElement("input"),
|
||||||
searchStart = document.createElement("img"),
|
searchStart = document.createElement("img"),
|
||||||
equalsField = document.createElement("span"),
|
equalsField = document.createElement("span"),
|
||||||
|
searchAttrField,
|
||||||
|
|
||||||
showSpinner = function() {
|
showSpinner = function() {
|
||||||
$(background).css("cursor", "progress");
|
$(background).css("cursor", "progress");
|
||||||
|
@ -128,7 +127,6 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
|
|
||||||
searchAttrDiv.className = "pull-left input-append searchByAttribute";
|
searchAttrDiv.className = "pull-left input-append searchByAttribute";
|
||||||
searchAttrField.id = "attribute";
|
searchAttrField.id = "attribute";
|
||||||
//searchAttrField.className = "input";
|
|
||||||
searchAttrField.type = "text";
|
searchAttrField.type = "text";
|
||||||
searchAttrField.placeholder = "Attribute name";
|
searchAttrField.placeholder = "Attribute name";
|
||||||
searchAttrExampleToggle.id = "attribute_example_toggle";
|
searchAttrExampleToggle.id = "attribute_example_toggle";
|
||||||
|
@ -183,6 +181,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
searchValueField2 = document.createElement("input"),
|
searchValueField2 = document.createElement("input"),
|
||||||
searchStart2 = document.createElement("img"),
|
searchStart2 = document.createElement("img"),
|
||||||
equalsField2 = document.createElement("span"),
|
equalsField2 = document.createElement("span"),
|
||||||
|
searchAttrField2,
|
||||||
|
|
||||||
showSpinner = function() {
|
showSpinner = function() {
|
||||||
$(background).css("cursor", "progress");
|
$(background).css("cursor", "progress");
|
||||||
|
@ -196,7 +195,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
window.alert(msg);
|
window.alert(msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
resultCB = function(res) {
|
resultCB2 = function(res) {
|
||||||
hideSpinner();
|
hideSpinner();
|
||||||
if (res && res.errorCode && res.errorCode === 404) {
|
if (res && res.errorCode && res.errorCode === 404) {
|
||||||
alertError("Sorry could not find a matching node.");
|
alertError("Sorry could not find a matching node.");
|
||||||
|
@ -205,19 +204,13 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
searchFunction = function() {
|
addCustomNode = function() {
|
||||||
showSpinner();
|
showSpinner();
|
||||||
if (searchAttrField.value === ""
|
if (searchAttrField2.value !== "") {
|
||||||
|| searchAttrField.value === undefined) {
|
graphViewer.loadGraphWithAdditionalNode(
|
||||||
graphViewer.loadGraph(
|
searchAttrField2.value,
|
||||||
searchValueField.value,
|
searchValueField2.value,
|
||||||
resultCB
|
resultCB2
|
||||||
);
|
|
||||||
} else {
|
|
||||||
graphViewer.loadGraphWithAttributeValue(
|
|
||||||
searchAttrField.value,
|
|
||||||
searchValueField.value,
|
|
||||||
resultCB
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -234,7 +227,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
searchAttrField2.id = "attribute";
|
searchAttrField2.id = "attribute";
|
||||||
searchAttrField2.type = "text";
|
searchAttrField2.type = "text";
|
||||||
searchAttrField2.placeholder = "Attribute name";
|
searchAttrField2.placeholder = "Attribute name";
|
||||||
searchAttrExampleToggle2.id = "attribute_example_toggle";
|
searchAttrExampleToggle2.id = "attribute_example_toggle2";
|
||||||
searchAttrExampleToggle2.className = "button-neutral gv_example_toggle";
|
searchAttrExampleToggle2.className = "button-neutral gv_example_toggle";
|
||||||
searchAttrExampleCaret2.className = "caret gv_caret";
|
searchAttrExampleCaret2.className = "caret gv_caret";
|
||||||
searchAttrExampleList2.className = "gv-dropdown-menu";
|
searchAttrExampleList2.className = "gv-dropdown-menu";
|
||||||
|
@ -259,10 +252,15 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
queryLine2.appendChild(searchValueField2);
|
queryLine2.appendChild(searchValueField2);
|
||||||
queryLine2.appendChild(searchStart2);
|
queryLine2.appendChild(searchStart2);
|
||||||
|
|
||||||
searchStart2.onclick = searchFunction;
|
updateAttributeExamples(searchAttrExampleList2);
|
||||||
|
//searchAttrExampleList2.onclick = function() {
|
||||||
|
// updateAttributeExamples(searchAttrExampleList2);
|
||||||
|
//};
|
||||||
|
|
||||||
|
searchStart2.onclick = addCustomNode;
|
||||||
$(searchValueField2).keypress(function(e) {
|
$(searchValueField2).keypress(function(e) {
|
||||||
if (e.keyCode === 13 || e.which === 13) {
|
if (e.keyCode === 13 || e.which === 13) {
|
||||||
searchFunction();
|
addCustomNode();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -344,7 +342,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
aNode.className = "headerButton";
|
aNode.className = "headerButton";
|
||||||
spanNode = document.createElement("span");
|
spanNode = document.createElement("span");
|
||||||
spanNode.className = "fa fa-search-plus";
|
spanNode.className = "fa fa-search-plus";
|
||||||
$(spanNode).attr("title", "Show custom nodes");
|
$(spanNode).attr("title", "Show additional nodes");
|
||||||
|
|
||||||
ul.appendChild(liNode);
|
ul.appendChild(liNode);
|
||||||
liNode.appendChild(aNode);
|
liNode.appendChild(aNode);
|
||||||
|
@ -480,32 +478,37 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
$("#control_event_expand").click();
|
$("#control_event_expand").click();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateAttributeExamples = function() {
|
updateAttributeExamples = function(e) {
|
||||||
searchAttrExampleList.innerHTML = "";
|
var element;
|
||||||
searchAttrExampleList2.innerHTML = "";
|
|
||||||
|
if (e) {
|
||||||
|
element = $(e);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
element = $(searchAttrExampleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.innerHTML = "";
|
||||||
var throbber = document.createElement("li"),
|
var throbber = document.createElement("li"),
|
||||||
throbberImg = document.createElement("img");
|
throbberImg = document.createElement("img");
|
||||||
throbber.appendChild(throbberImg);
|
$(throbber).append(throbberImg);
|
||||||
throbberImg.className = "gv-throbber";
|
throbberImg.className = "gv-throbber";
|
||||||
searchAttrExampleList.appendChild(throbber);
|
element.append(throbber);
|
||||||
searchAttrExampleList2.appendChild(throbber);
|
|
||||||
graphViewer.adapter.getAttributeExamples(function(res) {
|
graphViewer.adapter.getAttributeExamples(function(res) {
|
||||||
searchAttrExampleList.innerHTML = "";
|
$(element).html('');
|
||||||
searchAttrExampleList2.innerHTML = "";
|
|
||||||
_.each(res, function(r) {
|
_.each(res, function(r) {
|
||||||
var entry = document.createElement("li"),
|
var entry = document.createElement("li"),
|
||||||
link = document.createElement("a"),
|
link = document.createElement("a"),
|
||||||
lbl = document.createElement("label");
|
lbl = document.createElement("label");
|
||||||
entry.appendChild(link);
|
$(entry).append(link);
|
||||||
link.appendChild(lbl);
|
$(link).append(lbl);
|
||||||
lbl.appendChild(document.createTextNode(r));
|
$(lbl).append(document.createTextNode(r));
|
||||||
lbl.className = "gv_dropdown_label";
|
lbl.className = "gv_dropdown_label";
|
||||||
searchAttrExampleList.appendChild(entry);
|
element.append(entry);
|
||||||
searchAttrExampleList2.appendChild(entry);
|
|
||||||
entry.onclick = function() {
|
entry.onclick = function() {
|
||||||
searchAttrField.value = r;
|
element.value = r;
|
||||||
$(searchAttrExampleList).slideToggle(200);
|
$(element).parent().find('input').val(r);
|
||||||
$(searchAttrExampleList2).slideToggle(200);
|
$(element).slideToggle(200);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
"click #deleteDocumentButton" : "deleteDocumentModal",
|
"click #deleteDocumentButton" : "deleteDocumentModal",
|
||||||
"click #confirmDeleteDocument" : "deleteDocument",
|
"click #confirmDeleteDocument" : "deleteDocument",
|
||||||
"click #document-from" : "navigateToDocument",
|
"click #document-from" : "navigateToDocument",
|
||||||
"click #document-to" : "navigateToDocument",
|
"click #document-to" : "navigateToDocument"
|
||||||
"dblclick #documentEditor tr" : "addProperty"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
editor: 0,
|
editor: 0,
|
||||||
|
@ -157,42 +156,6 @@
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
addProperty: function (e) {
|
|
||||||
var node, searchResult;
|
|
||||||
try {
|
|
||||||
node = e.currentTarget.cells[2].childNodes[0].
|
|
||||||
childNodes[0].childNodes[0].childNodes[1].
|
|
||||||
childNodes[0].textContent;
|
|
||||||
} catch (ex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (node) {
|
|
||||||
if (node === "object") {
|
|
||||||
if (_.isEmpty(this.editor.get())) {
|
|
||||||
this.editor.set({
|
|
||||||
"": ""
|
|
||||||
});
|
|
||||||
this.editor.node.childs[0].focus("field");
|
|
||||||
} else {
|
|
||||||
this.editor.node.childs[0]._onInsertBefore(undefined, undefined, "auto");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
searchResult = this.editor.node.search(node);
|
|
||||||
var breakLoop = false;
|
|
||||||
searchResult.forEach(function (s) {
|
|
||||||
if (breakLoop) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (s.elem === "field" ) {
|
|
||||||
s.node._onInsertAfter(undefined, undefined, "auto");
|
|
||||||
breakLoop = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
removeReadonlyKeys: function (object) {
|
removeReadonlyKeys: function (object) {
|
||||||
return _.omit(object, ["_key", "_id", "_from", "_to", "_rev"]);
|
return _.omit(object, ["_key", "_id", "_from", "_to", "_rev"]);
|
||||||
},
|
},
|
||||||
|
|
|
@ -229,6 +229,12 @@ div {
|
||||||
width: $tile-width - 12px;
|
width: $tile-width - 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .tile-graph {
|
||||||
|
.tile-icon:hover {
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
& .bigtile {
|
& .bigtile {
|
||||||
@extend %clickable;
|
@extend %clickable;
|
||||||
@extend %tile;
|
@extend %tile;
|
||||||
|
|
|
@ -50,8 +50,7 @@
|
||||||
"click #deleteDocumentButton" : "deleteDocumentModal",
|
"click #deleteDocumentButton" : "deleteDocumentModal",
|
||||||
"click #confirmDeleteDocument" : "deleteDocument",
|
"click #confirmDeleteDocument" : "deleteDocument",
|
||||||
"click #document-from" : "navigateToDocument",
|
"click #document-from" : "navigateToDocument",
|
||||||
"click #document-to" : "navigateToDocument",
|
"click #document-to" : "navigateToDocument"
|
||||||
"dblclick #documentEditor tr" : "addProperty"
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -285,252 +284,6 @@
|
||||||
expect(view.escaped('&<>"\'')).toEqual("&<>"'");
|
expect(view.escaped('&<>"\'')).toEqual("&<>"'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should addProperty in existing json document", function () {
|
|
||||||
|
|
||||||
var eDummy = {
|
|
||||||
currentTarget : {
|
|
||||||
cells : [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
textContent : "bla"
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}, editorDummy = {
|
|
||||||
|
|
||||||
node : {
|
|
||||||
search : function () {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}, nodeDummy1 = {elem : "value", node : {_onInsertAfter : function () {}}},
|
|
||||||
nodeDummy2 = {elem : "field", node : {_onInsertAfter : function () {}}} ;
|
|
||||||
spyOn(editorDummy.node, "search").andReturn([
|
|
||||||
nodeDummy1,
|
|
||||||
nodeDummy2,
|
|
||||||
nodeDummy1
|
|
||||||
]);
|
|
||||||
spyOn(nodeDummy1.node, "_onInsertAfter");
|
|
||||||
spyOn(nodeDummy2.node, "_onInsertAfter");
|
|
||||||
view.editor = editorDummy;
|
|
||||||
|
|
||||||
view.addProperty(eDummy);
|
|
||||||
|
|
||||||
|
|
||||||
expect(editorDummy.node.search).toHaveBeenCalledWith("bla");
|
|
||||||
expect(nodeDummy1.node._onInsertAfter).not.toHaveBeenCalled();
|
|
||||||
expect(nodeDummy2.node._onInsertAfter).toHaveBeenCalledWith(
|
|
||||||
undefined, undefined, "auto");
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
it("should addProperty in existing json document in first position", function () {
|
|
||||||
|
|
||||||
var eDummy = {
|
|
||||||
currentTarget : {
|
|
||||||
cells : [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
textContent : "object"
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}, editorDummy = {
|
|
||||||
|
|
||||||
node : {
|
|
||||||
search : function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
childs : [
|
|
||||||
{
|
|
||||||
focus : function () {},
|
|
||||||
_onInsertBefore : function () {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
get : function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
set : function () {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}, nodeDummy1 = {elem : "value", _onInsertAfter : function () {}},
|
|
||||||
nodeDummy2 = {elem : "value", _onInsertAfter : function () {}} ;
|
|
||||||
spyOn(editorDummy.node, "search").andReturn([
|
|
||||||
nodeDummy1,
|
|
||||||
nodeDummy2,
|
|
||||||
nodeDummy1
|
|
||||||
]);
|
|
||||||
spyOn(nodeDummy1, "_onInsertAfter");
|
|
||||||
spyOn(nodeDummy2, "_onInsertAfter");
|
|
||||||
|
|
||||||
spyOn(editorDummy, "get").andReturn([
|
|
||||||
nodeDummy1,
|
|
||||||
nodeDummy2,
|
|
||||||
nodeDummy1
|
|
||||||
]);
|
|
||||||
|
|
||||||
spyOn(editorDummy, "set");
|
|
||||||
spyOn(editorDummy.node.childs[0], "_onInsertBefore");
|
|
||||||
spyOn(editorDummy.node.childs[0], "focus");
|
|
||||||
|
|
||||||
view.editor = editorDummy;
|
|
||||||
|
|
||||||
view.addProperty(eDummy);
|
|
||||||
|
|
||||||
|
|
||||||
expect(editorDummy.node.search).not.toHaveBeenCalled();
|
|
||||||
expect(editorDummy.node.childs[0].focus).not.toHaveBeenCalled();
|
|
||||||
expect(editorDummy.node.childs[0]._onInsertBefore).toHaveBeenCalledWith(
|
|
||||||
undefined, undefined, "auto");
|
|
||||||
expect(editorDummy.get).toHaveBeenCalled();
|
|
||||||
expect(editorDummy.set).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it("should addProperty in new json document in first position", function () {
|
|
||||||
|
|
||||||
var eDummy = {
|
|
||||||
currentTarget : {
|
|
||||||
cells : [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
childNodes : [
|
|
||||||
{
|
|
||||||
textContent : "object"
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}, editorDummy = {
|
|
||||||
|
|
||||||
node : {
|
|
||||||
search : function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
childs : [
|
|
||||||
{
|
|
||||||
focus : function () {},
|
|
||||||
_onInsertBefore : function () {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
get : function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
set : function () {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}, nodeDummy1 = {elem : "value", _onInsertAfter : function () {}},
|
|
||||||
nodeDummy2 = {elem : "value", _onInsertAfter : function () {}} ;
|
|
||||||
spyOn(editorDummy.node, "search").andReturn([
|
|
||||||
nodeDummy1,
|
|
||||||
nodeDummy2,
|
|
||||||
nodeDummy1
|
|
||||||
]);
|
|
||||||
spyOn(nodeDummy1, "_onInsertAfter");
|
|
||||||
spyOn(nodeDummy2, "_onInsertAfter");
|
|
||||||
|
|
||||||
spyOn(editorDummy, "get").andReturn(undefined);
|
|
||||||
|
|
||||||
spyOn(editorDummy, "set");
|
|
||||||
spyOn(editorDummy.node.childs[0], "_onInsertBefore");
|
|
||||||
spyOn(editorDummy.node.childs[0], "focus");
|
|
||||||
|
|
||||||
view.editor = editorDummy;
|
|
||||||
|
|
||||||
view.addProperty(eDummy);
|
|
||||||
|
|
||||||
|
|
||||||
expect(editorDummy.node.search).not.toHaveBeenCalled();
|
|
||||||
expect(editorDummy.node.childs[0].focus).toHaveBeenCalledWith("field");
|
|
||||||
expect(editorDummy.node.childs[0]._onInsertBefore).not.toHaveBeenCalled();
|
|
||||||
expect(editorDummy.get).toHaveBeenCalled();
|
|
||||||
expect(editorDummy.set).toHaveBeenCalledWith({
|
|
||||||
"": ""
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue