wip: queue restoring

This commit is contained in:
Roberto Tonino 2021-05-20 21:22:27 +02:00
parent 6e7a29ff42
commit 3ee56d020b
6 changed files with 16224 additions and 3573 deletions

16191
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -37,7 +37,8 @@ async function startApp() {
const connectResponse = await (await fetch('connect')).json()
store.dispatch('setAppInfo', connectResponse.update)
store.dispatch('setAppInfo', connectResponse.update).catch(console.error)
let arl = localStorage.getItem('arl')
if (connectResponse.autologin) {

View file

@ -214,7 +214,7 @@
</style>
<script>
const possibleStates = ['converting', 'downloading', 'download finished']
const possibleStates = ['converting', 'downloading', 'download finished', 'completed']
export default {
data() {

View file

@ -121,6 +121,7 @@ import QueueItem from '@components/downloads/QueueItem.vue'
import { socket } from '@/utils/socket'
import { toast } from '@/utils/toasts'
import { fetchData, sendToServer } from '@/utils/api'
const tabMinWidth = 250
const tabMaxWidth = 500
@ -160,7 +161,7 @@ export default {
mounted() {
socket.on('startDownload', this.startDownload)
socket.on('startConversion', this.startConversion)
socket.on('init_downloadQueue', this.initQueue)
// socket.on('init_downloadQueue', this.initQueue)
socket.on('addedToQueue', this.addToQueue)
socket.on('updateQueue', this.updateQueue)
socket.on('removedFromQueue', this.removeFromQueue)
@ -168,6 +169,15 @@ export default {
socket.on('removedAllDownloads', this.removeAllDownloads)
socket.on('removedFinishedDownloads', this.removedFinishedDownloads)
fetchData('getQueue')
// fetch('connect')
// .then(res => res.json())
.then(res => {
console.log(res)
this.initQueue(res)
})
.catch(console.error)
// Check if download tab has slim entries
if ('true' === localStorage.getItem('slimDownloads')) {
this.$refs.list.classList.add('slim')
@ -201,14 +211,19 @@ export default {
},
initQueue(data) {
const {
queue: initQueue,
queueComplete: initQueueComplete,
order: initQueue,
// queueComplete: initQueueComplete,
currentItem,
queueList: initQueueList,
queue: initQueueList,
restored
} = data
console.log({ initQueueList })
if (initQueueComplete.length) {
const initQueueComplete = Object.values(initQueueList).filter(el => el.status === 'completed').map(el => el.uuid)
console.log({initQueueComplete})
if (initQueueComplete && initQueueComplete.length) {
initQueueComplete.forEach(item => {
initQueueList[item].silent = true
this.addToQueue(initQueueList[item])

3556
yarn.lock

File diff suppressed because it is too large Load diff