mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
js: Fix that the fallback spinner is not utilized for auto submits
refs #8369
This commit is contained in:
parent
46cd47b73c
commit
d9855d8273
@ -336,43 +336,45 @@
|
|||||||
// Show a spinner depending on how the form is being submitted
|
// Show a spinner depending on how the form is being submitted
|
||||||
if (autosubmit && typeof $el !== 'undefined' && $el.next().hasClass('autosubmit-warning')) {
|
if (autosubmit && typeof $el !== 'undefined' && $el.next().hasClass('autosubmit-warning')) {
|
||||||
$el.next().addClass('spinning');
|
$el.next().addClass('spinning');
|
||||||
} else if ($button.length) {
|
} else if ($button.length && $button.attr('data-progress-label')) {
|
||||||
if ($button.attr('data-progress-label')) {
|
var isInput = $button.is('input');
|
||||||
var isInput = $button.is('input');
|
if (isInput) {
|
||||||
if (isInput) {
|
$button.prop('value', $button.attr('data-progress-label') + '...');
|
||||||
$button.prop('value', $button.attr('data-progress-label') + '...');
|
} else {
|
||||||
} else {
|
$button.html($button.attr('data-progress-label') + '...');
|
||||||
$button.html($button.attr('data-progress-label') + '...');
|
}
|
||||||
|
|
||||||
|
// Use a fixed width to prevent the button from wobbling
|
||||||
|
$button.css('width', $button.css('width'));
|
||||||
|
|
||||||
|
progressTimer = icinga.timer.register(function () {
|
||||||
|
var label = isInput ? $button.prop('value') : $button.html();
|
||||||
|
var dots = label.substr(-3);
|
||||||
|
|
||||||
|
// Using empty spaces here to prevent centered labels from wobbling
|
||||||
|
if (dots === '...') {
|
||||||
|
label = label.slice(0, -2) + ' ';
|
||||||
|
} else if (dots === '.. ') {
|
||||||
|
label = label.slice(0, -1) + '.';
|
||||||
|
} else if (dots === '. ') {
|
||||||
|
label = label.slice(0, -2) + '. ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a fixed width to prevent the button from wobbling
|
if (isInput) {
|
||||||
$button.css('width', $button.css('width'));
|
$button.prop('value', label);
|
||||||
|
} else {
|
||||||
progressTimer = icinga.timer.register(function () {
|
$button.html(label);
|
||||||
var label = isInput ? $button.prop('value') : $button.html();
|
}
|
||||||
var dots = label.substr(-3);
|
}, null, 100);
|
||||||
|
} else if ($button.length && $button.next().hasClass('spinner')) {
|
||||||
// Using empty spaces here to prevent centered labels from wobbling
|
$('i', $button.next()).addClass('active');
|
||||||
if (dots === '...') {
|
} else if ($form.attr('data-progress-element')) {
|
||||||
label = label.slice(0, -2) + ' ';
|
var $progressElement = $('#' + $form.attr('data-progress-element'));
|
||||||
} else if (dots === '.. ') {
|
if ($progressElement.length) {
|
||||||
label = label.slice(0, -1) + '.';
|
if ($progressElement.hasClass('spinner')) {
|
||||||
} else if (dots === '. ') {
|
|
||||||
label = label.slice(0, -2) + '. ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInput) {
|
|
||||||
$button.prop('value', label);
|
|
||||||
} else {
|
|
||||||
$button.html(label);
|
|
||||||
}
|
|
||||||
}, null, 100);
|
|
||||||
} else if ($button.next().hasClass('spinner')) {
|
|
||||||
$('i', $button.next()).addClass('active');
|
|
||||||
} else if ($form.attr('data-progress-element')) {
|
|
||||||
var $progressElement = $('#' + $form.attr('data-progress-element'));
|
|
||||||
if ($progressElement.length) {
|
|
||||||
$('i', $progressElement).addClass('active');
|
$('i', $progressElement).addClass('active');
|
||||||
|
} else {
|
||||||
|
$('i.autosubmit-warning', $progressElement).addClass('spinning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user