mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/AvocadoDB
This commit is contained in:
commit
b241af5164
|
@ -26,6 +26,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "Ahuacatl/ahuacatl-parser.h"
|
#include "Ahuacatl/ahuacatl-parser.h"
|
||||||
|
#include "Ahuacatl/ahuacatl-parser-functions.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- constructors / destructors
|
// --SECTION-- constructors / destructors
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#logView .fg-toolbar{display: none;}
|
#logView .fg-toolbar{display: none;}
|
||||||
|
#documentsView .fg-toolbar{display: none;}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-family: Verdana,Arial,sans-serif;
|
font-family: Verdana,Arial,sans-serif;
|
||||||
|
@ -12,10 +13,10 @@ th {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#logToolbar a {
|
#logToolbar a, #documentsToolbar a {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
}
|
}
|
||||||
#logToolbar {
|
#logToolbar, #documentsToolbar{
|
||||||
height:24px;
|
height:24px;
|
||||||
border: 1px solid #AAAAAA;
|
border: 1px solid #AAAAAA;
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
|
@ -77,10 +78,6 @@ th {
|
||||||
height:130px;
|
height:130px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#editCollectionView {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#newCollection_left {
|
#newCollection_left {
|
||||||
border-top: 1px dashed #7E9246;
|
border-top: 1px dashed #7E9246;
|
||||||
border-left: 1px dashed #7E9246;
|
border-left: 1px dashed #7E9246;
|
||||||
|
@ -432,7 +429,7 @@ th {
|
||||||
##############################################################################
|
##############################################################################
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#avocshView button, #queryView button, #tab_right button, #footerSlideContent button, form.jediTextarea > button, #logToolbar button {
|
#avocshView button, #queryView button, #tab_right button, #footerSlideContent button, form.jediTextarea > button, #logToolbar button, #documentsToolbar button {
|
||||||
background: #e3e3e3;
|
background: #e3e3e3;
|
||||||
border: 1px solid #bbb;
|
border: 1px solid #bbb;
|
||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
|
@ -450,16 +447,11 @@ th {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#avocshView button:hover, #queryView button:hover, #tab_right button:hover, #footerSlideContent button:hover, form.jediTextarea > button:hover {
|
#avocshView button:hover, #queryView button:hover, #tab_right button:hover, #footerSlideContent button:hover, form.jediTextarea > button:hover, #documentsToolbar button:hover {
|
||||||
background: #d9d9d9;
|
background: #d9d9d9;
|
||||||
-webkit-box-shadow: inset 0 0 1px 1px #eaeaea;
|
-webkit-box-shadow: inset 0 0 1px 1px #eaeaea;
|
||||||
-moz-box-shadow: inset 0 0 1px 1px #eaeaea;
|
-moz-box-shadow: inset 0 0 1px 1px #eaeaea;
|
||||||
box-shadow: inset 0 0 1px 1px #eaeaea;
|
box-shadow: inset 0 0 1px 1px #eaeaea;
|
||||||
color: #222;
|
color: #222;
|
||||||
cursor: pointer; }
|
cursor: pointer;
|
||||||
#avocshView button:active, #queryView button:active, #tab_right button:active, #footerSlideContent button:active, form.jediTextarea > button:active {
|
}
|
||||||
background: #d0d0d0;
|
|
||||||
-webkit-box-shadow: inset 0 0 1px 1px #e3e3e3;
|
|
||||||
-moz-box-shadow: inset 0 0 1px 1px #e3e3e3;
|
|
||||||
box-shadow: inset 0 0 1px 1px #e3e3e3;
|
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div id="documentsToolbar">
|
||||||
|
<button id="documents_prev">Prev</button>
|
||||||
|
<button id="documents_next">Next</button>
|
||||||
|
<a id="documents_status">Showing</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="documentEditView" style="display: none">
|
<div id="documentEditView" style="display: none">
|
||||||
|
|
|
@ -3,13 +3,18 @@
|
||||||
/// avocadodb js api
|
/// avocadodb js api
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// documents global vars
|
||||||
|
var collectionCount;
|
||||||
|
var totalCollectionCount;
|
||||||
|
var collectionCurrentPage;
|
||||||
|
var globalCollectionName;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
showCursor();
|
showCursor();
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// global variables
|
/// global variables
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
var userScreenSize = $(window).width();
|
|
||||||
var open = false;
|
var open = false;
|
||||||
var tableView = true;
|
var tableView = true;
|
||||||
var sid = ($.cookie("sid"));
|
var sid = ($.cookie("sid"));
|
||||||
|
@ -20,6 +25,7 @@ var currentAmount;
|
||||||
var currentTableID = "#logTableID";
|
var currentTableID = "#logTableID";
|
||||||
var currentLoglevel = 5;
|
var currentLoglevel = 5;
|
||||||
//live click for all log tables
|
//live click for all log tables
|
||||||
|
|
||||||
var tables = ["#logTableID", "#critLogTableID", "#warnLogTableID", "#infoLogTableID", "#debugLogTableID"];
|
var tables = ["#logTableID", "#critLogTableID", "#warnLogTableID", "#infoLogTableID", "#debugLogTableID"];
|
||||||
|
|
||||||
$.each(tables, function(v, i ) {
|
$.each(tables, function(v, i ) {
|
||||||
|
@ -42,6 +48,15 @@ $.each(tables, function(v, i ) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#documents_prev").live('click', function () {
|
||||||
|
createPrevDocPagination();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#documents_next").live('click', function () {
|
||||||
|
createNextDocPagination();
|
||||||
|
});
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// html customizations
|
/// html customizations
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -401,82 +416,50 @@ var logTable = $('#logTableID').dataTable({
|
||||||
|
|
||||||
else if (location.hash.substr(0, 16) == "#showCollection?") {
|
else if (location.hash.substr(0, 16) == "#showCollection?") {
|
||||||
var collectionID = location.hash.substr(16, location.hash.length);
|
var collectionID = location.hash.substr(16, location.hash.length);
|
||||||
var collectionName;
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "/_api/collection/" + collectionID,
|
url: "/_api/collection/" + collectionID + "/count",
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
|
async: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
collectionName = data.name;
|
globalCollectionName = data.name;
|
||||||
$('#nav2').text('-> ' + collectionName);
|
test = data.name;
|
||||||
|
collectionCount = data.count;
|
||||||
|
$('#nav2').text('-> ' + globalCollectionName);
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#nav1').text('Collections');
|
$('#nav1').text('Collections');
|
||||||
$('#nav1').attr('href', '#');
|
$('#nav1').attr('href', '#');
|
||||||
$('#nav2').attr('href', null);
|
$('#nav2').attr('href', null);
|
||||||
$('#nav3').text('');
|
$('#nav3').text('');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: 'PUT',
|
||||||
url: "/document?collection=" + collectionID ,
|
url: '/_api/simple/all/',
|
||||||
|
data: '{"collection":"' + globalCollectionName + '","skip":0,"limit":10}',
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
$.each(data, function(k, v) {
|
||||||
|
documentsTable.fnAddData(['<button id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, cutByResolution(JSON.stringify(v))]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
documentsTable.fnClearTable();
|
documentsTable.fnClearTable();
|
||||||
hideAllSubDivs();
|
hideAllSubDivs();
|
||||||
$('#collectionsView').hide();
|
$('#collectionsView').hide();
|
||||||
$('#documentsView').show();
|
$('#documentsView').show();
|
||||||
$.each(data, function(key, val) {
|
totalCollectionCount = Math.ceil(collectionCount / 10);
|
||||||
$.each(val, function(key, val) {
|
collectionCurrentPage = 1;
|
||||||
$.ajax({
|
$('#documents_status').text("Showing page 1 of " + totalCollectionCount);
|
||||||
type: "GET",
|
console.log(globalCollectionName);
|
||||||
url: val,
|
|
||||||
contentType: "application/json",
|
|
||||||
processData: false,
|
|
||||||
success: function(data) {
|
|
||||||
var dataString;
|
|
||||||
var content;
|
|
||||||
dataString = JSON.stringify(data);
|
|
||||||
var escapedContent = escaped(dataString);
|
|
||||||
|
|
||||||
var userContent;
|
|
||||||
|
|
||||||
if (userScreenSize <= 1024) {
|
|
||||||
userContent = 150;
|
|
||||||
}
|
|
||||||
else if (userScreenSize > 1024 && userScreenSize < 1680) {
|
|
||||||
userContent = 250;
|
|
||||||
}
|
|
||||||
else if (userScreenSize > 1680) {
|
|
||||||
userContent = 350;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (escapedContent.length > userContent) {
|
|
||||||
content = escapedContent.substr(0,(userContent-3))+'...';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
content = escapedContent;
|
|
||||||
}
|
|
||||||
documentsTable.fnAddData(['<button id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>',
|
|
||||||
data._id, data._rev, content]);
|
|
||||||
},
|
|
||||||
error: function (data) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function(data) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -586,7 +569,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
$.each(content[data], function(key, val) {
|
$.each(content[data], function(key, val) {
|
||||||
$('#configView').append('<a>' + key + ":" + val + '</a><br>');
|
$('#configView').append('<a>' + key + ":" + val + '</a><br>');
|
||||||
});
|
});
|
||||||
|
|
||||||
//$('#configView').append('<a>' + menues + '</a><br>');
|
//$('#configView').append('<a>' + menues + '</a><br>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -647,6 +629,7 @@ var logTable = $('#logTableID').dataTable({
|
||||||
collectionID = row_data[3];
|
collectionID = row_data[3];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//TODO
|
||||||
result[row_data[1]] = JSON.parse(row_data[3]);
|
result[row_data[1]] = JSON.parse(row_data[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,7 +985,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$('#submitLogSearch').live('click', function () {
|
$('#submitLogSearch').live('click', function () {
|
||||||
//marker
|
|
||||||
|
|
||||||
var content = $('#logSearchField').val();
|
var content = $('#logSearchField').val();
|
||||||
var selected = $("#tabs").tabs( "option", "selected" );
|
var selected = $("#tabs").tabs( "option", "selected" );
|
||||||
|
@ -1656,12 +1638,63 @@ function createLogTable(loglevel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(currentTableID + '_status').text("Showing page " + currentPage + " of " + totalPages);
|
$(currentTableID + '_status').text("Showing page " + currentPage + " of " + totalPages);
|
||||||
console.log("current:" + currentPage);
|
|
||||||
console.log("total:" + totalPages);
|
|
||||||
console.log("id:" + currentTableID);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createPrevDocPagination() {
|
||||||
|
if (collectionCurrentPage == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
var prevPage = JSON.parse(collectionCurrentPage) -1;
|
||||||
|
var offset = prevPage * 10 - 10;
|
||||||
|
|
||||||
|
$('#documentsTableID').dataTable().fnClearTable();
|
||||||
|
$.ajax({
|
||||||
|
type: 'PUT',
|
||||||
|
url: '/_api/simple/all/',
|
||||||
|
data: '{"collection":"' + globalCollectionName + '","skip":' + offset + ',"limit":10}',
|
||||||
|
contentType: "application/json",
|
||||||
|
success: function(data) {
|
||||||
|
$.each(data, function(k, v) {
|
||||||
|
$('#documentsTableID').dataTable().fnAddData(['<button id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, cutByResolution(JSON.stringify(v))]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
collectionCurrentPage = prevPage;
|
||||||
|
$('#documents_status').text("Showing page " + collectionCurrentPage + " of " + totalCollectionCount);
|
||||||
|
}
|
||||||
|
//marker
|
||||||
|
function createNextDocPagination () {
|
||||||
|
|
||||||
|
console.log("start");
|
||||||
|
|
||||||
|
if (collectionCurrentPage == totalCollectionCount) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nextPage = JSON.parse(collectionCurrentPage) +1;
|
||||||
|
var offset = collectionCurrentPage * 10;
|
||||||
|
|
||||||
|
$('#documentsTableID').dataTable().fnClearTable();
|
||||||
|
$.ajax({
|
||||||
|
type: 'PUT',
|
||||||
|
url: '/_api/simple/all/',
|
||||||
|
data: '{"collection":"' + globalCollectionName + '","skip":' + offset + ',"limit":10}',
|
||||||
|
contentType: "application/json",
|
||||||
|
success: function(data) {
|
||||||
|
$.each(data, function(k, v) {
|
||||||
|
$("#documentsTableID").dataTable().fnAddData(['<button id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, cutByResolution(JSON.stringify(v))]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
collectionCurrentPage = nextPage;
|
||||||
|
$('#documents_status').text("Showing page " + collectionCurrentPage + " of " + totalCollectionCount);
|
||||||
|
}
|
||||||
|
|
||||||
function createPrevPagination(checked) {
|
function createPrevPagination(checked) {
|
||||||
var prevPage = JSON.parse(currentPage) - 1;
|
var prevPage = JSON.parse(currentPage) - 1;
|
||||||
var offset = prevPage * 10 - 10;
|
var offset = prevPage * 10 - 10;
|
||||||
|
@ -1701,7 +1734,6 @@ function createNextPagination(checked) {
|
||||||
url = "/_admin/log?upto=4&size=10&offset="+offset;
|
url = "/_admin/log?upto=4&size=10&offset="+offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$.getJSON(url, function(data) {
|
$.getJSON(url, function(data) {
|
||||||
$(currentTableID).dataTable().fnClearTable();
|
$(currentTableID).dataTable().fnClearTable();
|
||||||
|
|
||||||
|
@ -1720,3 +1752,28 @@ function showCursor() {
|
||||||
$(this).css('cursor', 'pointer');
|
$(this).css('cursor', 'pointer');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cutByResolution (string) {
|
||||||
|
var userScreenSize = $(window).width();
|
||||||
|
var content;
|
||||||
|
var escapedContent = escaped(string);
|
||||||
|
var userContent;
|
||||||
|
|
||||||
|
if (userScreenSize <= 1024) {
|
||||||
|
userContent = 150;
|
||||||
|
}
|
||||||
|
else if (userScreenSize > 1024 && userScreenSize < 1680) {
|
||||||
|
userContent = 250;
|
||||||
|
}
|
||||||
|
else if (userScreenSize > 1680) {
|
||||||
|
userContent = 350;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (escapedContent.length > userContent) {
|
||||||
|
content = escapedContent.substr(0,(userContent-3))+'...';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content = escapedContent;
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue