2 Commits

Author SHA1 Message Date
c50a584a65 Merge branch 'fix/communicate-file-too-large' into 'marietje-zuid'
Draft: fix(songs): handle HTTP 413 and remove redundant .json() calls

Closes #76 and #84

See merge request technicie/MarietjeDjango!90
2024-03-05 14:54:41 +01:00
77cf681c64 feature(queue): refresh queue after requesting
Closes #84
2024-02-28 00:25:21 +01:00
2 changed files with 11 additions and 27 deletions

View File

@ -105,10 +105,6 @@ footer {
transition: 1s transform ease-in-out; transition: 1s transform ease-in-out;
} }
.btn-link {
text-decoration: none;
}
.navbar-text { .navbar-text {
color: var(--text-color); color: var(--text-color);
} }
@ -117,11 +113,6 @@ footer {
color: red !important; 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> */ /* Bootstrap 3 doesn't support equal height columns, hack via <https://medium.com/wdstack/bootstrap-equal-height-columns-d07bc934eb27#892f> */
.row.display-flex { .row.display-flex {
display: flex; display: flex;

View File

@ -58,16 +58,14 @@
</p> </p>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<p class="navbar-text mb-0 duration-queue" v-bind:class="{danger: infobar.length_personal_queue > infobar.max_length * 60}"> <p class="navbar-text mb-0 duration-queue" v-bind:class="{danger: infobar.length_personal_queue > infobar.max_length * 60}">(${ infobar.length_personal_queue.secondsToMMSS() }$)</p>
(${ infobar.length_personal_queue.secondsToMMSS() }$)
</p>
</li> </li>
</template> </template>
</ul> </ul>
</div> </div>
</nav> </nav>
<div class="container-lg"> <div class="container-lg">
<div class="d-none d-lg-block"><br></div> <br><br>
<div class="alert-location"> <div class="alert-location">
</div> </div>
<div class="tab-content"> <div class="tab-content">
@ -85,8 +83,8 @@
</td> </td>
<td class="col-md-1"> <td class="col-md-1">
<span class="control-icons">Control</span> <span class="control-icons">Control</span>
<span v-if="playsIn" class="btn btn-link p-0 d-sm-none" v-on:click="playsIn = false" >(Plays In)</span> <span v-if="playsIn" class="btn btn-link p-0 d-sm-none" v-on:click="toggle_details(song)">(Plays in)</span>
<span v-else class="btn btn-link p-0 d-sm-none" v-on:click="playsIn = true">(Plays At)</span> <span v-else class="btn btn-link p-0 d-sm-none" v-on:click="toggle_details(song)">(Plays At)</span>
</td> </td>
</tr> </tr>
</thead> </thead>
@ -101,7 +99,7 @@
<td> <td>
<span class="artist">${ song.song.artist }$</span> <span class="artist">${ song.song.artist }$</span>
<span v-if="show_details(song)" class="requested-by d-sm-none d-block small mt-3 fw-normal"> <span v-if="show_details(song)" class="requested-by d-sm-none d-block small mt-3 fw-normal">
Requested By:<br> Requested by:<br>
<template v-if="song.user === null"> <template v-if="song.user === null">
Marietje Marietje
</template> </template>
@ -221,12 +219,12 @@
</tfoot> </tfoot>
<tbody> <tbody>
<template v-for="(song, index) in songs"> <template v-for="(song, index) in songs">
<tr v-bind:class="{disabled: is_in_queue(song)}"> <tr>
<td> <td>
${ song.artist }$ ${ song.artist }$
</td> </td>
<td> <td>
<button v-on:click="request_song(song.id);" class="btn btn-link p-0" style="text-align: left">${ song.title }$</button> <button v-on:click="request_song(song.id);" class="btn btn-link p-0 text-decoration-none" style="text-align: left">${ song.title }$</button>
</td> </td>
<td> <td>
<template v-if="song.user === null"> <template v-if="song.user === null">
@ -240,7 +238,7 @@
${ song.duration.secondsToMMSS() }$ ${ song.duration.secondsToMMSS() }$
</td> </td>
<td> <td>
<button v-on:click="report_song(song.id);" class="btn btn-link p-0" style="pointer-events: auto"> <button v-on:click="report_song(song.id);" class="btn btn-link p-0 text-decoration-none">
</button> </button>
</td> </td>
@ -367,9 +365,7 @@
const current_song = this.queue[i]; const current_song = this.queue[i];
if (i === 0) { if (i === 0) {
const current_song_remaining_seconds = current_song.song.duration - this.queue[1].time_until_song_seconds; const current_song_remaining_seconds = current_song.song.duration - this.queue[1].time_until_song_seconds;
if (current_song.user !== null && current_song.user.id === this.user_data.id) {
infoBar['length_personal_queue'] -= current_song_remaining_seconds; infoBar['length_personal_queue'] -= current_song_remaining_seconds;
}
infoBar['length_total_queue'] -= current_song_remaining_seconds; infoBar['length_total_queue'] -= current_song_remaining_seconds;
} }
infoBar['length_total_queue'] += current_song.song.duration; infoBar['length_total_queue'] += current_song.song.duration;
@ -377,7 +373,7 @@
infoBar['length_personal_queue'] += current_song.song.duration; infoBar['length_personal_queue'] += current_song.song.duration;
infoBar['end_personal_queue'] = infoBar['length_total_queue']; infoBar['end_personal_queue'] = infoBar['length_total_queue'];
if (infoBar['start_personal_queue'] === null) { if (infoBar['start_personal_queue'] === null) {
infoBar['start_personal_queue'] = infoBar['length_total_queue'] - current_song.song.duration; infoBar['start_personal_queue'] = infoBar['length_total_queue'] - current_song.song.duration - this.queue[1].time_until_song_seconds;
} }
} }
} }
@ -585,10 +581,6 @@
} }
}); });
}, },
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) { request_song(song_id) {
fetch('/api/v1/queues/current/request/', { fetch('/api/v1/queues/current/request/', {
@ -619,6 +611,7 @@
tata.error('', "An unknown exception occurred.") tata.error('', "An unknown exception occurred.")
} }
}); });
queue_vue.refresh();
}, },
report_song(song_id) { report_song(song_id) {