2
0
Fork 0
mirror of https://github.com/WebTools-NG/WebTools-NG synced 2025-03-09 00:37:20 +00:00

starting to get there

This commit is contained in:
UKDTOM 2020-10-11 23:18:36 +02:00
parent 2a50bd88de
commit 106e8b5fe7
5 changed files with 178 additions and 24 deletions
package-lock.jsonpackage.json
public/locales
src/components/modules/ExportTools
Custom
scripts

16
package-lock.json generated
View file

@ -6157,8 +6157,7 @@
},
"bl": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz",
"integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==",
"resolved": "",
"requires": {
"buffer": "^5.5.0",
"inherits": "^2.0.4",
@ -12295,6 +12294,11 @@
"is-plain-obj": "^1.0.0"
}
},
"sortablejs": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.12.0.tgz",
"integrity": "sha512-bPn57rCjBRlt2sC24RBsu40wZsmLkSo2XeqG8k6DC1zru5eObQUIPPZAQG7W2SJ8FZQYq+BEJmvuw1Zxb3chqg=="
},
"source-list-map": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
@ -14321,6 +14325,14 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vuedraggable": {
"version": "2.24.1",
"resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.24.1.tgz",
"integrity": "sha512-G1fxO1oshx+WLdieSGl6jSJdlHOQFga1FpjuUpgXldbpKNzxpjsGn4xYNnRHVrOAqm8aG5FfpdQlh5LHesxCeA==",
"requires": {
"sortablejs": "^1.10.1"
}
},
"vuex": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.5.1.tgz",

View file

@ -1,7 +1,6 @@
{
"name": "webtools-ng",
"version": "0.1.6",
"description": "WebTools Next Generation 4 Plex",
"author": "dane22 & CPSO",
"license": "MPL-2.0",
@ -45,6 +44,7 @@
"vue-i18n": "^8.18.2",
"vue-router": "^3.3.4",
"vue-sidebar-menu": "^4.6.2",
"vuedraggable": "^2.24.1",
"vuex": "^3.5.1",
"vuex-persist": "^2.2.0"
},

View file

@ -119,7 +119,9 @@
"NewLevelTitle": "Enter name for the new level",
"NewLevelName": "< Enter name for new level >",
"NewLevelSaveTxt": "Save",
"CustomLevel": "Custom Level"
"CustomLevel": "Custom Level",
"btnDelete": "Delete level",
"btnSave": "Save level"
},
"Description": "@:Modules.ET.Name allows you to export detail information about the media in your libraries",
"Name": "ExportTools",

View file

@ -43,8 +43,26 @@
<b-button class="mt-3" variant="outline-primary" block @click="addNewLevel">{{ this.NewLevelSaveTxt }}</b-button>
</b-modal>
</b-container>
<!-- Buttons -->
<div class="text-center">
<b-button-group >
<b-button display: variant="success" class="mr-1"> {{ $t('Modules.ET.Custom.btnSave') }} </b-button>
<b-button display: variant="danger" class="mr-1">{{ $t('Modules.ET.Custom.btnDelete') }}</b-button>
</b-button-group>
</div>
<div class="col-md-3">
<draggable class="list-group" tag="ul" v-model="fieldList" v-bind="dragOptions" :move="onMove" @start="isDragging=true" @end="isDragging=false">
<transition-group type="transition" :name="'flip-list'">
<li class="list-group-item" v-for="element in fieldList" :key="element.order">
<i :class="element.fixed? 'fa fa-anchor' : 'glyphicon glyphicon-pushpin'" @click=" element.fixed=! element.fixed" aria-hidden="true"></i>
{{element.name}}
<!-- <span class="badge">{{element.order}}</span> -->
</li>
</transition-group>
</draggable>
</div>
</b-container>
</template>
<script>
@ -52,13 +70,18 @@
import i18n from '../../../../i18n';
import store from '../../../../store';
import { wtconfig } from '../../General/wtutils';
import draggable from 'vuedraggable'
const log = require("electron-log");
log, et, i18n, store, wtconfig
log, i18n, store, wtconfig
export default {
data() {
components: {
draggable,
},
data() {
return {
selMediaType: "movie",
optionsMediaType: [
@ -68,24 +91,61 @@
{ text: i18n.t('Modules.ET.RadioTVShowEpisodes'), value: 'showepisode', disabled: true },
{ text: i18n.t('Modules.ET.RadioMusic'), value: 'artist', disabled: true },
{ text: i18n.t('Modules.ET.RadioPhotos'), value: 'photo', disabled: true },
{ text: i18n.t('Modules.ET.RadioPlayLists'), value: 'playlist', disabled: true }
{ text: i18n.t('Modules.ET.RadioPlayLists'), value: 'playlist', disabled: true }
],
selLevel: "",
customTitle: this.$t('Modules.ET.Custom.NewLevelTitle'),
NewLevelInputTxt: this.$t('Modules.ET.Custom.NewLevelName'),
NewLevelSaveTxt: this.$t('Modules.ET.Custom.NewLevelSaveTxt'),
NewLevelName: '',
optionsLevels: [
{'Gummi Ny' : "NewLevel"}
]
NewLevelName: '',
editable: true,
isDragging: false,
delayedDragging: false,
fieldList: []
}
},
mounted() {
// Populate combobox
this.genExportLevels();
},
methods: {
},
watch: {
isDragging(newValue) {
if (newValue) {
this.delayedDragging = true;
return;
}
this.$nextTick(() => {
this.delayedDragging = false;
});
}
},
computed: {
dragOptions() {
return {
animation: 0,
group: "description",
disabled: !this.editable,
ghostClass: "ghost"
};
},
listString() {
return JSON.stringify(this.list, null, 2);
}
},
mounted() {
// Populate combobox
this.genExportLevels();
},
methods: {
orderList() {
this.list = this.list.sort((one, two) => {
return one.order - two.order;
});
},
onMove({ relatedContext, draggedContext }) {
const relatedElement = relatedContext.element;
const draggedElement = draggedContext.element;
return (
(!relatedElement || !relatedElement.fixed) && !draggedElement.fixed
);
},
genExportLevels() {
et.getLevelDisplayName('My Level', this.selMediaType);
// Returns valid levels for selected media type
@ -113,7 +173,8 @@
options.push(option);
});
item['options']=options;
this.optionsLevels = options;
this.optionsLevels = options;
this.fieldList = et.getAllFields( {libType: this.selMediaType});
},
addNewLevel(){
// Hide Modal box
@ -152,4 +213,49 @@
}
}
};
</script>
</script>
<style scoped>
.flip-list-move {
transition: transform 0.5s;
}
ul {
display: flex;
flex-direction: column;
padding: 3px !important;
min-height: 70vh;
width: 200px;
height: 300px;
float:left;
list-style-type:none;
overflow-y:auto;
border:2px solid #888;
border-radius:0.2em;
background:#8adccc;
color:#555;
margin-right: 5px;
}
.no-move {
transition: transform 0s;
}
.ghost {
opacity: 0.5;
background: #c8ebfb;
}
.list-group {
min-height: 20px;
}
.list-group-item {
cursor: move;
}
.list-group-item i {
cursor: pointer;
}
#buttons {
width: 200px;
margin-top: 5px;
margin-bottom: 5px;
}
</style>

View file

@ -1,5 +1,3 @@
/* eslint-disable no-unreachable */
//var def = JSON.parse(JSON.stringify(require('./definitions.json')));
var def;
var defLevels = JSON.parse(JSON.stringify(require('./../defs/def-Levels.json')));
@ -305,6 +303,42 @@ const et = new class ET {
return out
}
// Return all field keys defined for a lib type, in a sorted array of json, with an index
getAllFields( {libType}) {
// We need to load fields and defs into typeFields var
let typeFields;
switch(libType) {
case 'movie':
// code block
typeFields = JSON.parse(JSON.stringify(require('./../defs/def-Movie.json')));
break;
case 'episode':
// code block
typeFields = JSON.parse(JSON.stringify(require('./../defs/def-Episode.json')));
break;
case 'show':
// code block
typeFields = JSON.parse(JSON.stringify(require('./../defs/def-Show.json')));
break;
case 'artist':
// code block
typeFields = JSON.parse(JSON.stringify(require('./../defs/def-Artist.json')));
break;
case 'photo':
// code block
typeFields = JSON.parse(JSON.stringify(require('./../defs/def-Photo.json')));
break;
default:
// code block
}
// Get all the fields keys
var filteredFields = JSONPath({path: '$.' + libType + '.fields.*~', json: typeFields});
// Sort them, and add an index as well, so drageble is happy
return filteredFields.sort().map((name, index) => {
return { name, order: index + 1, fixed: false };
});
}
getFields( libType, level) {
// Get field and type for level
const fields = et.getLevelFields(level, libType)