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
|
// documents global vars
|
||||||
var collectionTotalPages;
|
var collectionTotalPages;
|
||||||
var collectionCurrentPage;
|
var collectionCurrentPage;
|
||||||
|
var globalDocumentCopy = { };
|
||||||
var globalCollectionName;
|
var globalCollectionName;
|
||||||
var globalCollectionID;
|
|
||||||
var checkCollectionName;
|
var checkCollectionName;
|
||||||
var printedHelp = false;
|
var printedHelp = false;
|
||||||
var open = false;
|
var open = false;
|
||||||
|
@ -775,7 +775,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$('#saveEditedDocButton').live('click', function () {
|
$('#saveEditedDocButton').live('click', function () {
|
||||||
|
|
||||||
if (tableView == true) {
|
if (tableView == true) {
|
||||||
var data = documentEditTable.fnGetData();
|
var data = documentEditTable.fnGetData();
|
||||||
var result = {};
|
var result = {};
|
||||||
|
@ -784,23 +783,22 @@ var logTable = $('#logTableID').dataTable({
|
||||||
for (row in data) {
|
for (row in data) {
|
||||||
var row_data = data[row];
|
var row_data = data[row];
|
||||||
if ( row_data[1] == "_id" ) {
|
if ( row_data[1] == "_id" ) {
|
||||||
documentID = row_data[3];
|
documentID = JSON.parse(row_data[3]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result[row_data[1]] = JSON.parse(row_data[3]);
|
result[row_data[1]] = JSON.parse(row_data[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
url: "/_api/document/" + JSON.parse(documentID),
|
url: "/_api/document/" + documentID,
|
||||||
data: JSON.stringify(result),
|
data: JSON.stringify(result),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
tableView = true;
|
tableView = true;
|
||||||
var collID = JSON.parse(documentID).split("/");
|
var collID = documentID.split("/");
|
||||||
window.location.href = "#showCollection?" + collID[0];
|
window.location.href = "#showCollection?" + collID[0];
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
@ -810,9 +808,8 @@ var logTable = $('#logTableID').dataTable({
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
var documentID;
|
var documentID = globalDocumentCopy._id;
|
||||||
var boxContent = $('#documentEditSourceBox').val();
|
var boxContent = $('#documentEditSourceBox').val();
|
||||||
documentID = globalCollectionID;
|
|
||||||
boxContent = stateReplace(boxContent);
|
boxContent = stateReplace(boxContent);
|
||||||
parsedContent = JSON.parse(boxContent);
|
parsedContent = JSON.parse(boxContent);
|
||||||
|
|
||||||
|
@ -957,11 +954,12 @@ var logTable = $('#logTableID').dataTable({
|
||||||
result[row_data[1]] = JSON.parse(row_data[3]);
|
result[row_data[1]] = JSON.parse(row_data[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var copies = { }; // copy systerm attributes
|
var copies = { }; // copy system attributes
|
||||||
for (var a in systemAttributes()) {
|
for (var a in systemAttributes()) {
|
||||||
copies[a] = result[a];
|
copies[a] = result[a];
|
||||||
delete result[a];
|
delete result[a];
|
||||||
}
|
}
|
||||||
|
globalDocumentCopy = copies;
|
||||||
|
|
||||||
var myFormattedString = FormatJSON(result);
|
var myFormattedString = FormatJSON(result);
|
||||||
$('#documentEditSourceBox').val(myFormattedString);
|
$('#documentEditSourceBox').val(myFormattedString);
|
||||||
|
@ -982,7 +980,9 @@ var logTable = $('#logTableID').dataTable({
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var a in systemAttributes()) {
|
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');
|
documentTableMakeEditable ('#documentEditTableID');
|
||||||
|
|
Loading…
Reference in New Issue