2022-01-09 12:29:24 -05:00
|
|
|
<template>
|
2022-05-20 07:44:22 -04:00
|
|
|
<modal-dialog :show="show" :title="$t('dialog.update.title')" :ok_action="library.updating ? '' : $t('dialog.update.rescan')" :close_action="$t('dialog.update.cancel')" @ok="update_library" @close="close()">
|
2022-02-19 00:39:14 -05:00
|
|
|
<template #modal-content>
|
2022-01-09 12:29:24 -05:00
|
|
|
<div v-if="!library.updating">
|
2022-05-20 07:44:22 -04:00
|
|
|
<p class="mb-3" v-text="$t('dialog.update.info')" />
|
2022-02-19 00:39:14 -05:00
|
|
|
<div v-if="spotify_enabled || rss.tracks > 0" class="field">
|
2022-01-09 12:29:24 -05:00
|
|
|
<div class="control">
|
|
|
|
<div class="select is-small">
|
|
|
|
<select v-model="update_dialog_scan_kind">
|
2022-05-20 07:44:22 -04:00
|
|
|
<option value="" v-text="$t('dialog.update.all')" />
|
|
|
|
<option value="files" v-text="$t('dialog.update.local')" />
|
|
|
|
<option v-if="spotify_enabled" value="spotify" v-text="$t('dialog.update.spotify')" />
|
|
|
|
<option v-if="rss.tracks > 0" value="rss" v-text="$t('dialog.update.feeds')" />
|
2022-01-09 12:29:24 -05:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<label class="checkbox is-size-7 is-small">
|
2022-05-20 07:44:22 -04:00
|
|
|
<input v-model="rescan_metadata" type="checkbox" style="margin-right: 5px" />
|
|
|
|
<span v-text="$t('dialog.update.rescan-metadata')" />
|
2022-01-09 12:29:24 -05:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-else>
|
2022-05-20 07:44:22 -04:00
|
|
|
<p class="mb-3" v-text="$t('dialog.update.progress')" />
|
2022-01-09 12:29:24 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</modal-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 00:18:01 -05:00
|
|
|
import ModalDialog from '@/components/ModalDialog.vue'
|
2022-01-09 12:29:24 -05:00
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ModalDialogUpdate',
|
|
|
|
components: { ModalDialog },
|
|
|
|
props: ['show'],
|
2022-02-19 01:05:59 -05:00
|
|
|
emits: ['close'],
|
2022-01-09 12:29:24 -05:00
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
data() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return {
|
|
|
|
rescan_metadata: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
library() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.library
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
rss() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.rss_count
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
spotify_enabled() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.spotify.webapi_token_valid
|
|
|
|
},
|
|
|
|
|
|
|
|
update_dialog_scan_kind: {
|
2022-02-19 00:39:14 -05:00
|
|
|
get() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.update_dialog_scan_kind
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
set(value) {
|
2022-01-09 12:29:24 -05:00
|
|
|
this.$store.commit(types.UPDATE_DIALOG_SCAN_KIND, value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-02-19 00:39:14 -05:00
|
|
|
update_library() {
|
2022-01-09 12:29:24 -05:00
|
|
|
if (this.rescan_metadata) {
|
|
|
|
webapi.library_rescan(this.update_dialog_scan_kind)
|
|
|
|
} else {
|
|
|
|
webapi.library_update(this.update_dialog_scan_kind)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
close() {
|
2022-01-09 12:29:24 -05:00
|
|
|
this.update_dialog_scan_kind = ''
|
|
|
|
this.$emit('close')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|