mirror of https://gitee.com/bigwinds/arangodb
fixed update in web interface
This commit is contained in:
parent
2b9e7d134d
commit
8ff9eefdbe
|
@ -17,8 +17,8 @@ var statDivCount;
|
|||
// documents global vars
|
||||
var collectionTotalPages;
|
||||
var collectionCurrentPage;
|
||||
var globalDocumentCopy = { };
|
||||
var globalCollectionName;
|
||||
var globalCollectionID;
|
||||
var checkCollectionName;
|
||||
var printedHelp = false;
|
||||
var open = false;
|
||||
|
@ -775,7 +775,6 @@ var logTable = $('#logTableID').dataTable({
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$('#saveEditedDocButton').live('click', function () {
|
||||
|
||||
if (tableView == true) {
|
||||
var data = documentEditTable.fnGetData();
|
||||
var result = {};
|
||||
|
@ -784,23 +783,22 @@ var logTable = $('#logTableID').dataTable({
|
|||
for (row in data) {
|
||||
var row_data = data[row];
|
||||
if ( row_data[1] == "_id" ) {
|
||||
documentID = row_data[3];
|
||||
documentID = JSON.parse(row_data[3]);
|
||||
}
|
||||
else {
|
||||
result[row_data[1]] = JSON.parse(row_data[3]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: "/_api/document/" + JSON.parse(documentID),
|
||||
url: "/_api/document/" + documentID,
|
||||
data: JSON.stringify(result),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
tableView = true;
|
||||
var collID = JSON.parse(documentID).split("/");
|
||||
var collID = documentID.split("/");
|
||||
window.location.href = "#showCollection?" + collID[0];
|
||||
},
|
||||
error: function(data) {
|
||||
|
@ -810,9 +808,8 @@ var logTable = $('#logTableID').dataTable({
|
|||
}
|
||||
else {
|
||||
try {
|
||||
var documentID;
|
||||
var documentID = globalDocumentCopy._id;
|
||||
var boxContent = $('#documentEditSourceBox').val();
|
||||
documentID = globalCollectionID;
|
||||
boxContent = stateReplace(boxContent);
|
||||
parsedContent = JSON.parse(boxContent);
|
||||
|
||||
|
@ -957,11 +954,12 @@ var logTable = $('#logTableID').dataTable({
|
|||
result[row_data[1]] = JSON.parse(row_data[3]);
|
||||
}
|
||||
|
||||
var copies = { }; // copy systerm attributes
|
||||
var copies = { }; // copy system attributes
|
||||
for (var a in systemAttributes()) {
|
||||
copies[a] = result[a];
|
||||
delete result[a];
|
||||
}
|
||||
globalDocumentCopy = copies;
|
||||
|
||||
var myFormattedString = FormatJSON(result);
|
||||
$('#documentEditSourceBox').val(myFormattedString);
|
||||
|
@ -982,7 +980,9 @@ var logTable = $('#logTableID').dataTable({
|
|||
});
|
||||
|
||||
for (var a in systemAttributes()) {
|
||||
documentEditTable.fnAddData(['', a, value2html(copies[a], true), JSON.stringify(copies[a]) ]);
|
||||
if (globalDocumentCopy[a] != undefined) {
|
||||
documentEditTable.fnAddData(['', a, value2html(globalDocumentCopy[a], true), JSON.stringify(globalDocumentCopy[a]) ]);
|
||||
}
|
||||
}
|
||||
|
||||
documentTableMakeEditable ('#documentEditTableID');
|
||||
|
|
Loading…
Reference in New Issue