mirror of https://gitee.com/bigwinds/arangodb
edit graph
This commit is contained in:
parent
1d53c8841f
commit
c941cfa76c
|
@ -58,7 +58,7 @@
|
||||||
this.collection.fetch();
|
this.collection.fetch();
|
||||||
this.graphToEdit = this.evaluateGraphName($(e.currentTarget).attr("id"), '_settings');
|
this.graphToEdit = this.evaluateGraphName($(e.currentTarget).attr("id"), '_settings');
|
||||||
var graph = this.collection.findWhere({_key: this.graphToEdit});
|
var graph = this.collection.findWhere({_key: this.graphToEdit});
|
||||||
this.createEditGraphModal(this.graphToEdit, graph.get("vertices"), graph.get("edges"));
|
this.createEditGraphModal(this.graphToEdit, graph.get("edgeDefinitions"), graph.get("orphanCollections"));
|
||||||
},
|
},
|
||||||
|
|
||||||
info : function(e) {
|
info : function(e) {
|
||||||
|
@ -73,6 +73,10 @@
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
saveEditedGraph: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
evaluateGraphName : function(str, substr) {
|
evaluateGraphName : function(str, substr) {
|
||||||
var index = str.lastIndexOf(substr);
|
var index = str.lastIndexOf(substr);
|
||||||
return str.substring(0, index);
|
return str.substring(0, index);
|
||||||
|
@ -171,9 +175,13 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createEditGraphModal: function(name, vertices, edges) {
|
createEditGraphModal: function(name, edgeDefinitions, orphanCollections) {
|
||||||
var buttons = [],
|
var buttons = [],
|
||||||
tableContent = [];
|
tableContent = [],
|
||||||
|
maxIndex;
|
||||||
|
|
||||||
|
this.counter = 0;
|
||||||
|
window.modalView.disableSubmitOnEnter = true;
|
||||||
|
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createReadOnlyEntry(
|
window.modalView.createReadOnlyEntry(
|
||||||
|
@ -183,28 +191,79 @@
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
edgeDefinitions.forEach(
|
||||||
|
function(edgeDefinition, index) {
|
||||||
|
maxIndex = index;
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createReadOnlyEntry(
|
window.modalView.createSelect2Entry(
|
||||||
"editVertices",
|
"newEdgeDefinitions" + index,
|
||||||
"Vertices",
|
"Edge definitions",
|
||||||
vertices,
|
edgeDefinition.collection,
|
||||||
false
|
"Some info for edge definitions",
|
||||||
|
"Edge definitions",
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createReadOnlyEntry(
|
window.modalView.createSelect2Entry(
|
||||||
"editEdges",
|
"newFromCollections" + index,
|
||||||
"Edges",
|
"fromCollections",
|
||||||
edges,
|
edgeDefinition.from,
|
||||||
false
|
"The collection that contain the start vertices of the relation.",
|
||||||
|
"fromCollections",
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
10
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
tableContent.push(
|
||||||
|
window.modalView.createSelect2Entry(
|
||||||
|
"newToCollections" + index,
|
||||||
|
"toCollections",
|
||||||
|
edgeDefinition.to,
|
||||||
|
"The collection that contain the end vertices of the relation.",
|
||||||
|
"toCollections",
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
10
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
tableContent.push(
|
||||||
|
window.modalView.createSelect2Entry(
|
||||||
|
"newVertexCollections",
|
||||||
|
"Vertex collections",
|
||||||
|
orphanCollections,
|
||||||
|
"Some info for vertex collections",
|
||||||
|
"Vertex Collections",
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
buttons.push(
|
buttons.push(
|
||||||
window.modalView.createDeleteButton("Delete", this.deleteGraph.bind(this))
|
window.modalView.createDeleteButton("Delete", this.deleteGraph.bind(this))
|
||||||
);
|
);
|
||||||
|
buttons.push(
|
||||||
|
window.modalView.createSuccessButton("Save", this.saveEditedGraph.bind(this))
|
||||||
|
);
|
||||||
|
|
||||||
window.modalView.show("modalTable.ejs", "Edit Graph", buttons, tableContent);
|
|
||||||
|
window.modalView.show(
|
||||||
|
"modalGraphTable.ejs", "Add new Graph", buttons, tableContent, null, this.events
|
||||||
|
);
|
||||||
|
|
||||||
|
var i;
|
||||||
|
for (i = 0; i <= maxIndex; i++) {
|
||||||
|
$('#row_newFromCollections' + i).hide();
|
||||||
|
$('#row_newToCollections' + i).hide();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue