You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
43 KiB

  1. /*! For license information please see dashboard-main.js.LICENSE.txt */
  2. (()=>{"use strict";var n,e={24308:(n,e,a)=>{var o=a(20144),s=a(79753),i=a(45994),r=a(79954),l=a(4820),d=a(10861),c=a.n(d),p=a(9980),u=a.n(p),A=a(70110),h=a.n(A),b=a(73229);const f={data(){return{isMobile:this._isMobile()}},beforeMount(){window.addEventListener("resize",this._onResize)},beforeDestroy(){window.removeEventListener("resize",this._onResize)},methods:{_onResize(){this.isMobile=this._isMobile()},_isMobile:()=>document.documentElement.clientWidth<768}};var g=a(25108);const m=(0,r.j)("dashboard","panels"),v=(0,r.j)("dashboard","firstRun"),C={weather:{text:t("dashboard","Weather"),icon:"icon-weather-status"},status:{text:t("dashboard","Status"),icon:"icon-user-status-online"}},x={name:"DashboardApp",components:{NcButton:c(),Draggable:u(),NcModal:h(),Pencil:b.default},mixins:[f],data(){var t,n;return{isAdmin:(0,i.ts)().isAdmin,timer:new Date,registeredStatus:[],callbacks:{},callbacksStatus:{},allCallbacksStatus:{},statusInfo:C,enabledStatuses:(0,r.j)("dashboard","statuses"),panels:m,firstRun:v,displayName:null===(t=(0,i.ts)())||void 0===t?void 0:t.displayName,uid:null===(n=(0,i.ts)())||void 0===n?void 0:n.uid,layout:(0,r.j)("dashboard","layout").filter((t=>m[t])),modal:!1,appStoreUrl:(0,s.generateUrl)("/settings/apps/dashboard"),statuses:{}}},computed:{greeting(){const n=this.timer.getHours();let e;e=n>=22||n<5?"night":n>=18?"evening":n>=12?"afternoon":"morning";const a={morning:{generic:t("dashboard","Good morning"),withName:t("dashboard","Good morning, {name}",{name:this.displayName},void 0,{escape:!1})},afternoon:{generic:t("dashboard","Good afternoon"),withName:t("dashboard","Good afternoon, {name}",{name:this.displayName},void 0,{escape:!1})},evening:{generic:t("dashboard","Good evening"),withName:t("dashboard","Good evening, {name}",{name:this.displayName},void 0,{escape:!1})},night:{generic:t("dashboard","Hello"),withName:t("dashboard","Hello, {name}",{name:this.displayName},void 0,{escape:!1})}};return{text:this.displayName&&this.uid!==this.displayName?a[e].withName:a[e].generic}},isActive(){return t=>this.layout.indexOf(t.id)>-1},isStatusActive(){return t=>!(t in this.enabledStatuses)||this.enabledStatuses[t]},sortedAllStatuses(){return Object.keys(this.allCallbacksStatus).slice().sort(this.sortStatuses)},sortedPanels(){return Object.values(this.panels).sort(((t,n)=>{const e=this.layout.indexOf(t.id),a=this.layout.indexOf(n.id);return-1===e||-1===a?a-e||t.id-n.id:e-a||t.id-n.id}))},sortedRegisteredStatus(){return this.registeredStatus.slice().sort(this.sortStatuses)}},watch:{callbacks(){this.rerenderPanels()},callbacksStatus(){for(const t in this.callbacksStatus){const n=this.$refs["status-"+t];this.statuses[t]&&this.statuses[t].mounted||(n?(this.callbacksStatus[t](n[0]),o.default.set(this.statuses,t,{mounted:!0})):g.error("Failed to register panel in the frontend as no backend data was provided for "+t))}}},mounted(){this.updateSkipLink(),window.addEventListener("scroll",this.handleScroll),setInterval((()=>{this.timer=new Date}),3e4),this.firstRun&&window.addEventListener("scroll",this.disableFirstrunHint)},destroyed(){window.removeEventListener("scroll",this.handleScroll)},methods:{register(t,n){o.default.set(this.callbacks,t,n)},registerStatus(t,n){o.default.set(this.allCallbacksStatus,t,n),this.isStatusActive(t)&&(this.registeredStatus.push(t),this.$nextTick((()=>{o.default.set(this.callbacksStatus,t,n)})))},rerenderPanels(){for(const t in this.callbacks){const n=this.$refs[t];-1!==this.layout.indexOf(t)&&(this.panels[t]&&this.panels[t].mounted||(n?(this.callbacks[t](n[0],{widget:this.panels[t]}),o.default.set(this.panels[t],"mounted",!0)):g.error("Failed to register panel in the frontend as no backend data was provided for "+t)))}},saveLayout(){l.default.post((0,s.generateUrl)("/apps/dashboard/layout"),{layout:this.layout.join(",")})},saveStatuses(){l.default.post((0,s.generateUrl)("/apps/dashboard/statuses"),{statuses:JSON.stringify(this.enabledStatuses)})},showModal(){this.modal=!0,this.firstRun=!1},closeModal(){this.modal=!1},updateCheckbox(t,n){const e=this.layout.indexOf(t.id);!n&&e>-1?this.layo
  3. //# sourceMappingURL=dashboard-main.js.map?v=2dd64a316c9c43eaa56e