5 Commits

Author SHA1 Message Date
8f698315dc Merge branch 'feature/improve-queueable' into 'marietje-zuid'
Improvement to the visibility of already queued songs

See merge request technicie/MarietjeDjango!96
2024-09-10 17:27:12 +02:00
4bc3f38f69 Merge branch 'marietje-zuid' into 'feature/improve-queueable'
# Conflicts:
#   marietje/queues/templates/queues/queue.html
2024-09-10 17:19:12 +02:00
6d545dddcc feat: grey-out already queued songs and make unclickable 2024-05-06 13:55:19 +02:00
3f947a934c Merge branch 'fix/communicate-file-too-large' into 'marietje-zuid'
fix(songs): handle HTTP 413 and remove redundant .json() calls

Closes #76

See merge request technicie/MarietjeDjango!90
2024-04-23 19:09:55 +02:00
5c32fcb1d1 fix(songs): handle HTTP 413 and remove redundant .json() calls
Closes #76
2024-02-28 00:20:57 +01:00
3 changed files with 19 additions and 9 deletions

View File

@ -117,6 +117,11 @@ footer {
color: red !important;
}
.disabled {
pointer-events: none;
opacity: 0.5;
}
/* Bootstrap 3 doesn't support equal height columns, hack via <https://medium.com/wdstack/bootstrap-equal-height-columns-d07bc934eb27#892f> */
.row.display-flex {
display: flex;

View File

@ -221,7 +221,7 @@
</tfoot>
<tbody>
<template v-for="(song, index) in songs">
<tr>
<tr v-bind:class="{disabled: is_in_queue(song)}">
<td>
${ song.artist }$
</td>
@ -240,7 +240,7 @@
${ song.duration.secondsToMMSS() }$
</td>
<td>
<button v-on:click="report_song(song.id);" class="btn btn-link p-0">
<button v-on:click="report_song(song.id);" class="btn btn-link p-0" style="pointer-events: auto">
</button>
</td>
@ -585,6 +585,10 @@
}
});
},
is_in_queue(song) {
return queue_vue.queue.filter(queuesong => Boolean(queuesong.user)
).map((queuesong) => queuesong.song.hash).includes(song.hash);
},
request_song(song_id) {
fetch('/api/v1/queues/current/request/', {

View File

@ -179,13 +179,14 @@
}).catch(e => {
console.log(e);
if (e instanceof Response) {
try {
e.json().then(data => {
this.fileObjects[i].error_message = data.errorMessage;
this.fileObjects[i].success = false;
});
} catch {
this.fileObjects[i].error_message = "An exception occurred while uploading this file, please try again.";
// Intercept an HTTP 413 error (entity too large), as this might
// be thrown by a (reverse) proxy server and its payload is not
// nicely formatted as the code below expects.
if (e.status === 413) {
this.fileObjects[i].error_message = "The song you tried to upload is too large in size. (HTTP 413 error)";
this.fileObjects[i].success = false;
} else {
this.fileObjects[i].error_message = `${e.statusText} (${e.status})`;
this.fileObjects[i].success = false;
}
} else {