mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-07 04:42:58 -05:00
[web-src] Add option to only update a single library source
This commit is contained in:
95
web-src/src/components/ModalDialogUpdate.vue
Normal file
95
web-src/src/components/ModalDialogUpdate.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<modal-dialog
|
||||
:show="show"
|
||||
title="Update library"
|
||||
:ok_action="library.updating ? '' : 'Rescan'"
|
||||
close_action="Close"
|
||||
@ok="update_library"
|
||||
@close="close()">
|
||||
<template slot="modal-content">
|
||||
<div v-if="!library.updating">
|
||||
<p class="mb-3">Scan for new, deleted and modified files</p>
|
||||
<div class="field" v-if="spotify_enabled || rss.tracks > 0">
|
||||
<div class="control">
|
||||
<div class="select is-small">
|
||||
<select v-model="update_dialog_scan_kind">
|
||||
<option value="">Update everything</option>
|
||||
<option value="files">Only update local library</option>
|
||||
<option value="spotify" v-if="spotify_enabled">Only update Spotify</option>
|
||||
<option value="rss" v-if="rss.tracks > 0">Only update RSS feeds</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox is-size-7 is-small">
|
||||
<input type="checkbox" v-model="rescan_metadata">
|
||||
Rescan metadata for unmodified files
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p class="mb-3">Library update in progress ...</p>
|
||||
</div>
|
||||
</template>
|
||||
</modal-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ModalDialog from '@/components/ModalDialog'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import webapi from '@/webapi'
|
||||
|
||||
export default {
|
||||
name: 'ModalDialogUpdate',
|
||||
components: { ModalDialog },
|
||||
props: ['show'],
|
||||
|
||||
data () {
|
||||
return {
|
||||
rescan_metadata: false
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
library () {
|
||||
return this.$store.state.library
|
||||
},
|
||||
|
||||
rss () {
|
||||
return this.$store.state.rss_count
|
||||
},
|
||||
|
||||
spotify_enabled () {
|
||||
return this.$store.state.spotify.webapi_token_valid
|
||||
},
|
||||
|
||||
update_dialog_scan_kind: {
|
||||
get () {
|
||||
return this.$store.state.update_dialog_scan_kind
|
||||
},
|
||||
set (value) {
|
||||
this.$store.commit(types.UPDATE_DIALOG_SCAN_KIND, value)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
update_library () {
|
||||
if (this.rescan_metadata) {
|
||||
webapi.library_rescan(this.update_dialog_scan_kind)
|
||||
} else {
|
||||
webapi.library_update(this.update_dialog_scan_kind)
|
||||
}
|
||||
},
|
||||
|
||||
close () {
|
||||
this.update_dialog_scan_kind = ''
|
||||
this.$emit('close')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -61,7 +61,7 @@
|
||||
<hr class="fd-navbar-divider">
|
||||
|
||||
<navbar-item-link to="/settings/webinterface">Settings</navbar-item-link>
|
||||
<a class="navbar-item" @click.stop.prevent="show_update_library = true; show_settings_menu = false; show_burger_menu = false">
|
||||
<a class="navbar-item" @click.stop.prevent="show_update_dialog = true; show_settings_menu = false; show_burger_menu = false">
|
||||
Update Library
|
||||
</a>
|
||||
<navbar-item-link to="/about">About</navbar-item-link>
|
||||
@@ -72,29 +72,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<modal-dialog
|
||||
:show="show_update_library"
|
||||
title="Update library"
|
||||
:ok_action="library.updating ? '' : 'Rescan'"
|
||||
close_action="Close"
|
||||
@ok="update_library"
|
||||
@close="show_update_library = false">
|
||||
<template slot="modal-content">
|
||||
<div v-if="!library.updating">
|
||||
<p class="mb-3">Scan for new, deleted and modified files</p>
|
||||
<div class="field">
|
||||
<label class="checkbox is-size-7 is-small">
|
||||
<input type="checkbox" v-model="rescan_metadata">
|
||||
Rescan metadata for unmodified files
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p class="mb-3">Library update in progress ...</p>
|
||||
</div>
|
||||
</template>
|
||||
</modal-dialog>
|
||||
|
||||
<div class="is-overlay" v-show="show_settings_menu"
|
||||
style="z-index:10; width: 100vw; height:100vh;"
|
||||
@click="show_settings_menu = false"></div>
|
||||
@@ -103,19 +80,15 @@
|
||||
|
||||
<script>
|
||||
import NavbarItemLink from './NavbarItemLink'
|
||||
import ModalDialog from '@/components/ModalDialog'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import webapi from '@/webapi'
|
||||
|
||||
export default {
|
||||
name: 'NavbarTop',
|
||||
components: { NavbarItemLink, ModalDialog },
|
||||
components: { NavbarItemLink },
|
||||
|
||||
data () {
|
||||
return {
|
||||
show_settings_menu: false,
|
||||
show_update_library: false,
|
||||
rescan_metadata: false
|
||||
show_settings_menu: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -179,6 +152,15 @@ export default {
|
||||
return this.$store.state.show_player_menu
|
||||
},
|
||||
|
||||
show_update_dialog: {
|
||||
get () {
|
||||
return this.$store.state.show_update_dialog
|
||||
},
|
||||
set (value) {
|
||||
this.$store.commit(types.SHOW_UPDATE_DIALOG, value)
|
||||
}
|
||||
},
|
||||
|
||||
zindex () {
|
||||
if (this.show_player_menu) {
|
||||
return 'z-index: 20'
|
||||
@@ -190,14 +172,6 @@ export default {
|
||||
methods: {
|
||||
on_click_outside_settings () {
|
||||
this.show_settings_menu = !this.show_settings_menu
|
||||
},
|
||||
|
||||
update_library () {
|
||||
if (this.rescan_metadata) {
|
||||
webapi.library_rescan()
|
||||
} else {
|
||||
webapi.library_update()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user