From 98aa9bc148b945ba5c85657675e22f2f868ef43c Mon Sep 17 00:00:00 2001
From: 0xb00bface <0xboobface@gmail.com>
Date: Sun, 12 Nov 2023 17:58:08 +0100
Subject: [PATCH] Fix: show notification and clear input field after adding a
model
---
.../src/main/resources/html/static/index.html | 29 ++++++++++---------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/server/src/main/resources/html/static/index.html b/server/src/main/resources/html/static/index.html
index 830f0c95..98a96386 100644
--- a/server/src/main/resources/html/static/index.html
+++ b/server/src/main/resources/html/static/index.html
@@ -137,8 +137,8 @@
+ style: { width: space.percent() + '%' },
+ text: space.percent() + '%'">
@@ -153,7 +153,7 @@
Model |
Date |
Status |
-
+
Size |
|
|
@@ -166,7 +166,7 @@
|
|
|
-
+
|
@@ -289,13 +289,13 @@
function addModelKeyPressed(e) {
let charCode = (typeof e.which === "number") ? e.which : e.keyCode;
let val = $('#addModelByUrl').val();
- let duration = $('#recordingDuration').val(); // Get the recording duration input
- if (charCode === 13) {
- // Check if a valid duration is provided
- let durationMinutes = duration ? parseInt(duration) : undefined;
- ctbrec.add(val, durationMinutes, function() {
- $('#addModelByUrl').val('');
- $('#recordingDuration').val(''); // Clear the recording duration input
+ let duration = $('#recordingDuration').val(); // Get the recording duration input
+ if (charCode === 13) {
+ // Check if a valid duration is provided
+ let durationMinutes = duration ? parseInt(duration) : undefined;
+ ctbrec.add(val, durationMinutes, function() {
+ $('#addModelByUrl').val('');
+ $('#recordingDuration').val(''); // Clear the recording duration input
});
} else {
$('#addModelByUrl').autocomplete({
@@ -305,7 +305,7 @@
}
let ctbrec = {
- add: function(input, onsuccess) {
+ add: function(input, duration, onsuccess) {
try {
let model = {
type: null,
@@ -326,8 +326,11 @@
data: msg
})
.done(function(data) {
+ console.log(data);
if (data.status === 'success') {
- onsuccess.call(data);
+ if (onsuccess) {
+ onsuccess.call(data);
+ }
$.notify('Model added', 'info');
} else {
$.notify('Adding model failed', 'error');
|