[web] Remove unnecessary word option

This commit is contained in:
Alain Nussbaumer 2024-04-25 22:36:04 +02:00
parent 30fc35097c
commit 73040780b9
10 changed files with 46 additions and 78 deletions

View File

@ -94,7 +94,7 @@ export default {
return this.media_kind || this.selected_item.media_kind return this.media_kind || this.selected_item.media_kind
}, },
show_artwork() { show_artwork() {
return this.$store.getters.settings_option( return this.$store.getters.setting(
'webinterface', 'webinterface',
'show_cover_artwork_in_album_lists' 'show_cover_artwork_in_album_lists'
).value ).value

View File

@ -53,7 +53,7 @@ export default {
computed: { computed: {
show_artwork() { show_artwork() {
return this.$store.getters.settings_option( return this.$store.getters.setting(
'webinterface', 'webinterface',
'show_cover_artwork_in_album_lists' 'show_cover_artwork_in_album_lists'
).value ).value

View File

@ -138,7 +138,7 @@ export default {
} }
}, },
show_audiobooks() { show_audiobooks() {
return this.$store.getters.settings_option( return this.$store.getters.setting(
'webinterface', 'webinterface',
'show_menu_item_audiobooks' 'show_menu_item_audiobooks'
).value ).value
@ -152,40 +152,34 @@ export default {
} }
}, },
show_files() { show_files() {
return this.$store.getters.settings_option( return this.$store.getters.setting('webinterface', 'show_menu_item_files')
'webinterface', .value
'show_menu_item_files'
).value
}, },
show_music() { show_music() {
return this.$store.getters.settings_option( return this.$store.getters.setting('webinterface', 'show_menu_item_music')
'webinterface', .value
'show_menu_item_music'
).value
}, },
show_player_menu() { show_player_menu() {
return this.$store.state.show_player_menu return this.$store.state.show_player_menu
}, },
show_playlists() { show_playlists() {
return this.$store.getters.settings_option( return this.$store.getters.setting(
'webinterface', 'webinterface',
'show_menu_item_playlists' 'show_menu_item_playlists'
).value ).value
}, },
show_podcasts() { show_podcasts() {
return this.$store.getters.settings_option( return this.$store.getters.setting(
'webinterface', 'webinterface',
'show_menu_item_podcasts' 'show_menu_item_podcasts'
).value ).value
}, },
show_radio() { show_radio() {
return this.$store.getters.settings_option( return this.$store.getters.setting('webinterface', 'show_menu_item_radio')
'webinterface', .value
'show_menu_item_radio'
).value
}, },
show_search() { show_search() {
return this.$store.getters.settings_option( return this.$store.getters.setting(
'webinterface', 'webinterface',
'show_menu_item_search' 'show_menu_item_search'
).value ).value

View File

@ -55,7 +55,7 @@ export default {
return this.statusUpdate === 'success' return this.statusUpdate === 'success'
}, },
option() { option() {
const option = this.$store.getters.settings_option( const option = this.$store.getters.setting(
this.category_name, this.category_name,
this.option_name this.option_name
) )
@ -87,7 +87,7 @@ export default {
webapi webapi
.settings_update(this.category_name, option) .settings_update(this.category_name, option)
.then(() => { .then(() => {
this.$store.dispatch('update_settings_option', option) this.$store.dispatch('update_setting', option)
this.statusUpdate = 'success' this.statusUpdate = 'success'
}) })
.catch(() => { .catch(() => {

View File

@ -16,7 +16,7 @@
inputmode="numeric" inputmode="numeric"
min="0" min="0"
:placeholder="placeholder" :placeholder="placeholder"
:value="value" :value="option.value"
@input="set_update_timer" @input="set_update_timer"
/> />
</div> </div>
@ -48,11 +48,6 @@ export default {
}, },
computed: { computed: {
category() {
return this.$store.state.settings.categories.find(
(elem) => elem.name === this.category_name
)
},
info() { info() {
if (this.statusUpdate === 'success') { if (this.statusUpdate === 'success') {
return this.$t('setting.saved') return this.$t('setting.saved')
@ -68,15 +63,7 @@ export default {
return this.statusUpdate === 'success' return this.statusUpdate === 'success'
}, },
option() { option() {
if (!this.category) { return this.$store.getters.setting(this.category_name, this.option_name)
return {}
}
return this.category.options.find(
(elem) => elem.name === this.option_name
)
},
value() {
return this.option.value
} }
}, },
@ -101,14 +88,14 @@ export default {
return return
} }
const option = { const option = {
category: this.category.name, category: this.category_name,
name: this.option_name, name: this.option_name,
value: newValue value: newValue
} }
webapi webapi
.settings_update(this.category.name, option) .settings_update(this.category_name, option)
.then(() => { .then(() => {
this.$store.dispatch('update_settings_option', option) this.$store.dispatch('update_setting', option)
this.statusUpdate = 'success' this.statusUpdate = 'success'
}) })
.catch(() => { .catch(() => {

View File

@ -15,7 +15,7 @@
class="input" class="input"
type="text" type="text"
:placeholder="placeholder" :placeholder="placeholder"
:value="value" :value="option.value"
@input="set_update_timer" @input="set_update_timer"
/> />
</div> </div>
@ -47,11 +47,6 @@ export default {
}, },
computed: { computed: {
category() {
return this.$store.state.settings.categories.find(
(elem) => elem.name === this.category_name
)
},
info() { info() {
if (this.statusUpdate === 'success') { if (this.statusUpdate === 'success') {
return this.$t('setting.saved') return this.$t('setting.saved')
@ -67,15 +62,7 @@ export default {
return this.statusUpdate === 'success' return this.statusUpdate === 'success'
}, },
option() { option() {
if (!this.category) { return this.$store.getters.setting(this.category_name, this.option_name)
return {}
}
return this.category.options.find(
(elem) => elem.name === this.option_name
)
},
value() {
return this.option.value
} }
}, },
@ -102,14 +89,14 @@ export default {
return return
} }
const option = { const option = {
category: this.category.name, category: this.category_name,
name: this.option_name, name: this.option_name,
value: newValue value: newValue
} }
webapi webapi
.settings_update(this.category.name, option) .settings_update(this.category_name, option)
.then(() => { .then(() => {
this.$store.dispatch('update_settings_option', option) this.$store.dispatch('update_setting', option)
this.statusUpdate = 'success' this.statusUpdate = 'success'
}) })
.catch(() => { .catch(() => {

View File

@ -22,7 +22,7 @@ import webapi from '@/webapi'
const dataObject = { const dataObject = {
load(to) { load(to) {
const limit = store.getters.settings_option_recently_added_limit const limit = store.getters.setting_recently_added_limit
return webapi.search({ return webapi.search({
expression: expression:
'media_kind is music having track_count > 3 order by time_added desc', 'media_kind is music having track_count > 3 order by time_added desc',

View File

@ -87,11 +87,11 @@ export default {
computed: { computed: {
composer() { composer() {
if (this.settings_option_show_composer_now_playing) { if (this.setting_show_composer_now_playing) {
if ( if (
!this.settings_option_show_composer_for_genre || !this.setting_show_composer_for_genre ||
(this.track.genre && (this.track.genre &&
this.settings_option_show_composer_for_genre this.setting_show_composer_for_genre
.toLowerCase() .toLowerCase()
.split(',') .split(',')
.findIndex( .findIndex(
@ -105,7 +105,7 @@ export default {
return null return null
}, },
filepath() { filepath() {
if (this.settings_option_show_filepath_now_playing) { if (this.setting_show_filepath_now_playing) {
return this.track.path return this.track.path
} }
return null return null
@ -119,14 +119,14 @@ export default {
player() { player() {
return this.$store.state.player return this.$store.state.player
}, },
settings_option_show_composer_for_genre() { setting_show_composer_for_genre() {
return this.$store.getters.settings_option_show_composer_for_genre return this.$store.getters.setting_show_composer_for_genre
}, },
settings_option_show_composer_now_playing() { setting_show_composer_now_playing() {
return this.$store.getters.settings_option_show_composer_now_playing return this.$store.getters.setting_show_composer_now_playing
}, },
settings_option_show_filepath_now_playing() { setting_show_filepath_now_playing() {
return this.$store.getters.settings_option_show_filepath_now_playing return this.$store.getters.setting_show_filepath_now_playing
}, },
track() { track() {
return this.$store.getters.now_playing return this.$store.getters.now_playing

View File

@ -123,7 +123,7 @@
<settings-textfield <settings-textfield
category_name="webinterface" category_name="webinterface"
option_name="show_composer_for_genre" option_name="show_composer_for_genre"
:disabled="!settings_option_show_composer_now_playing" :disabled="!setting_show_composer_now_playing"
:placeholder="$t('page.settings.general.genres')" :placeholder="$t('page.settings.general.genres')"
> >
<template #label> <template #label>
@ -225,11 +225,11 @@ export default {
})) }))
} }
}, },
settings_option_show_composer_now_playing() { setting_show_composer_now_playing() {
return this.$store.getters.settings_option_show_composer_now_playing return this.$store.getters.setting_show_composer_now_playing
}, },
settings_option_show_filepath_now_playing() { setting_show_filepath_now_playing() {
return this.$store.getters.settings_option_show_filepath_now_playing return this.$store.getters.setting_show_filepath_now_playing
} }
} }
} }

View File

@ -71,23 +71,23 @@ export default createStore({
getters: { getters: {
now_playing: (state) => now_playing: (state) =>
state.queue.items.find((e) => e.id === state.player.item_id) ?? {}, state.queue.items.find((e) => e.id === state.player.item_id) ?? {},
settings_option: (state) => (categoryName, optionName) => setting: (state) => (categoryName, optionName) =>
state.settings.categories state.settings.categories
.find((category) => category.name === categoryName) .find((category) => category.name === categoryName)
?.options.find((option) => option.name === optionName) ?? {}, ?.options.find((option) => option.name === optionName) ?? {},
settings_option_recently_added_limit: (state, getters) => setting_recently_added_limit: (state, getters) =>
getters.settings_webinterface?.options.find( getters.settings_webinterface?.options.find(
(option) => option.name === 'recently_added_limit' (option) => option.name === 'recently_added_limit'
)?.value ?? 100, )?.value ?? 100,
settings_option_show_composer_for_genre: (state, getters) => setting_show_composer_for_genre: (state, getters) =>
getters.settings_webinterface?.options.find( getters.settings_webinterface?.options.find(
(option) => option.name === 'show_composer_for_genre' (option) => option.name === 'show_composer_for_genre'
)?.value ?? null, )?.value ?? null,
settings_option_show_composer_now_playing: (state, getters) => setting_show_composer_now_playing: (state, getters) =>
getters.settings_webinterface?.options.find( getters.settings_webinterface?.options.find(
(option) => option.name === 'show_composer_now_playing' (option) => option.name === 'show_composer_now_playing'
)?.value ?? false, )?.value ?? false,
settings_option_show_filepath_now_playing: (state, getters) => setting_show_filepath_now_playing: (state, getters) =>
getters.settings_webinterface?.options.find( getters.settings_webinterface?.options.find(
(option) => option.name === 'show_filepath_now_playing' (option) => option.name === 'show_filepath_now_playing'
)?.value ?? false, )?.value ?? false,
@ -225,7 +225,7 @@ export default createStore({
state.recent_searches.splice(index, 1) state.recent_searches.splice(index, 1)
} }
}, },
update_settings_option({ state }, option) { update_setting({ state }, option) {
const settingCategory = state.settings.categories.find( const settingCategory = state.settings.categories.find(
(e) => e.name === option.category (e) => e.name === option.category
), ),