Fix: show notification and clear input field after adding a model
This commit is contained in:
parent
41ffd75d48
commit
98aa9bc148
|
@ -137,8 +137,8 @@
|
|||
<span data-bind="text: throughput.text()" style="float:right"></span>
|
||||
<span class="progress">
|
||||
<span class="progress-bar progress-bar-striped" role="progressbar" aria-valuemin="0" data-bind="attr: {'aria-valuemax': space.total, 'aria-valuenow': space.free},
|
||||
style: { width: space.percent() + '%' },
|
||||
text: space.percent() + '%'">
|
||||
style: { width: space.percent() + '%' },
|
||||
text: space.percent() + '%'">
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -153,7 +153,7 @@
|
|||
<th><a href="#" data-bind="orderable: {collection: 'recordings', field: 'model.name'}">Model</a></th>
|
||||
<th><a href="#" data-bind="orderable: {collection: 'recordings', field: 'startDate'}">Date</a></th>
|
||||
<th><a href="#" data-bind="orderable: {collection: 'recordings', field: 'ko_status'}">Status</a></th>
|
||||
<!-- <th><a href="#" data-bind="orderable: {collection: 'recordings', field: 'progress'}">Progress</a></th> -->
|
||||
<!-- <th><a href="#" data-bind="orderable: {collection: 'recordings', field: 'progress'}">Progress</a></th> -->
|
||||
<th><a href="#" data-bind="orderable: {collection: 'recordings', field: 'sizeInByte'}">Size</a></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
@ -166,7 +166,7 @@
|
|||
<td><a data-bind="attr: { href: model.url, title: model.name }, text: model.name"></a></td>
|
||||
<td data-bind="text: ko_date"></td>
|
||||
<td data-bind="text: ko_status"></td>
|
||||
<!-- <td data-bind="text: ko_progressString"></td> -->
|
||||
<!-- <td data-bind="text: ko_progressString"></td> -->
|
||||
<td data-bind="text: ko_size"></td>
|
||||
<td>
|
||||
<button class="btn btn-secondary fa fa-play" title="Play recording" data-bind="click: play"></button>
|
||||
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue