WebUI: make error messages user dismissible

Fixes #1171

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-02-10 18:07:23 +01:00
parent e0c3a13ac5
commit 04ab8e72f6
43 changed files with 369 additions and 319 deletions

View File

@@ -42,8 +42,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}}
{{define "page_body"}}
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
<div id="errorTxt" class="card-body text-form-error"></div>
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
<span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="card shadow mb-4">
<div class="card-header">
@@ -150,6 +153,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{if not .ReadOnly}}
function saveFile() {
$('#idSave').addClass("disabled");
$('#errorMsg').hide();
async function uploadFile() {
var errorMessage = "Error saving file";
@@ -193,9 +197,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
$('#idSave').removeClass("disabled");
$('#errorTxt').text(error.message);
$('#errorMsg').show();
setTimeout(function () {
$('#errorMsg').hide();
}, 5000);
});
}
{{end}}