1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 23:48:47 +00:00

add admin clean device errors api

This commit is contained in:
lian
2016-04-29 15:32:57 +08:00
parent d649038a29
commit 65dc2ff54b
4 changed files with 68 additions and 3 deletions

View File

@@ -21,12 +21,38 @@ define([
this.render();
},
events: {
'click #clean-device-errors': 'cleanDeviceErrors'
},
cleanDeviceErrors: function() {
var _this = this;
$.ajax({
url: Common.getUrl({name: 'admin-device-errors'}),
type: 'DELETE',
beforeSend: Common.prepareCSRFToken,
success: function() {
_this.$table.hide();
_this.$cleanBtn.hide();
_this.$emptyTip.show();
_this.deviceErrorsCollection.reset();
var msg = gettext("Successfully clean all errors.");
Common.feedback(msg, 'success');
},
error: function(xhr) {
Common.ajaxErrorHandler(xhr);
}
});
return false;
},
render: function() {
this.$el.html(this.template({'cur_tab': 'errors'}));
this.$table = this.$('table');
this.$tableBody = $('tbody', this.$table);
this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = this.$('.empty-tips');
this.$cleanBtn = this.$('#clean-device-errors');
},
hide: function() {
@@ -75,6 +101,7 @@ define([
if (this.deviceErrorsCollection.length) {
this.deviceErrorsCollection.each(this.addOne, this);
this.$table.show();
this.$cleanBtn.show();
} else {
this.$emptyTip.show();
}