mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-22 11:03:13 +00:00
#507 mediaInfo Queue WIP
This commit is contained in:
parent
5316d6793d
commit
f095ee3938
3 changed files with 127 additions and 25 deletions
|
@ -202,12 +202,27 @@
|
||||||
"Description": "The @:Modules.Download.Name module allows you to download medias, as well as local assets, from servers where you have been granted download rights",
|
"Description": "The @:Modules.Download.Name module allows you to download medias, as well as local assets, from servers where you have been granted download rights",
|
||||||
"SelSrv": "Select Server",
|
"SelSrv": "Select Server",
|
||||||
"TT-Server": "Select the server to download from. If a server can't be selected, you have not been granted download rights from it",
|
"TT-Server": "Select the server to download from. If a server can't be selected, you have not been granted download rights from it",
|
||||||
"MediaInfoTitle": "Media Info",
|
|
||||||
"ShowQueue": "Show Queue",
|
"ShowQueue": "Show Queue",
|
||||||
|
"mediaInfo": {
|
||||||
|
"mediaInfoTitle": "Media Info",
|
||||||
|
"title": "Title",
|
||||||
|
"file": "Source File",
|
||||||
|
"type": "Type",
|
||||||
|
"status": "Status",
|
||||||
|
"serverID": "Source Server Id",
|
||||||
|
"serverName": "Source Server Name",
|
||||||
|
"libName": "Source Library Name",
|
||||||
|
"sourceUri": "Source Uri",
|
||||||
|
"targetDir": "Target Dir",
|
||||||
|
"size": "Size"
|
||||||
|
},
|
||||||
"Queue":{
|
"Queue":{
|
||||||
"Name": "Download Queue",
|
"Name": "Download Queue",
|
||||||
"Description": "Here you see the items in the download queue, as well as start/stop the queue"
|
"Description": "Here you see the items in the download queue, as well as start/stop the queue",
|
||||||
|
"btnStartQueue": "Start Queue",
|
||||||
|
"btnStopQueue": "Stop Queue"
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"ET": {
|
"ET": {
|
||||||
"Description": "@:Modules.ET.Name allows you to export detail information about the media in your libraries",
|
"Description": "@:Modules.ET.Name allows you to export detail information about the media in your libraries",
|
||||||
|
|
|
@ -123,7 +123,7 @@
|
||||||
{ prop: 'Released',searchable: true,sortable: true, width: 30 },
|
{ prop: 'Released',searchable: true,sortable: true, width: 30 },
|
||||||
{ prop: 'Added',searchable: true,sortable: true, width: 30 },
|
{ prop: 'Added',searchable: true,sortable: true, width: 30 },
|
||||||
{ prop: 'Updated',searchable: true,sortable: true, width: 30 },
|
{ prop: 'Updated',searchable: true,sortable: true, width: 30 },
|
||||||
{ prop: 'Type', isHidden: true },
|
{ prop: 'Type', isHidden: true }
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
tableAttribute: {
|
tableAttribute: {
|
||||||
|
@ -141,7 +141,8 @@
|
||||||
{ prop: 'Key', isHidden: true },
|
{ prop: 'Key', isHidden: true },
|
||||||
{ prop: 'File',searchable: false,sortable: false, width: 100 },
|
{ prop: 'File',searchable: false,sortable: false, width: 100 },
|
||||||
{ prop: 'Type',searchable: false,sortable: false, width: 10 },
|
{ prop: 'Type',searchable: false,sortable: false, width: 10 },
|
||||||
{ prop: 'Hash',isHidden: true }
|
{ prop: 'Hash',isHidden: true },
|
||||||
|
{ prop: 'Size', isHidden: true }
|
||||||
],
|
],
|
||||||
MItableData: [],
|
MItableData: [],
|
||||||
MItableAttribute: {
|
MItableAttribute: {
|
||||||
|
@ -192,6 +193,7 @@
|
||||||
details['mediaDir'] = this.selMediaDir;
|
details['mediaDir'] = this.selMediaDir;
|
||||||
details['title'] = this.selMediaTitle;
|
details['title'] = this.selMediaTitle;
|
||||||
details['type'] = row['Type'];
|
details['type'] = row['Type'];
|
||||||
|
details['size'] = row['Size'];
|
||||||
details['hash'] = key;
|
details['hash'] = key;
|
||||||
log.debug(`[Download.vue] (Select) - Adding ${key} with a value of: ${JSON.stringify(details)}`)
|
log.debug(`[Download.vue] (Select) - Adding ${key} with a value of: ${JSON.stringify(details)}`)
|
||||||
arr.push(details)
|
arr.push(details)
|
||||||
|
@ -225,6 +227,7 @@
|
||||||
if ( this.MItableData.map(function(x) {return x.Key; }).indexOf(parts[idx]['key']) == -1){
|
if ( this.MItableData.map(function(x) {return x.Key; }).indexOf(parts[idx]['key']) == -1){
|
||||||
entry['Key'] = parts[idx]['key'];
|
entry['Key'] = parts[idx]['key'];
|
||||||
entry['Type'] = response['data']['MediaContainer']['Metadata'][0]['type'];
|
entry['Type'] = response['data']['MediaContainer']['Metadata'][0]['type'];
|
||||||
|
entry['Size'] = parts[idx]['size'];
|
||||||
for (var x in this.selLibrary['location']){
|
for (var x in this.selLibrary['location']){
|
||||||
if ( parts[idx]['file'].startsWith( this.selLibrary['location'][x]['path'] ) )
|
if ( parts[idx]['file'].startsWith( this.selLibrary['location'][x]['path'] ) )
|
||||||
{
|
{
|
||||||
|
@ -269,7 +272,7 @@
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
await this.getMediaInfo(myarg['Key']);
|
await this.getMediaInfo(myarg['Key']);
|
||||||
this.selMediaTitle = myarg['Title'];
|
this.selMediaTitle = myarg['Title'];
|
||||||
this.mediaInfoTitle = `${i18n.t("Modules.Download.MediaInfoTitle")} - ${myarg['Title']}`
|
this.mediaInfoTitle = `${i18n.t("Modules.Download.mediaInfo.mediaInfoTitle")} - ${myarg['Title']}`
|
||||||
// Stop Spinner
|
// Stop Spinner
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.$refs['MediaInfo'].show();
|
this.$refs['MediaInfo'].show();
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<vue-virtual-table
|
<vue-virtual-table
|
||||||
@click="rowClicked"
|
|
||||||
:key="idx"
|
|
||||||
:config="tableConfig"
|
:config="tableConfig"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:bordered="tableAttribute.bordered"
|
:bordered="tableAttribute.bordered"
|
||||||
|
@ -17,13 +15,35 @@
|
||||||
:language="tableAttribute.language"
|
:language="tableAttribute.language"
|
||||||
:selectable="tableAttribute.selectable"
|
:selectable="tableAttribute.selectable"
|
||||||
:itemHeight="tableAttribute.itemHeight">
|
:itemHeight="tableAttribute.itemHeight">
|
||||||
|
<template slot-scope="scope" slot="actionCommon">
|
||||||
|
<button @click="up(scope.index, scope.row)" :disabled="queueRunning"><i class="fas fa-arrow-up"></i></button>
|
||||||
|
<button @click="down(scope.index, scope.row)" :disabled="queueRunning"><i class="fas fa-arrow-down"></i></button>
|
||||||
|
<button @click="del(scope.index, scope.row)" :disabled="queueRunning"><i class="fas fa-trash"></i></button>
|
||||||
|
<button @click="info(scope.index, scope.row)"><i class="fas fa-info"></i></button>
|
||||||
|
</template>
|
||||||
</vue-virtual-table>
|
</vue-virtual-table>
|
||||||
|
<b-modal size="lg" ref="MediaInfo" hide-footer v-bind:title=this.mediaInfo.mediaInfoTitle>
|
||||||
|
<div>
|
||||||
|
<b-table striped :items="mediaInfoItems"></b-table>
|
||||||
|
</div>
|
||||||
|
</b-modal>
|
||||||
|
<br>
|
||||||
|
<div class="d-flex mx-auto">
|
||||||
|
<div class="buttons d-flex mx-auto"> <!-- Buttons -->
|
||||||
|
<b-button
|
||||||
|
type="is-primary"
|
||||||
|
@click="btnToggleQueue"
|
||||||
|
variant="success"
|
||||||
|
>
|
||||||
|
{{ this.btnQueueLabel }}</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ this.queueRunning }}
|
||||||
</b-container>
|
</b-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//import i18n from '../../../../i18n';
|
import i18n from '../../../../i18n';
|
||||||
//import store from '../../../../store';
|
//import store from '../../../../store';
|
||||||
import { wtconfig } from '../../General/wtutils';
|
import { wtconfig } from '../../General/wtutils';
|
||||||
//import { pms } from '../../General/pms';
|
//import { pms } from '../../General/pms';
|
||||||
|
@ -37,11 +57,18 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableConfig: [
|
tableConfig: [
|
||||||
{ prop: 'Title',searchable: true,sortable: true, width: 80 },
|
{ prop: '_action', name: 'Action', actionName: 'actionCommon', width: 80 },
|
||||||
{ prop: 'File',searchable: true,sortable: true, width: 80 },
|
{ prop: 'title', name: i18n.t('Modules.Download.mediaInfo.title'), searchable: true,sortable: true, width: 80 },
|
||||||
{ prop: 'Type',searchable: true,sortable: true, width: 30 },
|
{ prop: 'file', name: i18n.t('Modules.Download.mediaInfo.file'), searchable: true,sortable: true, width: 80 },
|
||||||
{ prop: 'Status',searchable: true,sortable: true, width: 30 },
|
{ prop: 'type', name: i18n.t('Modules.Download.mediaInfo.type'), searchable: true,sortable: true, width: 30 },
|
||||||
{ prop: 'Hash', isHidden: true }
|
{ prop: 'status', name: i18n.t('Modules.Download.mediaInfo.status'), searchable: true,sortable: true, width: 30 },
|
||||||
|
{ prop: 'hash', isHidden: true },
|
||||||
|
{ prop: 'key', isHidden: true },
|
||||||
|
{ prop: 'serverID', isHidden: true },
|
||||||
|
{ prop: 'serverName', isHidden: true },
|
||||||
|
{ prop: 'libName', isHidden: true },
|
||||||
|
{ prop: 'mediaDir', isHidden: true },
|
||||||
|
{ prop: 'size', isHidden: true }
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
tableAttribute: {
|
tableAttribute: {
|
||||||
|
@ -53,30 +80,87 @@
|
||||||
bordered: true,
|
bordered: true,
|
||||||
hoverHighlight: true,
|
hoverHighlight: true,
|
||||||
language: "en"
|
language: "en"
|
||||||
}
|
},
|
||||||
|
mediaInfo: {
|
||||||
|
mediaInfoTitle: ""
|
||||||
|
},
|
||||||
|
mediaInfoItems: [],
|
||||||
|
queueRunning: null,
|
||||||
|
btnQueueLabel: i18n.t('Modules.Download.Queue.btnStartQueue')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
log.info(`[Queue.vue] (created) - Download Queue Created`);
|
log.info(`[Queue.vue] (created) - Download Queue Created`);
|
||||||
this.GetQueue();
|
this.GetQueue();
|
||||||
|
this.setCreatedStatus();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
up( index ){
|
||||||
|
if ( index > 0 ){
|
||||||
|
// Move one up
|
||||||
|
this.tableData.splice(index - 1, 0, this.tableData.splice(index, 1)[0]);
|
||||||
|
// Save to json
|
||||||
|
wtconfig.set('Download.Queue', this.tableData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
down( index ){
|
||||||
|
if ( index < this.tableData.length){
|
||||||
|
// Move one down
|
||||||
|
this.tableData.splice(index + 1, 0, this.tableData.splice(index, 1)[0]);
|
||||||
|
// Save to json
|
||||||
|
wtconfig.set('Download.Queue', this.tableData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setCreatedStatus(){
|
||||||
|
this.queueRunning = wtconfig.get( 'Download.Status', false);
|
||||||
|
},
|
||||||
|
btnToggleQueue(){
|
||||||
|
if ( this.queueRunning ){
|
||||||
|
this.stopQueue();
|
||||||
|
this.btnQueueLabel = i18n.t('Modules.Download.Queue.btnStartQueue');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.startQueue();
|
||||||
|
this.btnQueueLabel = i18n.t('Modules.Download.Queue.btnStopQueue');
|
||||||
|
}
|
||||||
|
wtconfig.set('Download.Status', this.queueRunning);
|
||||||
|
},
|
||||||
|
stopQueue(){
|
||||||
|
this.queueRunning = false;
|
||||||
|
console.log('Ged 43-3 Queue stopped')
|
||||||
|
},
|
||||||
|
startQueue(){
|
||||||
|
this.queueRunning = true;
|
||||||
|
console.log('Ged 44-3 Queue started')
|
||||||
|
|
||||||
|
},
|
||||||
|
info(index, row){
|
||||||
|
this.mediaInfo.mediaInfoTitle = `${i18n.t("Modules.Download.mediaInfo.mediaInfoTitle")}: ${row['title']} - ${row['type']}`
|
||||||
|
this.mediaInfoItems = [];
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.title") }: ${row['title']}` });
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.file") } : ${row['file']}` });
|
||||||
|
if ( row['size'] ){
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.size") } : ${row['size']}` });
|
||||||
|
}
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.serverID") } : ${row['serverID']}` });
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.serverName") } : ${row['serverName']}` });
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.libName") } : ${row['libName']}` });
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.sourceUri") } : ${row['key']}` });
|
||||||
|
this.mediaInfoItems.push({ " ": `${ i18n.t("Modules.Download.mediaInfo.targetDir") } : ${row['mediaDir']}` });
|
||||||
|
this.$refs['MediaInfo'].show();
|
||||||
|
},
|
||||||
|
del(index, row){
|
||||||
|
log.info(`[Queue.vue] (del) - Delete index: ${index} with contents: ${ JSON.stringify(row) }`);
|
||||||
|
this.tableData.splice(index, 1);
|
||||||
|
wtconfig.set('Download.Queue', this.tableData);
|
||||||
|
},
|
||||||
GetQueue(){
|
GetQueue(){
|
||||||
log.info(`[Queue.vue] (GetQueue) - Get the queue`);
|
log.info(`[Queue.vue] (GetQueue) - Get the queue`);
|
||||||
const arrQueue = wtconfig.get('Download.Queue');
|
this.tableData = wtconfig.get('Download.Queue');
|
||||||
for (var qItem in arrQueue){
|
|
||||||
let entry = {};
|
|
||||||
entry['Title'] = arrQueue[qItem]['title'];
|
|
||||||
entry['File'] = arrQueue[qItem]['file'];
|
|
||||||
entry['Type'] = arrQueue[qItem]['type'];
|
|
||||||
entry['Status'] = 'GED Idle';
|
|
||||||
entry['Hash'] = arrQueue[qItem];
|
|
||||||
this.tableData.push(entry); //Add qItem
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue