aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/js/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/js/settings.js')
-rw-r--r--apps/files_external/js/settings.js40
1 files changed, 29 insertions, 11 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 7bcf821f1ad..78952882f95 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -770,6 +770,8 @@ MountConfigListView.prototype = _.extend({
storageConfig.backend = $target.val();
$tr.find('.mountPoint input').val('');
+ $tr.find('.selectBackend').prop('selectedIndex', 0)
+
var onCompletion = jQuery.Deferred();
$tr = this.newStorage(storageConfig, onCompletion);
$tr.find('.applicableToAllUsers').prop('checked', false).trigger('change');
@@ -878,7 +880,7 @@ MountConfigListView.prototype = _.extend({
$tr.find('.applicable,.mountOptionsToggle').empty();
$tr.find('.save').empty();
if (backend.invalid) {
- this.updateStatus($tr, false, 'Unknown backend: ' + backend.name);
+ this.updateStatus($tr, false, t('files_external', 'Unknown backend: {backendName}', {backendName: backend.name}));
}
return $tr;
}
@@ -981,9 +983,10 @@ MountConfigListView.prototype = _.extend({
data: {'testOnly' : true},
contentType: 'application/json',
success: function(result) {
+ result = Object.values(result);
var onCompletion = jQuery.Deferred();
var $rows = $();
- Object.values(result).forEach(function(storageParams) {
+ result.forEach(function(storageParams) {
var storageConfig;
var isUserGlobal = storageParams.type === 'system' && self._isPersonal;
storageParams.mountPoint = storageParams.mountPoint.substr(1); // trim leading slash
@@ -1012,6 +1015,13 @@ MountConfigListView.prototype = _.extend({
// userglobal storages do not expose configuration data
$tr.find('.configuration').text(t('files_external', 'Admin defined'));
}
+
+ // don't recheck config automatically when there are a large number of storages
+ if (result.length < 20) {
+ self.recheckStorageConfig($tr);
+ } else {
+ self.updateStatus($tr, StorageConfig.Status.INDETERMINATE, t('files_external', 'Automatic status checking is disabled due to the large number of configured storages, click to check status'));
+ }
$rows = $rows.add($tr);
});
initApplicableUsersMultiselect(self.$el.find('.applicableUsers'), this._userListLimit);
@@ -1230,8 +1240,9 @@ MountConfigListView.prototype = _.extend({
success: function () {
$tr.remove();
},
- error: function () {
- self.updateStatus($tr, StorageConfig.Status.ERROR);
+ error: function (result) {
+ const statusMessage = (result && result.responseJSON) ? result.responseJSON.message : undefined;
+ self.updateStatus($tr, StorageConfig.Status.ERROR, statusMessage);
}
});
}
@@ -1258,7 +1269,7 @@ MountConfigListView.prototype = _.extend({
if (concurrentTimer === undefined
|| $tr.data('save-timer') === concurrentTimer
) {
- self.updateStatus($tr, result.status);
+ self.updateStatus($tr, result.status, result.statusMessage);
$tr.data('id', result.id);
if (_.isFunction(callback)) {
@@ -1266,11 +1277,12 @@ MountConfigListView.prototype = _.extend({
}
}
},
- error: function() {
+ error: function(result) {
if (concurrentTimer === undefined
|| $tr.data('save-timer') === concurrentTimer
) {
- self.updateStatus($tr, StorageConfig.Status.ERROR);
+ const statusMessage = (result && result.responseJSON) ? result.responseJSON.message : undefined;
+ self.updateStatus($tr, StorageConfig.Status.ERROR, statusMessage);
}
}
});
@@ -1294,8 +1306,9 @@ MountConfigListView.prototype = _.extend({
success: function(result) {
self.updateStatus($tr, result.status, result.statusMessage);
},
- error: function() {
- self.updateStatus($tr, StorageConfig.Status.ERROR);
+ error: function(result) {
+ const statusMessage = (result && result.responseJSON) ? result.responseJSON.message : undefined;
+ self.updateStatus($tr, StorageConfig.Status.ERROR, statusMessage);
}
});
},
@@ -1312,6 +1325,7 @@ MountConfigListView.prototype = _.extend({
switch (status) {
case null:
// remove status
+ $statusSpan.hide();
break;
case StorageConfig.Status.IN_PROGRESS:
$statusSpan.attr('class', 'icon-loading-small');
@@ -1325,9 +1339,13 @@ MountConfigListView.prototype = _.extend({
default:
$statusSpan.attr('class', 'error icon-error-white');
}
- if (typeof message === 'string') {
- $statusSpan.attr('title', message);
+ if (status !== null) {
+ $statusSpan.show();
+ }
+ if (typeof message !== 'string') {
+ message = t('files_external', 'Click to recheck the configuration');
}
+ $statusSpan.attr('title', message);
},
/**