Remove status indicator on modification
This commit is contained in:
parent
7afbf0f8c1
commit
4ac33ab26b
|
@ -709,11 +709,12 @@ MountConfigListView.prototype = _.extend({
|
||||||
}
|
}
|
||||||
highlightInput($target);
|
highlightInput($target);
|
||||||
var $tr = $target.closest('tr');
|
var $tr = $target.closest('tr');
|
||||||
|
this.updateStatus($tr, null);
|
||||||
|
|
||||||
var timer = $tr.data('save-timer');
|
var timer = $tr.data('save-timer');
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
timer = setTimeout(function() {
|
timer = setTimeout(function() {
|
||||||
self.saveStorageConfig($tr);
|
self.saveStorageConfig($tr, null, timer);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
$tr.data('save-timer', timer);
|
$tr.data('save-timer', timer);
|
||||||
},
|
},
|
||||||
|
@ -931,8 +932,9 @@ MountConfigListView.prototype = _.extend({
|
||||||
*
|
*
|
||||||
* @param $tr storage row
|
* @param $tr storage row
|
||||||
* @param Function callback callback to call after save
|
* @param Function callback callback to call after save
|
||||||
|
* @param concurrentTimer only update if the timer matches this
|
||||||
*/
|
*/
|
||||||
saveStorageConfig:function($tr, callback) {
|
saveStorageConfig:function($tr, callback, concurrentTimer) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var storage = this.getStorageConfig($tr);
|
var storage = this.getStorageConfig($tr);
|
||||||
if (!storage.validate()) {
|
if (!storage.validate()) {
|
||||||
|
@ -942,16 +944,24 @@ MountConfigListView.prototype = _.extend({
|
||||||
this.updateStatus($tr, StorageConfig.Status.IN_PROGRESS);
|
this.updateStatus($tr, StorageConfig.Status.IN_PROGRESS);
|
||||||
storage.save({
|
storage.save({
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
|
if (concurrentTimer === undefined
|
||||||
|
|| $tr.data('save-timer') === concurrentTimer
|
||||||
|
) {
|
||||||
self.updateStatus($tr, result.status);
|
self.updateStatus($tr, result.status);
|
||||||
$tr.attr('data-id', result.id);
|
$tr.attr('data-id', result.id);
|
||||||
|
|
||||||
if (_.isFunction(callback)) {
|
if (_.isFunction(callback)) {
|
||||||
callback(storage);
|
callback(storage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
|
if (concurrentTimer === undefined
|
||||||
|
|| $tr.data('save-timer') === concurrentTimer
|
||||||
|
) {
|
||||||
self.updateStatus($tr, StorageConfig.Status.ERROR);
|
self.updateStatus($tr, StorageConfig.Status.ERROR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -989,6 +999,9 @@ MountConfigListView.prototype = _.extend({
|
||||||
var $statusSpan = $tr.find('.status span');
|
var $statusSpan = $tr.find('.status span');
|
||||||
$statusSpan.removeClass('loading-small success indeterminate error');
|
$statusSpan.removeClass('loading-small success indeterminate error');
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
case null:
|
||||||
|
// remove status
|
||||||
|
break;
|
||||||
case StorageConfig.Status.IN_PROGRESS:
|
case StorageConfig.Status.IN_PROGRESS:
|
||||||
$statusSpan.addClass('loading-small');
|
$statusSpan.addClass('loading-small');
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue