1
0
Fork 0

graph creation works

This commit is contained in:
scottashton 2014-06-26 09:07:12 +02:00
parent f86751791d
commit a8c4af2921
3 changed files with 56 additions and 24 deletions

View File

@ -2,7 +2,7 @@
<tr class="tableRow" id="row_newEdgeDefinitions<%= number%>">
<th class="collectionTh">Edge definitions*:</th>
<th class="collectionTh">
<div class="select2-container select2-container-multi" id="s2id_newEdgeDefinitions<%= number%>" style="width: 336px;"><ul class="select2-choices"> <li class="select2-search-field"> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input select2-default" id="s2id_autogen1" style="width: 324px;"> </li></ul></div><input type="hidden" id="newEdgeDefinitions<%= number%>" value="" placeholder="Edge definitions" tabindex="-1" class="select2-offscreen">
<input onkeypress="return event.keyCode!=13" type="hidden" id="newEdgeDefinitions<%= number%>" value="" placeholder="Edge definitions" tabindex="-1" class="select2-offscreen">
<button id="remove_newEdgeDefinitions<%= number%>" class="graphViewer-icon-button gv_internal_remove_line gv-icon-small delete"></button>
</th><th>
<a class="modalTooltips" title="Some info for edge definitions">
@ -10,20 +10,20 @@
</a>
</th>
</tr>
<tr class="tableRow" id="row_fromCollections<%= number%>" style="display: table-row;">
<tr class="tableRow" id="row_fromCollections<%= number%>">
<th class="collectionTh">fromCollections*:</th>
<th class="collectionTh">
<div class="select2-container select2-container-multi" id="s2id_fromCollections<%= number%>" style="width: 336px;"><ul class="select2-choices"> <li class="select2-search-field"> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen2" style="width: 10px;"> </li></ul><div class="select2-drop select2-drop-multi select2-display-none"> <ul class="select2-results"> </ul></div></div><input type="hidden" id="fromCollections<%= number%>" value="" placeholder="" tabindex="-1" class="select2-offscreen">
<input onkeypress="return event.keyCode!=13" type="hidden" id="newfromCollections<%= number%>" value="" placeholder="fromCollections" tabindex="-1" class="select2-offscreen">
</th><th>
<a class="modalTooltips" title="The collection that contain the start vertices of the relation.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
</th>
</tr>
<tr class="tableRow" id="row_toCollections<%= number%>" style="display: table-row;">
<tr class="tableRow" id="row_toCollections<%= number%>">
<th class="collectionTh">toCollections*:</th>
<th class="collectionTh">
<div class="select2-container select2-container-multi" id="s2id_toCollections<%= number%>" style="width: 336px;"><ul class="select2-choices"> <li class="select2-search-field"> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen3" style="width: 10px;"> </li></ul><div class="select2-drop select2-drop-multi select2-display-none"> <ul class="select2-results"> </ul></div></div><input type="hidden" id="toCollections<%= number%>" value="" placeholder="" tabindex="-1" class="select2-offscreen">
<input onkeypress="return event.keyCode!=13" type="hidden" id="newtoCollections<%= number%>" value="" placeholder="toCollections" tabindex="-1" class="select2-offscreen">
</th><th>
<a class="modalTooltips" title="The collection that contain the end vertices of the relation.">
<span class="arangoicon icon_arangodb_info"></span>

View File

@ -165,12 +165,15 @@
collection,
from,
to;
collection = $('#newEdgeDefinitions1').val();
//collection = $("tr[id*='newEdgeDefinitions'").val();
if (collection !== "") {
from = _.pluck($('#s2id_fromCollections1').select2("data"), "text");
to = _.pluck($('#s2id_toCollections1').select2("data"), "text");
for (var i = 0 ; i < $("tr[id*='newEdgeDefinitions']").length ; i++) {
if (!$('#s2id_fromCollections' + i) || !_.pluck($('#s2id_fromCollections' + i).select2("data"), "text") ||
!$('#newEdgeDefinitions' + i) || !$('#newEdgeDefinitions' + i).val() ||
!$('#s2id_toCollections' + i) || !_.pluck($('#s2id_toCollections' + i).select2("data"), "text") ) {
continue;
}
from = _.pluck($('#s2id_fromCollections' + i).select2("data"), "text");
to = _.pluck($('#s2id_toCollections' + i).select2("data"), "text");
collection = $('#newEdgeDefinitions' + i).val();
edgeDefinitions.push(
{
collection: collection,
@ -178,7 +181,7 @@
to: to
}
);
}
};
if (!name) {
arangoHelper.arangoNotification(
@ -243,9 +246,8 @@
)
);
buttons.push(
window.modalView.createSuccessButton("Create", this.createNewGraph.bind(this))
window.modalView.createSuccessButton("Create", this.createNewGraph2.bind(this))
);
window.modalView.show("modalTable.ejs", "Add new Graph", buttons, tableContent);
},
@ -339,6 +341,27 @@
number: this.counter
})
);
$('#newEdgeDefinitions'+this.counter).select2({
tags: [],
showSearchBox: false,
minimumResultsForSearch: -1,
width: "336px",
maximumSelectionSize: 1
});
$('#newfromCollections'+this.counter).select2({
tags: [],
showSearchBox: false,
minimumResultsForSearch: -1,
width: "336px",
maximumSelectionSize: 10
});
$('#newtoCollections'+this.counter).select2({
tags: [],
showSearchBox: false,
minimumResultsForSearch: -1,
width: "336px",
maximumSelectionSize: 10
});
window.modalView.undelegateEvents();
window.modalView.delegateEvents(this.events);
return;
@ -377,18 +400,21 @@
"Edge definitions",
true,
false,
true
true,
1
)
);
tableContent.push(
window.modalView.createSelect2Entry(
"fromCollections0",
"fromCollections",
"",
"The collection that contain the start vertices of the relation.",
"",
true
"fromCollections",
true,
false,
false,
10
)
);
tableContent.push(
@ -397,8 +423,11 @@
"toCollections",
"",
"The collection that contain the end vertices of the relation.",
"",
true
"toCollections",
true,
false,
false,
10
)
);

View File

@ -14,7 +14,7 @@
};
var createTextStub = function(type, label, value, info, placeholder, mandatory, regexp,
addDelete, addAdd) {
addDelete, addAdd, maxEntrySize) {
var obj = {
type: type,
label: label
@ -37,6 +37,9 @@
if (addAdd !== undefined) {
obj.addAdd = addAdd;
}
if (maxEntrySize !== undefined) {
obj.maxEntrySize = maxEntrySize;
}
if (regexp){
// returns true if the string contains the match
obj.validateInput = function(el){
@ -183,9 +186,9 @@
},
createSelect2Entry: function(
id, label, value, info, placeholder, mandatory, addDelete, addAdd) {
id, label, value, info, placeholder, mandatory, addDelete, addAdd, maxEntrySize) {
var obj = createTextStub(this.tables.SELECT2, label, value, info, placeholder,
mandatory, undefined, addDelete, addAdd);
mandatory, undefined, addDelete, addAdd, maxEntrySize);
obj.id = id;
return obj;
},
@ -283,7 +286,7 @@
showSearchBox: false,
minimumResultsForSearch: -1,
width: "336px",
maximumSelectionSize: 8
maximumSelectionSize: r.maxEntrySize ? r.maxEntrySize : 8
});
}
});//handle select2