core-recommendedapps.js 8.7 KB

123
  1. /*! For license information please see core-recommendedapps.js.LICENSE.txt */
  2. (()=>{"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(62642);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(" "),n("div",{staticClass:"info"},[n("h3",[t._v("\n\t\t\t\t\t"+t._s(t.customName(e))+"\n\t\t\t\t\t"),e.loading?n("span",{staticClass:"icon icon-loading-small-dark"}):e.active?n("span",{staticClass:"icon icon-checkmark-white"}):t._e()]),t._v(" "),n("p",{domProps:{innerHTML:t._s(t.customDescription(e.id))}}),t._v(" "),e.installationError?n("p",[n("strong",[t._v(t._s(t.t("core","App download or installation failed")))])]):e.isCompatible?e.canInstall?t._e():n("p",[n("strong",[t._v(t._s(t.t("core","Cannot install this app")))])]):n("p",[n("strong",[t._v(t._s(t.t("core","Cannot install this app because it is not compatible")))])])])]],2)})),t._v(" "),n("div",{staticClass:"dialog-row"},[t.showInstallButton?n("NcButton",{attrs:{type:"tertiary",role:"link",href:t.defaultPageUrl}},[t._v("\n\t\t\t"+t._s(t.t("core","Skip"))+"\n\t\t")]):t._e(),t._v(" "),t.showInstallButton?n("NcButton",{attrs:{type:"primary"},on:{click:function(n){return n.stopPropagation(),n.preventDefault(),t.installApps.apply(null,arguments)}}},[t._v("\n\t\t\t"+t._s(t.t("core","Install recommended apps"))+"\n\t\t")]):t._e()],1)],2)}),[],!1,null,"880500b4",null).exports;e.nc=btoa((0,a.IH)()),o.default.mixin({methods:{t:i.Iu}}),(new(o.default.extend(D))).$mount("#recommended-apps"),r.debug("recommended apps view rendered")},14400:(t,n,e)=>{e.d(n,{Z:()=>r});var a=e(87537),i=e.n(a),o=e(23645),s=e.n(o)()(i());s.push([t.id,".dialog-row[data-v-880500b4]{display:flex;justify-content:end;margin-top:8px}p.loading[data-v-880500b4],p.loading-error[data-v-880500b4]{height:100px}p[data-v-880500b4]:last-child{margin-top:10px}.text-center[data-v-880500b4]{text-align:center}.app[data-v-880500b4]{display:flex;flex-direction:row}.app img[data-v-880500b4]{height:50px;width:50px;filter:var(--background-invert-if-dark)}.app img[data-v-880500b4],.app .info[data-v-880500b4]{padding:12px}.app .info h3[data-v-880500b4],.app .info p[data-v-880500b4]{text-align:left}.app .info h3[data-v-880500b4]{margin-top:0}.app .info h3>span.icon[data-v-880500b4]{display:inline-block}","",{version:3,sources:["webpack://./core/src/components/setup/RecommendedApps.vue"],names:[],mappings:"AACA,6BACC,YAAA,CACA,mBAAA,CACA,cAAA,CAIA,4DAEC,YAAA,CAGD,8BACC,eAAA,CAIF,8BACC,iBAAA,CAGD,sBACC,YAAA,CACA,kBAAA,CAEA,0BACC,WAAA,CACA,UAAA,CACA,uCAAA,CAGD,sDACC,YAAA,CAIA,6DACC,eAAA,CAGD,+BACC,YAAA,CAGD,yCACC,oBAAA",sourcesContent:["\n.dialog-row {\n\tdisplay: flex;\n\tjustify-content: end;\n\tmargin-top: 8px;\n}\n\np {\n\t&.loading,\n\t&.loading-error {\n\t\theight: 100px;\n\t}\n\n\t&:last-child {\n\t\tmargin-top: 10px;\n\t}\n}\n\n.text-center {\n\ttext-align: center;\n}\n\n.app {\n\tdisplay: flex;\n\tflex-direction: row;\n\n\timg {\n\t\theight: 50px;\n\t\twidth: 50px;\n\t\tfilter: var(--background-invert-if-dark);\n\t}\n\n\timg, .info {\n\t\tpadding: 12px;\n\t}\n\n\t.info {\n\t\th3, p {\n\t\t\ttext-align: left;\n\t\t}\n\n\t\th3 {\n\t\t\tmargin-top: 0;\n\t\t}\n\n\t\th3 > span.icon {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const r=s}},e={};function a(t){var i=e[t];if(void 0!==i)return i.exports;var o=e[t]={id:t,loaded:!1,exports:{}};return n[t].call(o.exports,o,o.exports,a),o.loaded=!0,o.exports}a.m=n,t=[],a.O=(n,e,i,o)=>{if(!e){var s=1/0;for(d=0;d<t.length;d++){e=t[d][0],i=t[d][1],o=t[d][2];for(var r=!0,l=0;l<e.length;l++)(!1&o||s>=o)&&Object.keys(a.O).every((t=>a.O[t](e[l])))?e.splice(l--,1):(r=!1,o<s&&(s=o));if(r){t.splice(d--,1);var p=i();void 0!==p&&(n=p)}}return n}o=o||0;for(var d=t.length;d>0&&t[d-1][2]>o;d--)t[d]=t[d-1];t[d]=[e,i,o]},a.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return a.d(n,{a:n}),n},a.d=(t,n)=>{for(var e in n)a.o(n,e)&&!a.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},a.e=()=>Promise.resolve(),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),a.j=1033,(()=>{a.b=document.baseURI||self.location.href;var t={1033:0};a.O.j=n=>0===t[n];var n=(n,e)=>{var i,o,s=e[0],r=e[1],l=e[2],p=0;if(s.some((n=>0!==t[n]))){for(i in r)a.o(r,i)&&(a.m[i]=r[i]);if(l)var d=l(a)}for(n&&n(e);p<s.length;p++)o=s[p],a.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return a.O(d)},e=self.webpackChunknextcloud=self.webpackChunknextcloud||[];e.forEach(n.bind(null,0)),e.push=n.bind(null,e.push.bind(e))})(),a.nc=void 0;var i=a.O(void 0,[7874],(()=>a(27512)));i=a.O(i)})();
  3. //# sourceMappingURL=core-recommendedapps.js.map?v=b13451d91eb9d700036e