Merge pull request #5253 from owncloud/externalstorage-adminstatusindicator

Fixed external storage status indicator in admin page
This commit is contained in:
Morris Jobke 2013-10-13 13:03:02 -07:00
commit a021a12b3b
4 changed files with 30 additions and 26 deletions

View File

@ -4,7 +4,6 @@ td.status > span {
width: 16px; width: 16px;
vertical-align: text-bottom; vertical-align: text-bottom;
} }
span.success { span.success {
background: #37ce02; background: #37ce02;
border-radius: 8px; border-radius: 8px;
@ -12,9 +11,6 @@ span.success {
span.error { span.error {
background: #ce3702; background: #ce3702;
} }
span.waiting {
background: none;
}
td.mountPoint, td.backend { width:10em; } td.mountPoint, td.backend { width:10em; }
td.remove>img { visibility:hidden; padding-top:0.8em; } td.remove>img { visibility:hidden; padding-top:0.8em; }

View File

@ -1,10 +1,23 @@
(function(){
function updateStatus(statusEl, result){
statusEl.removeClass('success error loading-small');
if (result && result.status == 'success' && result.data.message) {
statusEl.addClass('success');
return true;
} else {
statusEl.addClass('error');
return false;
}
}
OC.MountConfig={ OC.MountConfig={
saveStorage:function(tr) { saveStorage:function(tr) {
var mountPoint = $(tr).find('.mountPoint input').val(); var mountPoint = $(tr).find('.mountPoint input').val();
if (mountPoint == '') { if (mountPoint == '') {
return false; return false;
} }
var statusSpan = $(tr).find('.status span'); var statusSpan = $(tr).closest('tr').find('.status span');
var backendClass = $(tr).find('.backend').data('class'); var backendClass = $(tr).find('.backend').data('class');
var configuration = $(tr).find('.configuration input'); var configuration = $(tr).find('.configuration input');
var addMountPoint = true; var addMountPoint = true;
@ -58,6 +71,7 @@ OC.MountConfig={
} }
users.push(applicable); users.push(applicable);
} }
statusSpan.addClass('loading-small').removeClass('error success');
$.ajax({type: 'POST', $.ajax({type: 'POST',
url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'),
data: { data: {
@ -68,15 +82,11 @@ OC.MountConfig={
applicable: applicable, applicable: applicable,
isPersonal: isPersonal isPersonal: isPersonal
}, },
async: false,
success: function(result) { success: function(result) {
statusSpan.removeClass(); status = updateStatus(statusSpan, result);
if (result && result.status == 'success' && result.data.message) { },
status = true; error: function(result){
statusSpan.addClass('success'); status = updateStatus(statusSpan, result);
} else {
statusSpan.addClass('error');
}
} }
}); });
}); });
@ -93,8 +103,7 @@ OC.MountConfig={
mountType: mountType, mountType: mountType,
applicable: applicable, applicable: applicable,
isPersonal: isPersonal isPersonal: isPersonal
}, }
async: false
}); });
}); });
var mountType = 'user'; var mountType = 'user';
@ -108,14 +117,14 @@ OC.MountConfig={
mountType: mountType, mountType: mountType,
applicable: applicable, applicable: applicable,
isPersonal: isPersonal isPersonal: isPersonal
}, }
async: false
}); });
}); });
} else { } else {
var isPersonal = true; var isPersonal = true;
var mountType = 'user'; var mountType = 'user';
var applicable = OC.currentUser; var applicable = OC.currentUser;
statusSpan.addClass('loading-small').removeClass('error success');
$.ajax({type: 'POST', $.ajax({type: 'POST',
url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'),
data: { data: {
@ -126,15 +135,11 @@ OC.MountConfig={
applicable: applicable, applicable: applicable,
isPersonal: isPersonal isPersonal: isPersonal
}, },
async: false,
success: function(result) { success: function(result) {
statusSpan.removeClass(); status = updateStatus(statusSpan, result);
if (result && result.status == 'success' && result.data.message) { },
status = true; error: function(result){
statusSpan.addClass('success'); status = updateStatus(statusSpan, result);
} else {
statusSpan.addClass('error');
}
} }
}); });
} }
@ -157,7 +162,7 @@ $(document).ready(function() {
$(tr).find('.mountPoint input').val(suggestMountPoint(selected)); $(tr).find('.mountPoint input').val(suggestMountPoint(selected));
} }
$(tr).addClass(backendClass); $(tr).addClass(backendClass);
$(tr).find('.status').append('<span class="waiting"></span>'); $(tr).find('.status').append('<span></span>');
$(tr).find('.backend').data('class', backendClass); $(tr).find('.backend').data('class', backendClass);
var configurations = $(this).data('configurations'); var configurations = $(this).data('configurations');
var td = $(tr).find('td.configuration'); var td = $(tr).find('td.configuration');
@ -293,3 +298,5 @@ $(document).ready(function() {
}); });
}); });
})();

View File

@ -748,6 +748,7 @@ a.bookmarklet { background-color:#ddd; border:1px solid #ccc; padding:5px;paddin
span.ui-icon {float: left; margin: 3px 7px 30px 0;} span.ui-icon {float: left; margin: 3px 7px 30px 0;}
.loading { background: url('../img/loading.gif') no-repeat center; cursor: wait; } .loading { background: url('../img/loading.gif') no-repeat center; cursor: wait; }
.loading-small { background: url('../img/loading-small.gif') no-repeat center; cursor: wait; }
.move2trash { /* decrease spinner size */ .move2trash { /* decrease spinner size */
width: 16px; width: 16px;
height: 16px; height: 16px;

BIN
core/img/loading-small.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB