@@ -766,6 +766,8 @@ MountConfigListView.prototype = _.extend({
766766 storageConfig . backend = $target . val ( ) ;
767767 $tr . find ( '.mountPoint input' ) . val ( '' ) ;
768768
769+ $tr . find ( '.selectBackend' ) . prop ( 'selectedIndex' , 0 )
770+
769771 var onCompletion = jQuery . Deferred ( ) ;
770772 $tr = this . newStorage ( storageConfig , onCompletion ) ;
771773 $tr . find ( '.applicableToAllUsers' ) . prop ( 'checked' , false ) . trigger ( 'change' ) ;
@@ -874,7 +876,7 @@ MountConfigListView.prototype = _.extend({
874876 $tr . find ( '.applicable,.mountOptionsToggle' ) . empty ( ) ;
875877 $tr . find ( '.save' ) . empty ( ) ;
876878 if ( backend . invalid ) {
877- this . updateStatus ( $tr , false , ' Unknown backend: ' + backend . name ) ;
879+ this . updateStatus ( $tr , false , t ( 'files_external' , ' Unknown backend: {backendName}' , { backendName : backend . name } ) ) ;
878880 }
879881 return $tr ;
880882 }
@@ -977,9 +979,10 @@ MountConfigListView.prototype = _.extend({
977979 data : { 'testOnly' : true } ,
978980 contentType : 'application/json' ,
979981 success : function ( result ) {
982+ result = Object . values ( result ) ;
980983 var onCompletion = jQuery . Deferred ( ) ;
981984 var $rows = $ ( ) ;
982- Object . values ( result ) . forEach ( function ( storageParams ) {
985+ result . forEach ( function ( storageParams ) {
983986 var storageConfig ;
984987 var isUserGlobal = storageParams . type === 'system' && self . _isPersonal ;
985988 storageParams . mountPoint = storageParams . mountPoint . substr ( 1 ) ; // trim leading slash
@@ -1008,6 +1011,13 @@ MountConfigListView.prototype = _.extend({
10081011 // userglobal storages do not expose configuration data
10091012 $tr . find ( '.configuration' ) . text ( t ( 'files_external' , 'Admin defined' ) ) ;
10101013 }
1014+
1015+ // don't recheck config automatically when there are a large number of storages
1016+ if ( result . length < 20 ) {
1017+ self . recheckStorageConfig ( $tr ) ;
1018+ } else {
1019+ 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' ) ) ;
1020+ }
10111021 $rows = $rows . add ( $tr ) ;
10121022 } ) ;
10131023 initApplicableUsersMultiselect ( self . $el . find ( '.applicableUsers' ) , this . _userListLimit ) ;
@@ -1226,8 +1236,9 @@ MountConfigListView.prototype = _.extend({
12261236 success : function ( ) {
12271237 $tr . remove ( ) ;
12281238 } ,
1229- error : function ( ) {
1230- self . updateStatus ( $tr , StorageConfig . Status . ERROR ) ;
1239+ error : function ( result ) {
1240+ const statusMessage = ( result && result . responseJSON ) ? result . responseJSON . message : undefined ;
1241+ self . updateStatus ( $tr , StorageConfig . Status . ERROR , statusMessage ) ;
12311242 }
12321243 } ) ;
12331244 }
@@ -1254,19 +1265,20 @@ MountConfigListView.prototype = _.extend({
12541265 if ( concurrentTimer === undefined
12551266 || $tr . data ( 'save-timer' ) === concurrentTimer
12561267 ) {
1257- self . updateStatus ( $tr , result . status ) ;
1268+ self . updateStatus ( $tr , result . status , result . statusMessage ) ;
12581269 $tr . data ( 'id' , result . id ) ;
12591270
12601271 if ( _ . isFunction ( callback ) ) {
12611272 callback ( storage ) ;
12621273 }
12631274 }
12641275 } ,
1265- error : function ( ) {
1276+ error : function ( result ) {
12661277 if ( concurrentTimer === undefined
12671278 || $tr . data ( 'save-timer' ) === concurrentTimer
12681279 ) {
1269- self . updateStatus ( $tr , StorageConfig . Status . ERROR ) ;
1280+ const statusMessage = ( result && result . responseJSON ) ? result . responseJSON . message : undefined ;
1281+ self . updateStatus ( $tr , StorageConfig . Status . ERROR , statusMessage ) ;
12701282 }
12711283 }
12721284 } ) ;
@@ -1290,8 +1302,9 @@ MountConfigListView.prototype = _.extend({
12901302 success : function ( result ) {
12911303 self . updateStatus ( $tr , result . status , result . statusMessage ) ;
12921304 } ,
1293- error : function ( ) {
1294- self . updateStatus ( $tr , StorageConfig . Status . ERROR ) ;
1305+ error : function ( result ) {
1306+ const statusMessage = ( result && result . responseJSON ) ? result . responseJSON . message : undefined ;
1307+ self . updateStatus ( $tr , StorageConfig . Status . ERROR , statusMessage ) ;
12951308 }
12961309 } ) ;
12971310 } ,
@@ -1308,6 +1321,7 @@ MountConfigListView.prototype = _.extend({
13081321 switch ( status ) {
13091322 case null :
13101323 // remove status
1324+ $statusSpan . hide ( ) ;
13111325 break ;
13121326 case StorageConfig . Status . IN_PROGRESS :
13131327 $statusSpan . attr ( 'class' , 'icon-loading-small' ) ;
@@ -1321,9 +1335,13 @@ MountConfigListView.prototype = _.extend({
13211335 default :
13221336 $statusSpan . attr ( 'class' , 'error icon-error-white' ) ;
13231337 }
1324- if ( typeof message === 'string' ) {
1325- $statusSpan . attr ( 'title' , message ) ;
1338+ if ( status !== null ) {
1339+ $statusSpan . show ( ) ;
1340+ }
1341+ if ( typeof message !== 'string' ) {
1342+ message = t ( 'files_external' , 'Click to recheck the configuration' ) ;
13261343 }
1344+ $statusSpan . attr ( 'title' , message ) ;
13271345 } ,
13281346
13291347 /**
0 commit comments