nextcloud/dist/core-recommendedapps.js

3 lines
8.7 KiB
JavaScript
Raw Normal View History

/*! For license information please see core-recommendedapps.js.LICENSE.txt */
(()=>{"use strict";var t,n={27512:(t,n,e)=>{var a=e(77958),i=e(31352),o=e(20144),s=e(17499);const r=null===(l=(0,a.ts)())?(0,s.IY)().setApp("core").build():(0,s.IY)().setApp("core").setUid(l.uid).build();var l,p=e(93664),d=e(79753),c=e(43554),u=e(63560),g=e(74628);const m={calendar:{description:(0,i.Iu)("core","Schedule work & meetings, synced with all your devices."),icon:(0,d.imagePath)("core","places/calendar.svg")},contacts:{description:(0,i.Iu)("core","Keep your colleagues and friends in one place without leaking their private info."),icon:(0,d.imagePath)("core","places/contacts.svg")},mail:{description:(0,i.Iu)("core","Simple email app nicely integrated with Files, Contacts and Calendar."),icon:(0,d.imagePath)("core","actions/mail.svg")},spreed:{description:(0,i.Iu)("core","Chatting, video calls, screensharing, online meetings and web conferencing in your browser and with mobile apps."),icon:(0,d.imagePath)("core","apps/spreed.svg")},richdocuments:{name:"Nextcloud Office",description:(0,i.Iu)("core","Collaborative documents, spreadsheets and presentations, built on Collabora Online."),icon:(0,d.imagePath)("core","apps/richdocuments.svg")},notes:{description:(0,i.Iu)("core","Distraction free note taking app."),icon:(0,d.imagePath)("core","apps/notes.svg")},richdocumentscode:{hidden:!0}},A=Object.keys(m),h={name:"RecommendedApps",components:{NcButton:g.Z},data:()=>({showInstallButton:!1,installingApps:!1,loadingApps:!0,loadingAppsError:!1,apps:[],defaultPageUrl:(0,c.j)("core","defaultPageUrl")}),computed:{recommendedApps(){return this.apps.filter((t=>A.includes(t.id)))}},async mounted(){try{const{data:t}=await p.Z.get((0,d.generateUrl)("settings/apps/list"));r.info(`${t.apps.length} apps fetched`),this.apps=t.apps.map((t=>Object.assign(t,{loading:!1,installationError:!1}))),r.debug(`${this.recommendedApps.length} recommended apps found`,{apps:this.recommendedApps}),this.showInstallButton=!0}catch(t){r.error("could not fetch app list",{error:t}),this.loadingAppsError=!0}finally{this.loadingApps=!1}},methods:{installApps(){this.showInstallButton=!1,this.installingApps=!0;const t=(0,u.Z)(1),n=this.recommendedApps.filter((t=>!t.active&&t.isCompatible&&t.canInstall)).map((n=>t((()=>(r.info(`installing ${n.id}`),n.loading=!0,p.Z.post((0,d.generateUrl)("settings/apps/enable"),{appIds:[n.id],groups:[]}).catch((t=>{r.error(`could not install ${n.id}`,{error:t}),n.installationError=!0})).then((()=>{r.info(`installed ${n.id}`),n.loading=!1})))))));r.debug(`installing ${n.length} recommended apps`),Promise.all(n).then((()=>{r.info("all recommended apps installed, redirecting …"),window.location=this.defaultPageUrl})).catch((t=>r.error("could not install recommended apps",{error:t})))},customIcon:t=>t in m&&m[t].icon?m[t].icon:(r.warn(`no app icon for recommended app ${t}`),(0,d.imagePath)("core","places/default-app-icon.svg")),customName:t=>t.id in m&&m[t.id].name||t.name,customDescription:t=>t in m?m[t].description:(r.warn(`no app description for recommended app ${t}`),""),isHidden:t=>t in m&&!!m[t].hidden}};var f=e(93379),v=e.n(f),C=e(7795),b=e.n(C),_=e(90569),y=e.n(_),x=e(3565),w=e.n(x),I=e(19216),k=e.n(I),P=e(44589),B=e.n(P),O=e(14400),j={};j.styleTagTransform=B(),j.setAttributes=w(),j.insert=y().bind(null,"head"),j.domAPI=b(),j.insertStyleElement=k(),v()(O.Z,j),O.Z&&O.Z.locals&&O.Z.locals;const D=(0,e(51900).Z)(h,(function(){var t=this,n=t._self._c;return n("div",{staticClass:"guest-box"},[n("h2",[t._v(t._s(t.t("core","Recommended apps")))]),t._v(" "),t.loadingApps?n("p",{staticClass:"loading text-center"},[t._v("\n\t\t"+t._s(t.t("core","Loading apps …"))+"\n\t")]):t.loadingAppsError?n("p",{staticClass:"loading-error text-center"},[t._v("\n\t\t"+t._s(t.t("core","Could not fetch list of apps from the App Store."))+"\n\t")]):t.installingApps?n("p",{staticClass:"text-center"},[t._v("\n\t\t"+t._s(t.t("core","Installing apps …"))+"\n\t")]):t._e(),t._v(" "),t._l(t.recommendedApps,(function(e){return n("div",{key:e.id,staticClass:"app"},[t.isHidden(e.id)?t._e():[n("img",{attrs:{src:t.customIcon(e.id),alt:""}}),t._v(" ")
//# sourceMappingURL=core-recommendedapps.js.map?v=3c14b70fa82ff1296891