mirror of https://gitee.com/bigwinds/arangodb
the graph viewer now displays updated label values correctly (#3763)
This commit is contained in:
parent
a005aca3e7
commit
e3277a493c
|
@ -1,6 +1,10 @@
|
||||||
devel
|
devel
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* UI: the graph viewer now displays updated label values correctly.
|
||||||
|
Additionally the included node/edge editor now closes automatically
|
||||||
|
after a successful node/edge update.
|
||||||
|
|
||||||
* UI: document/edge editor now remembering their modes (e.g. code or tree)
|
* UI: document/edge editor now remembering their modes (e.g. code or tree)
|
||||||
|
|
||||||
* UI: optimized error messages for invalid graph definitions. Also fixed a
|
* UI: optimized error messages for invalid graph definitions. Also fixed a
|
||||||
|
|
|
@ -646,7 +646,13 @@
|
||||||
docFrameView.customDeleteFunction = function () {
|
docFrameView.customDeleteFunction = function () {
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
$('.arangoFrame').hide();
|
$('.arangoFrame').hide();
|
||||||
// callback()
|
};
|
||||||
|
|
||||||
|
docFrameView.customSaveFunction = function (data) {
|
||||||
|
self.closeDocEditor();
|
||||||
|
if (callback) {
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$('.arangoFrame #deleteDocumentButton').click(function () {
|
$('.arangoFrame #deleteDocumentButton').click(function () {
|
||||||
|
|
|
@ -184,7 +184,7 @@ window.ArangoDocument = Backbone.Collection.extend({
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
url: arangoHelper.databaseUrl('/_api/document/' + encodeURIComponent(colid)),
|
url: arangoHelper.databaseUrl('/_api/document/' + encodeURIComponent(colid) + '?returnNew=true'),
|
||||||
data: JSON.stringify([model]),
|
data: JSON.stringify([model]),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
processData: false,
|
processData: false,
|
||||||
|
|
|
@ -121,7 +121,9 @@
|
||||||
deleteDocument: function () {
|
deleteDocument: function () {
|
||||||
var successFunction = function () {
|
var successFunction = function () {
|
||||||
if (this.customView) {
|
if (this.customView) {
|
||||||
this.customDeleteFunction();
|
if (this.customDeleteFunction) {
|
||||||
|
this.customDeleteFunction();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var navigateTo = 'collection/' + encodeURIComponent(this.colid) + '/documents/1';
|
var navigateTo = 'collection/' + encodeURIComponent(this.colid) + '/documents/1';
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
|
@ -290,6 +292,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
confirmSaveDocument: function () {
|
confirmSaveDocument: function () {
|
||||||
|
var self = this;
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
|
|
||||||
var model;
|
var model;
|
||||||
|
@ -311,6 +314,12 @@
|
||||||
} else {
|
} else {
|
||||||
this.successConfirmation();
|
this.successConfirmation();
|
||||||
this.disableSaveButton();
|
this.disableSaveButton();
|
||||||
|
|
||||||
|
if (self.customView) {
|
||||||
|
if (self.customSaveFunction) {
|
||||||
|
self.customSaveFunction(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
@ -322,6 +331,12 @@
|
||||||
} else {
|
} else {
|
||||||
this.successConfirmation();
|
this.successConfirmation();
|
||||||
this.disableSaveButton();
|
this.disableSaveButton();
|
||||||
|
|
||||||
|
if (self.customView) {
|
||||||
|
if (self.customSaveFunction) {
|
||||||
|
self.customSaveFunction(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
|
|
@ -1729,16 +1729,53 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
editNode: function (id) {
|
editNode: function (id) {
|
||||||
var callback = function (a, b) {
|
var callback = function (data) {
|
||||||
};
|
this.updateNodeLabel(data);
|
||||||
|
}.bind(this);
|
||||||
arangoHelper.openDocEditor(id, 'doc', callback);
|
arangoHelper.openDocEditor(id, 'doc', callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateNodeLabel: function (data) {
|
||||||
|
var id = data[0]._id;
|
||||||
|
|
||||||
|
if (this.graphConfig.nodeLabel) {
|
||||||
|
var oldLabel = this.currentGraph.graph.nodes(id).label;
|
||||||
|
if (oldLabel !== data[0][this.graphConfig.nodeLabel]) {
|
||||||
|
var newLabel = data[0]['new'][this.graphConfig.nodeLabel];
|
||||||
|
if (typeof newLabel === 'string') {
|
||||||
|
this.currentGraph.graph.nodes(id).label = newLabel;
|
||||||
|
} else {
|
||||||
|
this.currentGraph.graph.nodes(id).label = JSON.stringify(newLabel);
|
||||||
|
}
|
||||||
|
this.currentGraph.refresh({ skipIndexation: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
editEdge: function (id) {
|
editEdge: function (id) {
|
||||||
var callback = function () {};
|
var callback = function (data) {
|
||||||
|
this.updateEdgeLabel(data);
|
||||||
|
}.bind(this);
|
||||||
arangoHelper.openDocEditor(id, 'edge', callback);
|
arangoHelper.openDocEditor(id, 'edge', callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateEdgeLabel: function (data) {
|
||||||
|
var id = data[0]._id;
|
||||||
|
|
||||||
|
if (this.graphConfig.edgeLabel) {
|
||||||
|
var oldLabel = this.currentGraph.graph.edges(id).label;
|
||||||
|
if (oldLabel !== data[0][this.graphConfig.edgeLabel]) {
|
||||||
|
var newLabel = data[0]['new'][this.graphConfig.edgeLabel];
|
||||||
|
if (typeof newLabel === 'string') {
|
||||||
|
this.currentGraph.graph.edges(id).label = newLabel;
|
||||||
|
} else {
|
||||||
|
this.currentGraph.graph.edges(id).label = JSON.stringify(newLabel);
|
||||||
|
}
|
||||||
|
this.currentGraph.refresh({ skipIndexation: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
reloadGraph: function () {
|
reloadGraph: function () {
|
||||||
Backbone.history.loadUrl(Backbone.history.fragment);
|
Backbone.history.loadUrl(Backbone.history.fragment);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue