mirror of https://gitee.com/bigwinds/arangodb
fixed caching of collections in arangosh for dropped collections
This commit is contained in:
parent
7b3c3ba3b7
commit
0783bb4473
|
@ -122,8 +122,9 @@ window.arangoHelper = {
|
|||
return val.substr(0, 1) === '_';
|
||||
},
|
||||
|
||||
collectionApiType: function (identifier) {
|
||||
if (this.CollectionTypes[identifier] === undefined) {
|
||||
collectionApiType: function (identifier, refresh) {
|
||||
// set "refresh" to disable caching collection type
|
||||
if (refresh || this.CollectionTypes[identifier] === undefined) {
|
||||
this.CollectionTypes[identifier] = window.arangoDocumentStore
|
||||
.getCollectionInfo(identifier).type;
|
||||
}
|
||||
|
|
|
@ -407,12 +407,24 @@ ArangoDatabase.prototype._truncate = function (id) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ArangoDatabase.prototype._drop = function (id) {
|
||||
var collection = this._collection(id);
|
||||
var name;
|
||||
|
||||
if (collection instanceof this._collectionConstructor) {
|
||||
return collection.drop();
|
||||
for (name in this) {
|
||||
if (this.hasOwnProperty(name)) {
|
||||
var collection = this[name];
|
||||
|
||||
if (collection instanceof this._collectionConstructor) {
|
||||
if (collection._id === id || collection._name === id) {
|
||||
return collection.drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var c = this._collection(id);
|
||||
if (c) {
|
||||
return c.drop();
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
|
|
|
@ -331,7 +331,8 @@ var documentsView = Backbone.View.extend({
|
|||
|
||||
addDocument: function () {
|
||||
var collid = window.location.hash.split("/")[1];
|
||||
var doctype = arangoHelper.collectionApiType(collid);
|
||||
// second parameter is "true" to disable caching of collection type
|
||||
var doctype = arangoHelper.collectionApiType(collid, true);
|
||||
|
||||
if (doctype === 'edge') {
|
||||
$('#edgeCreateModal').modal('show');
|
||||
|
|
|
@ -406,12 +406,24 @@ ArangoDatabase.prototype._truncate = function (id) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ArangoDatabase.prototype._drop = function (id) {
|
||||
var collection = this._collection(id);
|
||||
var name;
|
||||
|
||||
if (collection instanceof this._collectionConstructor) {
|
||||
return collection.drop();
|
||||
for (name in this) {
|
||||
if (this.hasOwnProperty(name)) {
|
||||
var collection = this[name];
|
||||
|
||||
if (collection instanceof this._collectionConstructor) {
|
||||
if (collection._id === id || collection._name === id) {
|
||||
return collection.drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var c = this._collection(id);
|
||||
if (c) {
|
||||
return c.drop();
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue