New: show indicator when testing indexers, connections and download clients

This commit is contained in:
Mark McDowall
2014-08-02 20:05:21 -07:00
parent 1ed45625df
commit d9445eab84
8 changed files with 84 additions and 16 deletions

View File

@@ -8,22 +8,25 @@ define([
'Commands/CommandController',
'Mixins/AsModelBoundView',
'Mixins/AsValidatedView',
'underscore',
'Form/FormBuilder',
'Mixins/AutoComplete',
'bootstrap'
], function (vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView, _) {
], function (vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView) {
var view = Marionette.ItemView.extend({
template: 'Settings/Indexers/Edit/IndexerEditViewTemplate',
ui: {
indicator : '.x-indicator'
},
events: {
'click .x-save' : '_save',
'click .x-save-and-add': '_saveAndAdd',
'click .x-delete' : '_delete',
'click .x-back' : '_back',
'click .x-close' : '_close',
'click .x-test' : '_test'
'click .x-save' : '_save',
'click .x-save-and-add' : '_saveAndAdd',
'click .x-delete' : '_delete',
'click .x-back' : '_back',
'click .x-close' : '_close',
'click .x-test' : '_test'
},
initialize: function (options) {
@@ -31,6 +34,8 @@ define([
},
_save: function () {
this.ui.indicator.show();
var self = this;
var promise = this.model.save();
@@ -39,10 +44,16 @@ define([
self.targetCollection.add(self.model, { merge: true });
vent.trigger(vent.Commands.CloseModalCommand);
});
promise.fail(function () {
self.ui.indicator.hide();
});
}
},
_saveAndAdd: function () {
this.ui.indicator.show();
var self = this;
var promise = this.model.save();
@@ -52,6 +63,10 @@ define([
require('Settings/Indexers/Add/IndexerSchemaModal').open(self.targetCollection);
});
promise.fail(function () {
self.ui.indicator.hide();
});
}
},
@@ -82,7 +97,13 @@ define([
},
_test: function () {
this.model.test();
var self = this;
this.ui.indicator.show();
this.model.test().always(function () {
self.ui.indicator.hide();
});
}
});