mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
2 lines
9.4 KiB
JavaScript
2 lines
9.4 KiB
JavaScript
import{C as I}from"./ContentWithHeading.js";import{C as T}from"./ControlDropdown.js";import{S}from"./SettingsCheckbox.js";import{_ as m,e as w,a5 as $,o as g,c as p,a as e,z as u,q as C,t as s,k as b,r as c,d as i,w as n}from"./index.js";import{T as k}from"./TabsSettings.js";const D={name:"SettingsIntfield",props:["category_name","option_name","placeholder","disabled"],data(){return{timerDelay:2e3,timerId:-1,statusUpdate:""}},computed:{category(){return this.$store.state.settings.categories.find(t=>t.name===this.category_name)},option(){return this.category?this.category.options.find(t=>t.name===this.option_name):{}},value(){return this.option.value},info(){return this.statusUpdate==="success"?this.$t("setting.saved"):this.statusUpdate==="error"?this.$t("setting.not-saved"):""},is_success(){return this.statusUpdate==="success"},is_error(){return this.statusUpdate==="error"}},methods:{set_update_timer(){this.timerId>0&&(window.clearTimeout(this.timerId),this.timerId=-1),this.statusUpdate="",this.$refs.setting.value!==this.value&&(this.timerId=window.setTimeout(this.update_setting,this.timerDelay))},update_setting(){this.timerId=-1;const t=this.$refs.setting.value;if(t===this.value){this.statusUpdate="";return}const a={category:this.category.name,name:this.option_name,value:parseInt(t,10)};w.settings_update(this.category.name,a).then(()=>{this.$store.commit($,a),this.statusUpdate="success"}).catch(()=>{this.statusUpdate="error",this.$refs.setting.value=this.value}).finally(()=>{this.timerId=window.setTimeout(this.clear_status,this.timerDelay)})},clear_status(){this.statusUpdate=""}}},V=["disabled"],z={class:"field"},N={class:"label has-text-weight-normal"},E=["textContent"],P={class:"control"},B=["placeholder","value"],L={key:0,class:"help"};function W(t,a,r,_,f,o){return g(),p("fieldset",{disabled:r.disabled},[e("div",z,[e("label",N,[u(t.$slots,"label"),e("i",{class:C(["is-size-7",{"has-text-info":o.is_success,"has-text-danger":o.is_error}]),textContent:s(o.info)},null,10,E)]),e("div",P,[e("input",{ref:"setting",class:"column input is-one-fifth",type:"number",min:"0",placeholder:r.placeholder,value:o.value,onInput:a[0]||(a[0]=(...d)=>o.set_update_timer&&o.set_update_timer(...d))},null,40,B)]),t.$slots.info?(g(),p("p",L,[u(t.$slots,"info")])):b("",!0)])],8,V)}const O=m(D,[["render",W]]),q={name:"SettingsTextfield",props:["category_name","option_name","placeholder","disabled"],data(){return{timerDelay:2e3,timerId:-1,statusUpdate:""}},computed:{category(){return this.$store.state.settings.categories.find(t=>t.name===this.category_name)},option(){return this.category?this.category.options.find(t=>t.name===this.option_name):{}},value(){return this.option.value},info(){return this.statusUpdate==="success"?this.$t("setting.saved"):this.statusUpdate==="error"?this.$t("setting.not-saved"):""},is_success(){return this.statusUpdate==="success"},is_error(){return this.statusUpdate==="error"}},methods:{set_update_timer(){this.timerId>0&&(window.clearTimeout(this.timerId),this.timerId=-1),this.statusUpdate="",this.$refs.setting.value!==this.value&&(this.timerId=window.setTimeout(this.update_setting,this.timerDelay))},update_setting(){this.timerId=-1;const t=this.$refs.setting.value;if(t===this.value){this.statusUpdate="";return}const a={category:this.category.name,name:this.option_name,value:t};w.settings_update(this.category.name,a).then(()=>{this.$store.commit($,a),this.statusUpdate="success"}).catch(()=>{this.statusUpdate="error",this.$refs.setting.value=this.value}).finally(()=>{this.timerId=window.setTimeout(this.clear_status,this.timerDelay)})},clear_status(){this.statusUpdate=""}}},A=["disabled"],G={class:"field"},H={class:"label has-text-weight-normal"},j=["textContent"],F={class:"control"},J=["placeholder","value"],K={key:0,class:"help"};function M(t,a,r,_,f,o){return g(),p("fieldset",{disabled:r.disabled},[e("div",G,[e("label",H,[u(t.$slots,"label"),e("i",{class:C(["is-size-7",{"has-text-info":o.is_success,"has-text-danger":o.is_error}]),textContent:s(o.info)},null,10,j)]),e("div",F,[e("input",{ref:"setting",class:"input",type:"text",placeholder:r.placeholder,value:o.value,onInput:a[0]||(a[0]=(...d)=>o.set_update_timer&&o.set_update_timer(...d))},null,40,J)]),t.$slots.info?(g(),p("p",K,[u(t.$slots,"info")])):b("",!0)])],8,A)}const Q=m(q,[["render",M]]),R={name:"PageSettingsWebinterface",components:{ContentWithHeading:I,ControlDropdown:T,SettingsCheckbox:S,SettingsIntfield:O,SettingsTextfield:Q,TabsSettings:k},computed:{locale:{get(){const t=this.$i18n.availableLocales;let a=t.find(_=>_===this.$i18n.locale);const[r]=this.$i18n.locale.split("-");return a||(a=t.find(_=>_===r)),a||(a=t.forEach(_=>_.split("-")[0]===r)),a||(a=this.$i18n.fallbackLocale),a},set(t){this.$i18n.locale=t}},locales:{get(){return this.$i18n.availableLocales.map(t=>({id:t,name:this.$t(`language.${t}`)}))}},settings_option_show_composer_now_playing(){return this.$store.getters.settings_option_show_composer_now_playing},settings_option_show_filepath_now_playing(){return this.$store.getters.settings_option_show_filepath_now_playing}}},X={class:"fd-page-with-tabs"},Y=["textContent"],Z=["textContent"],tt=["textContent"],et=["textContent"],st=["textContent"],nt=["textContent"],at=["textContent"],it=["textContent"],ot=["textContent"],lt=["textContent"],rt=["textContent"],_t=["textContent"],ct=["textContent"],dt=["textContent"],ht=["textContent"],gt=["textContent"],pt=["textContent"],ut=["textContent"],mt=["textContent"],ft=["textContent"],wt=["textContent"],$t=["textContent"],Ct=["textContent"];function bt(t,a,r,_,f,o){const d=c("tabs-settings"),y=c("control-dropdown"),h=c("content-with-heading"),l=c("settings-checkbox"),v=c("settings-textfield"),x=c("settings-intfield");return g(),p("div",X,[i(d),i(h,null,{"heading-left":n(()=>[e("div",{class:"title is-4",textContent:s(t.$t("page.settings.general.language"))},null,8,Y)]),content:n(()=>[i(y,{value:o.locale,"onUpdate:value":a[0]||(a[0]=U=>o.locale=U),options:o.locales},null,8,["value","options"])]),_:1}),i(h,null,{"heading-left":n(()=>[e("div",{class:"title is-4",textContent:s(t.$t("page.settings.general.navigation-items"))},null,8,Z)]),content:n(()=>[e("p",{class:"content",textContent:s(t.$t("page.settings.general.navigation-item-selection"))},null,8,tt),e("div",{class:"notification is-size-7",textContent:s(t.$t("page.settings.general.navigation-item-selection-info"))},null,8,et),i(l,{category_name:"webinterface",option_name:"show_menu_item_playlists"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.playlists"))},null,8,st)]),_:1}),i(l,{category_name:"webinterface",option_name:"show_menu_item_music"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.music"))},null,8,nt)]),_:1}),i(l,{category_name:"webinterface",option_name:"show_menu_item_podcasts"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.podcasts"))},null,8,at)]),_:1}),i(l,{category_name:"webinterface",option_name:"show_menu_item_audiobooks"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.audiobooks"))},null,8,it)]),_:1}),i(l,{category_name:"webinterface",option_name:"show_menu_item_radio"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.radio"))},null,8,ot)]),_:1}),i(l,{category_name:"webinterface",option_name:"show_menu_item_files"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.files"))},null,8,lt)]),_:1}),i(l,{category_name:"webinterface",option_name:"show_menu_item_search"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.search"))},null,8,rt)]),_:1})]),_:1}),i(h,null,{"heading-left":n(()=>[e("div",{class:"title is-4",textContent:s(t.$t("page.settings.general.album-lists"))},null,8,_t)]),content:n(()=>[i(l,{category_name:"webinterface",option_name:"show_cover_artwork_in_album_lists"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.show-coverart"))},null,8,ct)]),_:1})]),_:1}),i(h,null,{"heading-left":n(()=>[e("div",{class:"title is-4",textContent:s(t.$t("page.settings.general.now-playing-page"))},null,8,dt)]),content:n(()=>[i(l,{category_name:"webinterface",option_name:"show_composer_now_playing"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.show-composer"))},null,8,ht)]),info:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.show-composer-info"))},null,8,gt)]),_:1}),i(v,{category_name:"webinterface",option_name:"show_composer_for_genre",disabled:!o.settings_option_show_composer_now_playing,placeholder:t.$t("page.settings.general.genres")},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.show-composer-genres"))},null,8,pt)]),info:n(()=>[e("p",{class:"help",textContent:s(t.$t("page.settings.general.show-composer-genres-info-1"))},null,8,ut),e("p",{class:"help",textContent:s(t.$t("page.settings.general.show-composer-genres-info-2"))},null,8,mt),e("p",{class:"help",textContent:s(t.$t("page.settings.general.show-composer-genres-info-3"))},null,8,ft)]),_:1},8,["disabled","placeholder"]),i(l,{category_name:"webinterface",option_name:"show_filepath_now_playing"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.show-path"))},null,8,wt)]),_:1})]),_:1}),i(h,null,{"heading-left":n(()=>[e("div",{class:"title is-4",textContent:s(t.$t("page.settings.general.recently-added-page"))},null,8,$t)]),content:n(()=>[i(x,{category_name:"webinterface",option_name:"recently_added_limit"},{label:n(()=>[e("span",{textContent:s(t.$t("page.settings.general.recently-added-page-info"))},null,8,Ct)]),_:1})]),_:1})])}const Tt=m(R,[["render",bt]]);export{Tt as default};
|