add an overlay feedback

This commit is contained in:
Jakob Ketterl 2023-05-19 00:01:35 +02:00
parent 31375fab61
commit 2c3cd98e28
3 changed files with 19 additions and 0 deletions

View file

@ -163,4 +163,14 @@ h1 {
.device-log-messages {
max-height: 500px;
}
.overlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, .5);
display: none;
}

View file

@ -18,6 +18,7 @@ $.fn.profileList = function() {
$profiles.find('a').attr('draggable', 'false');
var $profileEl;
var originalIndex;
var $spinner = $('.overlay-spinner');
var moveProfile = function(profileId, index) {
var url = $profileList.find('.device a').attr('href');
@ -50,6 +51,8 @@ $.fn.profileList = function() {
if (!isValidDrag(event)) return;
var $target = $(event.target).closest('.profile');
var index = $profileList.find('.profile').index($target);
$spinner.addClass('d-flex');
moveProfile(event.originalEvent.dataTransfer.getData(dataType), index).done(function() {
// done
}).fail(function() {
@ -57,6 +60,7 @@ $.fn.profileList = function() {
$profileEl.remove().insertBefore($profileList.children().eq(originalIndex));
}).always(function() {
$profileEl = undefined;
$spinner.removeClass('d-flex');
});
}).on('dragend', '.profile', function(event) {
if (event.originalEvent.dataTransfer.dropEffect === 'none') {

View file

@ -208,6 +208,11 @@ class SdrFormControllerWithModal(SdrFormController, metaclass=ABCMeta):
</div>
</div>
</div>
<div class="overlay overlay-spinner justify-content-center align-items-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
""".format(
object_type=self.getModalObjectType(),
confirm_url=self.getModalConfirmUrl(),