Commit cc0310b8 authored by Mathieu Delestre's avatar Mathieu Delestre

kara in queue can be removed one by one

=> just a click on the red clock icon
parent 3af3c514
......@@ -49,7 +49,7 @@ export async function getDownloadQueue() {
}
}
// DELETE karas download queue
// DELETE all karas download queue
export async function deleteDownloadQueue() {
try {
const res = await axios.delete('/api/system/downloads');
......@@ -60,6 +60,17 @@ export async function deleteDownloadQueue() {
}
}
// DELETE s pecific karas download queue
export async function deleteKAraFromDownloadQueue(kid) {
try {
const res = await axios.delete('/api/system/downloads/'+kid);
return res.data;
} catch (e) {
console.log('Error from /api/local.js:deleteKAraFromDownloadQueue');
throw e;
}
}
// POST (add) items to download queue
export async function postToDownloadQueue(repo = 'kara.moe', downloads) {
try {
......
......@@ -4,7 +4,7 @@ import {connect} from 'react-redux';
import {Row, Col, Icon, Layout, Table, Input, Button} from 'antd';
import {loading, errorMessage, warnMessage} from '../../actions/navigation';
import openSocket from 'socket.io-client';
import { getLocalKaras, deleteDownloadQueue, postToDownloadQueue, putToDownloadQueueStart, putToDownloadQueuePause } from '../../api/local';
import { getLocalKaras, deleteDownloadQueue, deleteKAraFromDownloadQueue, postToDownloadQueue, putToDownloadQueueStart, putToDownloadQueuePause } from '../../api/local';
class KaraDownload extends Component {
......@@ -254,7 +254,7 @@ class KaraDownload extends Component {
if(queue.status==='DL_RUNNING')
button = <span><button disabled type="button"><Icon type="sync" spin /></button> {this.state.active_download ? this.state.active_download.progress:null}%</span>;
else if(queue.status==='DL_PLANNED')
button = <button disabled type="button"><Icon type='clock-circle' theme="twoTone" twoToneColor="#dc4e41"/></button>;
button = <button onClick={deleteKAraFromDownloadQueue.bind(null,queue.pk_uuid)} type="button"><Icon type='clock-circle' theme="twoTone" twoToneColor="#dc4e41"/></button>;
else if(queue.status==='DL_DONE') // done but not in local -> try again dude
button = <span><button disabled type="button"><Icon type='check-circle' theme="twoTone" twoToneColor="#4989f3"/></button></span>;
} else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment