fix recording manager - not showing data

This commit is contained in:
Nuwan 2023-03-14 13:38:55 +05:30
parent dd0e24fa19
commit 51f5f5ecf0
3 changed files with 34 additions and 32 deletions

View File

@ -1178,17 +1178,24 @@
})
}
function getUserSyncs(options) {
async function getUserSyncs(options) {
if (!options) {
options = {};
}
var userId = getId(options)
return $.ajax({
type: 'GET',
dataType: "json",
url: "/api/users/" + userId + "/syncs?" + $.param(options),
processData: false
})
try {
return await $.ajax({
type: 'GET',
dataType: "json",
url: "/api/users/" + userId + "/syncs?" + $.param(options),
processData: false
})
} catch (error) {
console.error(error);
throw(error)
}
}
function getUserSync(options) {
@ -1503,11 +1510,11 @@
function deleteRecordingClaim(id) {
return $.ajax({
type: "DELETE",
dataType: "json",
contentType: 'application/json',
url: "/api/recordings/" + id + "/claim"
});
type: "DELETE",
dataType: "json",
contentType: 'application/json',
url: "/api/recordings/" + id + "/claim"
});
}
function claimRecording(options) {

View File

@ -41,10 +41,9 @@
var working = paginator.data('working');
if(!working) {
paginator.data('working', true);
onPageSelected(targetPage)
.then(function(resp) {
const [data, textStatus, jqXHR] = resp;
.then(function(data, textStatus, jqXHR) {
totalEntries = data.total_entries || parseInt(jqXHR.getResponseHeader('total-entries'));
pages = calculatePages(totalEntries, perPage);
options = { pages: pages,
@ -58,12 +57,9 @@
paginator.data('working', false);
})
.catch(function(){
.catch(function(err){
paginator.data('working', false);
});
// .always(function() {
// paginator.data('working', false);
// });
}
else {

View File

@ -108,8 +108,7 @@ context.JK.SyncViewer = class SyncViewer
getUserSyncs: (page) =>
@rest.getUserSyncs({since: page * @limit, limit: @limit})
.done(this.processUserSyncs)
.then((response) => this.processUserSyncs(response))
load: () =>
@list.empty()
@ -118,7 +117,7 @@ context.JK.SyncViewer = class SyncViewer
this.renderHeader()
this.getUserSyncs(0)
.done((response) =>
.then((response) =>
$paginator = context.JK.Paginator.create(response.total_entries, @limit, 0, this.getUserSyncs)
@paginator.empty().append($paginator);
)
@ -973,31 +972,31 @@ context.JK.SyncViewer = class SyncViewer
title: "Confirm Deletion",
html: "Are you sure you want to delete this recording?",
yes: () => {
this.rest.deleteRecordingClaim(recordingId).done(async response=> {
rest.deleteRecordingClaim(recordingId)
.done(async (response) => {
const cmd =
{ type: 'recording_directory',
action: 'delete',
queue: 'cleanup',
recording_id: recordingId};
// now check if the sync is gone entirely, allowing us to delete it from the UI
this.rest.getUserSync({user_sync_id: recordingId}).done(userSync => {
rest.getUserSync({user_sync_id: recordingId}).done(userSync => {
// the user sync is still here. tell user it'll be done as soon as they've uploaded their files
return context.JK.ackBubble($delete, 'file-sync-delayed-deletion', {}, {offsetParent: $delete.closest('.dialog')});
context.JK.ackBubble($delete, 'file-sync-delayed-deletion', {}, {offsetParent: $delete.closest('.dialog')});
})
.fail(function(xhr) {
if (xhr.status === 404) {
// the userSync is gone; remove from file manager dynamically
const $recordingHolder = $details.closest('.recording-holder');
return $recordingHolder.slideUp();
$recordingHolder.slideUp();
} else {
return this.app.ajaxError(arguments);
app.ajaxError(arguments);
}
}.bind(this));
});
await context.jamClient.OnTrySyncCommand(cmd);
})
.fail(this.app.ajaxError);
//.fail(app.ajaxError);
}
});
@ -1096,7 +1095,6 @@ context.JK.SyncViewer = class SyncViewer
# @since = response.next
processUserSyncs: `async function(response){
this.list.empty();
// check if no entries
@ -1147,7 +1145,8 @@ context.JK.SyncViewer = class SyncViewer
this.separateByRecording();
return this.since = response.next;
this.since = response.next;
return response;
}`
resolveTrack: (commandMetadata) =>