1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Jan Steemann 2013-10-31 18:40:33 +01:00
commit 83a2e5ca3d
4 changed files with 58 additions and 12 deletions

View File

@ -73,7 +73,7 @@ window.arangoDocuments = Backbone.Collection.extend({
if (this.documentsCount <= sortCount) {
//sorted
myQueryVal = "FOR x in @@collection SORT x._key LIMIT @offset, @count RETURN x";
myQueryVal = "FOR x in @@collection SORT TO_NUMBER(x._key) == 0 ? x._key : TO_NUMBER(x._key) LIMIT @offset, @count RETURN x";
}
else {
//not sorted
@ -132,23 +132,38 @@ window.arangoDocuments = Backbone.Collection.extend({
} else {
filterString = ' FILTER' + filter.join(' && ');
}
var body = {
//temp solution, waiting for api with paging possibility
query: "FOR u IN " + this.collectionID +
filterString +
" LIMIT 0," + self.documentsPerPage +
" RETURN u",
bindVars: bindValues,
options: {
var sortCount = 10000;
var sortString = '';
if (this.documentsCount <= sortCount) {
//sorted
sortString = " SORT TO_NUMBER(u._key) == 0 ? u._key : TO_NUMBER(u._key)";
}
var myQueryVal = "FOR u in @@collection" + filterString + sortString +
" LIMIT 0, @count RETURN u";
var myQuery = {
query: myQueryVal,
bindVars: {
"@collection": this.collectionID,
"count": this.documentsPerPage
},
options: {
fullCount: true
}
}
};
$.each(bindValues, function(k,v) {
myQuery.bindVars[k] = v;
});
$.ajax({
cache: false,
type: 'POST',
async: false,
url: '/_api/cursor',
data: JSON.stringify(body),
data: JSON.stringify(myQuery),
contentType: "application/json",
success: function(data) {
self.clearDocuments();

View File

@ -19,6 +19,7 @@ $(document).ready(function() {
"logs" : "logs",
"about" : "about",
"api" : "api",
"databases" : "databases",
"application/installed/:key" : "applicationEdit",
"application/available/:key" : "applicationInstall",
"applications/installed" : "applicationsInstalled",
@ -31,6 +32,8 @@ $(document).ready(function() {
initialize: function () {
window.activeSession = new window.ArangoSession();
window.arangoDatabase = new window.ArangoDatabase();
window.arangoCollectionsStore = new window.arangoCollections();
window.arangoDocumentsStore = new window.arangoDocuments();
window.arangoDocumentStore = new window.arangoDocument();
@ -189,6 +192,16 @@ $(document).ready(function() {
this.naviView.selectMenuItem('api-menu');
},
databases: function() {
if (!this.databaseView) {
this.databaseView = new window.databaseView({
collection: arangoDatabase
});
}
this.databaseView.render();
this.naviView.selectMenuItem('database-menu');
},
about: function() {
if (!this.aboutView) {
this.aboutView = new window.aboutView();

View File

@ -68,6 +68,21 @@ function GraphCreationSuite() {
graph.drop();
},
testDroppingIfVertexCollectionIsUsedTwice : function () {
var Graph = require("org/arangodb/graph").Graph,
graph_name = "UnitTestsCollectionGraph",
other_graph_name = "UnitTestsCollectionOtherGraph",
vertex = "UnitTestsCollectionVertex",
edges = "UnitTestsCollectionEdge",
other_edges = "UnitTestsCollectionOtherEdges",
graph = new Graph(graph_name, vertex, edges),
other_graph = new Graph(other_graph_name, vertex, other_edges);
graph.drop();
assertTrue(arangodb.db._collection("UnitTestsCollectionVertex") !== null);
other_graph.drop();
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: Find Graph
////////////////////////////////////////////////////////////////////////////////

View File

@ -555,7 +555,10 @@ Graph.prototype.drop = function (waitForSync) {
gdb.remove(this._properties, true, waitForSync);
this._vertices.drop();
if (gdb.byExample({vertices: this._vertices.name()}).count() === 0) {
this._vertices.drop();
}
this._edges.drop();
};