1
0
Fork 0

ui graph management bugfix

This commit is contained in:
hkernbach 2016-10-18 14:23:39 +02:00
parent 31738adb1d
commit 90c2025957
1 changed files with 48 additions and 42 deletions

View File

@ -205,6 +205,8 @@
var i;
var self = this;
// self.events['change tr[id*="newEdgeDefinitions"]'] = self.setFromAndTo.bind(self);
if ($('#new-is_smart').is(':checked') === true) {
for (i = 0; i < this.counter; i++) {
$('#newEdgeDefinitions' + i).select2({
@ -214,6 +216,7 @@
self.cachedNewEdgeDefinitionsState = $('#newEdgeDefinitions' + i).attr('disabled');
$('#newEdgeDefinitions' + i).select2('data', '');
$('#newEdgeDefinitions' + i).attr('disabled', false);
$('#newEdgeDefinitions' + i).change();
$('#fromCollections' + i).select2({
tags: []
@ -222,6 +225,7 @@
self.cachedFromCollectionsState = $('#fromCollections' + i).attr('disabled');
$('#fromCollections' + i).select2('data', '');
$('#fromCollections' + i).attr('disabled', false);
$('#fromCollections' + i).change();
$('#toCollections' + i).select2({
tags: []
@ -230,15 +234,16 @@
self.cachedToCollectionsState = $('#toCollections' + i).attr('disabled');
$('#toCollections' + i).select2('data', '');
$('#toCollections' + i).attr('disabled', false);
$('#newVertexCollections' + i).select2({
tags: []
});
self.cachedNewVertexCollections = $('#newVertexCollections' + i).select2('data');
self.cachedNewVertexCollectionsState = $('#newVertexCollections' + i).attr('disabled');
$('#newVertexCollections' + i).select2('data', '');
$('#newVertexCollections' + i).attr('disabled', false);
$('#toCollections' + i).change();
}
$('#newVertexCollections').select2({
tags: []
});
self.cachedNewVertexCollections = $('#newVertexCollections').select2('data');
self.cachedNewVertexCollectionsState = $('#newVertexCollections').attr('disabled');
$('#newVertexCollections').select2('data', '');
$('#newVertexCollections').attr('disabled', false);
$('#newVertexCollections').change();
} else {
var collList = []; var collections = this.options.collectionCollection.models;
@ -267,13 +272,12 @@
});
$('#toCollections' + i).select2('data', self.cachedToCollections);
$('#toCollections' + i).attr('disabled', self.cachedToCollectionsState);
$('#newVertexCollections' + i).select2({
tags: collList
});
$('#newVertexCollections' + i).select2('data', self.cachedNewVertexCollections);
$('#newVertexCollections' + i).attr('disabled', self.cachedNewVertexCollectionsState);
}
$('#newVertexCollections').select2({
tags: collList
});
$('#newVertexCollections').select2('data', self.cachedNewVertexCollections);
$('#newVertexCollections').attr('disabled', self.cachedNewVertexCollectionsState);
}
},
@ -323,40 +327,42 @@
},
setFromAndTo: function (e) {
console.log(e);
e.stopPropagation();
var map = this.calculateEdgeDefinitionMap();
var id;
if (e.added) {
if (this.eCollList.indexOf(e.added.id) === -1 &&
this.removedECollList.indexOf(e.added.id) !== -1) {
id = e.currentTarget.id.split('row_newEdgeDefinitions')[1];
$('input[id*="newEdgeDefinitions' + id + '"]').select2('val', null);
$('input[id*="newEdgeDefinitions' + id + '"]').attr(
'placeholder', 'The collection ' + e.added.id + ' is already used.'
);
return;
if (!$('#new-is_smart').is(':checked')) {
if (e.added) {
if (this.eCollList.indexOf(e.added.id) === -1 && this.removedECollList.indexOf(e.added.id) !== -1) {
id = e.currentTarget.id.split('row_newEdgeDefinitions')[1];
$('input[id*="newEdgeDefinitions' + id + '"]').select2('val', null);
$('input[id*="newEdgeDefinitions' + id + '"]').attr(
'placeholder', 'The collection ' + e.added.id + ' is already used.'
);
return;
}
this.removedECollList.push(e.added.id);
this.eCollList.splice(this.eCollList.indexOf(e.added.id), 1);
} else {
this.eCollList.push(e.removed.id);
this.removedECollList.splice(this.removedECollList.indexOf(e.removed.id), 1);
}
if (map[e.val]) {
id = e.currentTarget.id.split('row_newEdgeDefinitions')[1];
$('#s2id_fromCollections' + id).select2('val', map[e.val].from);
$('#fromCollections' + id).attr('disabled', true);
$('#s2id_toCollections' + id).select2('val', map[e.val].to);
$('#toCollections' + id).attr('disabled', true);
} else {
id = e.currentTarget.id.split('row_newEdgeDefinitions')[1];
$('#s2id_fromCollections' + id).select2('val', null);
$('#fromCollections' + id).attr('disabled', false);
$('#s2id_toCollections' + id).select2('val', null);
$('#toCollections' + id).attr('disabled', false);
}
this.removedECollList.push(e.added.id);
this.eCollList.splice(this.eCollList.indexOf(e.added.id), 1);
} else {
this.eCollList.push(e.removed.id);
this.removedECollList.splice(this.removedECollList.indexOf(e.removed.id), 1);
}
if (map[e.val]) {
id = e.currentTarget.id.split('row_newEdgeDefinitions')[1];
$('#s2id_fromCollections' + id).select2('val', map[e.val].from);
$('#fromCollections' + id).attr('disabled', true);
$('#s2id_toCollections' + id).select2('val', map[e.val].to);
$('#toCollections' + id).attr('disabled', true);
} else {
id = e.currentTarget.id.split('row_newEdgeDefinitions')[1];
$('#s2id_fromCollections' + id).select2('val', null);
$('#fromCollections' + id).attr('disabled', false);
$('#s2id_toCollections' + id).select2('val', null);
$('#toCollections' + id).attr('disabled', false);
}
/* following not needed? => destroys webif modal
tmp = $('input[id*="newEdgeDefinitions"]')
for (i = 0; i < tmp.length ; i++) {
@ -810,7 +816,7 @@
)
);
if (window.frontendConfig.isEnterprise) {
if (window.frontendConfig.isEnterprise === false) {
var advanced = {};
var advancedTableContent = [];