Add:Metadata provider option to library

This commit is contained in:
advplyr 2022-02-15 14:59:46 -06:00
parent c046f9ee98
commit de32698ea5
3 changed files with 19 additions and 2 deletions

View File

@ -6,7 +6,14 @@
</div> </div>
<div v-if="!showDirectoryPicker" class="w-full h-full py-4"> <div v-if="!showDirectoryPicker" class="w-full h-full py-4">
<div class="flex flex-wrap -mx-1">
<div class="w-full md:w-2/3 px-1">
<ui-text-input-with-label v-model="name" label="Library Name" /> <ui-text-input-with-label v-model="name" label="Library Name" />
</div>
<div class="w-full md:w-1/3 px-1">
<ui-dropdown v-model="provider" :items="providers" label="Metadata Provider" small />
</div>
</div>
<div class="w-full py-4"> <div class="w-full py-4">
<p class="px-1 text-sm font-semibold">Folders</p> <p class="px-1 text-sm font-semibold">Folders</p>
@ -42,6 +49,7 @@ export default {
data() { data() {
return { return {
name: '', name: '',
provider: '',
folders: [], folders: [],
showDirectoryPicker: false showDirectoryPicker: false
} }
@ -62,6 +70,9 @@ export default {
var origfolderpaths = this.library.folders.map((f) => f.fullPath).join(',') var origfolderpaths = this.library.folders.map((f) => f.fullPath).join(',')
return newfolderpaths === origfolderpaths && this.name === this.library.name return newfolderpaths === origfolderpaths && this.name === this.library.name
},
providers() {
return this.$store.state.scanners.providers
} }
}, },
methods: { methods: {
@ -75,6 +86,7 @@ export default {
}, },
init() { init() {
this.name = this.library ? this.library.name : '' this.name = this.library ? this.library.name : ''
this.provider = this.library ? this.library.provider : ''
this.folders = this.library ? this.library.folders.map((p) => ({ ...p })) : [] this.folders = this.library ? this.library.folders.map((p) => ({ ...p })) : []
this.showDirectoryPicker = false this.showDirectoryPicker = false
}, },
@ -100,6 +112,7 @@ export default {
} }
var newLibraryPayload = { var newLibraryPayload = {
name: this.name, name: this.name,
provider: this.provider,
folders: this.folders folders: this.folders
} }
@ -132,6 +145,7 @@ export default {
} }
var newLibraryPayload = { var newLibraryPayload = {
name: this.name, name: this.name,
provider: this.provider,
folders: this.folders folders: this.folders
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="relative w-full" v-click-outside="clickOutsideObj"> <div class="relative w-full" v-click-outside="clickOutsideObj">
<p class="text-sm font-semibold">{{ label }}</p> <p class="text-sm font-semibold">{{ label }}</p>
<button type="button" :disabled="disabled" class="relative w-full border border-gray-500 rounded shadow-sm pl-3 pr-8 py-2 text-left focus:outline-none sm:text-sm cursor-pointer bg-primary" :class="small ? 'h-9' : 'h-10'" aria-haspopup="listbox" aria-expanded="true" @click.stop.prevent="clickShowMenu"> <button type="button" :disabled="disabled" class="relative w-full border border-gray-600 rounded shadow-sm pl-3 pr-8 py-2 text-left focus:outline-none sm:text-sm cursor-pointer bg-primary" :class="small ? 'h-9' : 'h-10'" aria-haspopup="listbox" aria-expanded="true" @click.stop.prevent="clickShowMenu">
<span class="flex items-center"> <span class="flex items-center">
<span class="block truncate" :class="small ? 'text-sm' : ''">{{ selectedText }}</span> <span class="block truncate" :class="small ? 'text-sm' : ''">{{ selectedText }}</span>
</span> </span>

View File

@ -8,6 +8,7 @@ class Library {
this.folders = [] this.folders = []
this.displayOrder = 1 this.displayOrder = 1
this.icon = 'database' this.icon = 'database'
this.provider = 'google'
this.lastScan = 0 this.lastScan = 0
@ -29,6 +30,7 @@ class Library {
this.folders = (library.folders || []).map(f => new Folder(f)) this.folders = (library.folders || []).map(f => new Folder(f))
this.displayOrder = library.displayOrder || 1 this.displayOrder = library.displayOrder || 1
this.icon = library.icon || 'database' this.icon = library.icon || 'database'
this.provider = library.provider || 'google'
this.createdAt = library.createdAt this.createdAt = library.createdAt
this.lastUpdate = library.lastUpdate this.lastUpdate = library.lastUpdate
@ -41,6 +43,7 @@ class Library {
folders: (this.folders || []).map(f => f.toJSON()), folders: (this.folders || []).map(f => f.toJSON()),
displayOrder: this.displayOrder, displayOrder: this.displayOrder,
icon: this.icon, icon: this.icon,
provider: this.provider,
createdAt: this.createdAt, createdAt: this.createdAt,
lastUpdate: this.lastUpdate lastUpdate: this.lastUpdate
} }