(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[9966],{8332:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return _}});var a=t(6252),r=t(3577);function n(e,s,t,n,o,l){const d=(0,a.up)("Loading"),i=(0,a.up)("Widget"),c=(0,a.up)("Row");return(0,a.wg)(),(0,a.iD)(a.HY,null,[o.loading?((0,a.wg)(),(0,a.j4)(d,{key:0})):(0,a.kq)("",!0),(0,a._)("div",{id:"dashboard",class:(0,r.C_)(["col-12",l.classes]),style:(0,r.j5)(o.style)},[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(o.rows,((e,s)=>((0,a.wg)(),(0,a.j4)(c,{key:s,class:(0,r.C_)(e.class),style:(0,r.j5)(e.style)},{default:(0,a.w5)((()=>[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(e.widgets,((e,s)=>((0,a.wg)(),(0,a.j4)(a.Ob,{key:s},[(0,a.Wm)(i,{style:(0,r.j5)(e.style),class:(0,r.C_)(e.class)},{default:(0,a.w5)((()=>[((0,a.wg)(),(0,a.j4)((0,a.LL)(e.component),(0,a.dG)({ref_for:!0},l.getWidgetProps(e)),null,16))])),_:2},1032,["style","class"])],1024)))),128))])),_:2},1032,["class","style"])))),128))],6)],64)}var o=t(2262),l=t(8637),d=t(6791);function i(e,s,t,n,o,l){return(0,a.wg)(),(0,a.iD)("div",{class:(0,r.C_)(["row",l.classes]),style:(0,r.j5)(t.style)},[(0,a.WI)(e.$slots,"default",{},void 0,!0)],6)}var c={name:"Row",props:{class:{type:String,required:!1,default:""},style:{type:String,required:!1,default:""}},computed:{classes(){return this.class}}},u=t(3744);const p=(0,u.Z)(c,[["render",i],["__scopeId","data-v-1b4663f2"]]);var h=p;function f(e,s,t,n,o,l){return(0,a.wg)(),(0,a.iD)("div",{style:(0,r.j5)(t.style),class:(0,r.C_)(l.classes)},[(0,a.WI)(e.$slots,"default",{},void 0,!0)],6)}var m={name:"Widget",props:{style:{type:String,required:!1,default:""},class:{type:String,required:!1,default:""}},computed:{classes(){return(this.class?.length?this.class.split(" "):["col-3"]).concat(["widget","column"])}}};const g=(0,u.Z)(m,[["render",f],["__scopeId","data-v-5df52982"]]);var y=g,w={name:"Dashboard",mixins:[l.Z],components:{Widget:y,Loading:d.Z,Row:h},props:{refreshSeconds:{type:Number,required:!1,default:0}},data(){return{rows:[],loading:!1,style:void 0,class:void 0}},computed:{classes(){return this.class},_refreshSeconds(){return parseFloat(this.refreshSeconds)||0}},methods:{getWidgetProps(e){const s={...e.props};return s.class&&delete s.class,s},parseTemplate(e){const s=(new DOMParser).parseFromString(e,"text/xml").childNodes[0],r=this;this.style=s.attributes.style?.nodeValue,this.class=s.attributes.class?.nodeValue,this.rows=[...s.getElementsByTagName("Row")].map((e=>({style:e.attributes.style?.nodeValue,class:e.attributes.class?.nodeValue,widgets:[...e.children].map((e=>{const s=(0,o.XI)((0,a.RC)((()=>t(6725)(`./${e.nodeName}/Index`)))),n=e.attributes.style?.nodeValue,l=e.attributes.class?.nodeValue,d=[...e.attributes].reduce(((e,s)=>("style"!==s.nodeName&&(e[s.nodeName]=s.nodeValue),e)),{content:e.innerHTML}),i={component:s,style:n,class:l,props:d||{}};return r.$options.components[e.nodeName]=s,i}))}))),this.loading=!1},async refreshDashboard(){this.loading=!0,this.widgets=[];const e=this.$route.params.name,s=await this.request("config.get_dashboard",{name:e});s||this.notifyError(`Dashboard ${e} not found`),this.parseTemplate(s)}},mounted(){if(this.refreshDashboard(),this._refreshSeconds){const e=this;setInterval((()=>{e.refreshDashboard()}),parseInt((1e3*this._refreshSeconds).toFixed(0)))}}};const v=(0,u.Z)(w,[["render",n],["__scopeId","data-v-462fad8c"]]);var _=v},6725:function(e,s,t){var a={"./Calendar/Index":[5638,5638],"./Camera/Index":[446,446],"./Component/Index":[1449,7651,2844,1449],"./DateTime/Index":[4619,1391,4619],"./DateTimeWeather/Index":[9962,9211,1391,9962],"./ImageCarousel/Index":[2140,9211,1391,2140],"./Music/Index":[7841,7651,906,7841],"./Plugin/Index":[8179,8179],"./RssNews/Index":[6523,6523],"./Weather/Index":[9211,9211]};function r(e){if(!t.o(a,e))return Promise.resolve().then((function(){var s=new Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}));var s=a[e],r=s[0];return Promise.all(s.slice(1).map(t.e)).then((function(){return t(r)}))}r.keys=function(){return Object.keys(a)},r.id=6725,e.exports=r}}]);
//# sourceMappingURL=dashboard.d2829947.js.map