mirror of https://gitee.com/bigwinds/arangodb
web ui - collections now using async loading mechanism
This commit is contained in:
parent
ed3f635407
commit
711a7a3c4f
|
@ -144,25 +144,25 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadCollection: function () {
|
loadCollection: function (callback) {
|
||||||
var self = this;
|
|
||||||
window.progressView.showWithDelay(500, "Loading collection...");
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
url: "/_api/collection/" + this.get("id") + "/load",
|
url: "/_api/collection/" + this.get("id") + "/load",
|
||||||
success: function () {
|
success: function () {
|
||||||
self.set("status", "loaded");
|
|
||||||
if (window.location.hash === "#collections") {
|
|
||||||
window.App.collectionsView.render();
|
|
||||||
}
|
|
||||||
window.progressView.hide();
|
window.progressView.hide();
|
||||||
|
callback(false);
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
arangoHelper.arangoError('Collection error');
|
window.progressView.hide();
|
||||||
|
callback(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
callback();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unloadCollection: function () {
|
unloadCollection: function () {
|
||||||
|
|
|
@ -68,7 +68,29 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
loadCollection: function () {
|
loadCollection: function () {
|
||||||
this.model.loadCollection();
|
|
||||||
|
var loadCollectionCallback = function(error) {
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
arangoHelper.arangoError('Collection error');
|
||||||
|
}
|
||||||
|
else if (error === undefined) {
|
||||||
|
this.model.set("status", "loading");
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (window.location.hash === "#collections") {
|
||||||
|
this.model.set("status", "loaded");
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
arangoHelper.arangoNotification("Collection " + this.model.get("name") + " loaded.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
this.model.loadCollection(loadCollectionCallback);
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue