core-recommendedapps.js 8.7 KB

123
  1. /*! For license information please see core-recommendedapps.js.LICENSE.txt */
  2. (()=>{"use strict";var t,n={69897:(t,n,e)=>{var a=e(45994),o=e(31352),i=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(4820),c=e(79753),d=e(79954),u=e(63560),g=e(10861),m=e.n(g);const A={calendar:{description:(0,o.Iu)("core","Schedule work & meetings, synced with all your devices."),icon:(0,c.imagePath)("core","places/calendar.svg")},contacts:{description:(0,o.Iu)("core","Keep your colleagues and friends in one place without leaking their private info."),icon:(0,c.imagePath)("core","places/contacts.svg")},mail:{description:(0,o.Iu)("core","Simple email app nicely integrated with Files, Contacts and Calendar."),icon:(0,c.imagePath)("core","actions/mail.svg")},spreed:{description:(0,o.Iu)("core","Chatting, video calls, screensharing, online meetings and web conferencing – in your browser and with mobile apps."),icon:(0,c.imagePath)("core","apps/spreed.svg")},richdocuments:{name:"Nextcloud Office",description:(0,o.Iu)("core","Collaborative documents, spreadsheets and presentations, built on Collabora Online."),icon:(0,c.imagePath)("core","apps/richdocuments.svg")},notes:{description:(0,o.Iu)("core","Distraction free note taking app."),icon:(0,c.imagePath)("core","apps/notes.svg")},richdocumentscode:{hidden:!0}},h=Object.keys(A),f={name:"RecommendedApps",components:{NcButton:m()},data:()=>({showInstallButton:!1,installingApps:!1,loadingApps:!0,loadingAppsError:!1,apps:[],defaultPageUrl:(0,d.j)("core","defaultPageUrl")}),computed:{recommendedApps(){return this.apps.filter((t=>h.includes(t.id)))}},async mounted(){try{const{data:t}=await p.default.get((0,c.generateUrl)("settings/apps/list"));r.info("".concat(t.apps.length," apps fetched")),this.apps=t.apps.map((t=>Object.assign(t,{loading:!1,installationError:!1}))),r.debug("".concat(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 ".concat(n.id)),n.loading=!0,p.default.post((0,c.generateUrl)("settings/apps/enable"),{appIds:[n.id],groups:[]}).catch((t=>{r.error("could not install ".concat(n.id),{error:t}),n.installationError=!0})).then((()=>{r.info("installed ".concat(n.id)),n.loading=!1})))))));r.debug("installing ".concat(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 A&&A[t].icon?A[t].icon:(r.warn("no app icon for recommended app ".concat(t)),(0,c.imagePath)("core","places/default-app-icon.svg")),customName:t=>t.id in A&&A[t.id].name||t.name,customDescription:t=>t in A?A[t].description:(r.warn("no app description for recommended app ".concat(t)),""),isHidden:t=>t in A&&!!A[t].hidden}};var v=e(93379),C=e.n(v),b=e(7795),_=e.n(b),y=e(90569),x=e.n(y),w=e(3565),I=e.n(w),k=e(19216),P=e.n(k),B=e(44589),O=e.n(B),j=e(46202),D={};D.styleTagTransform=O(),D.setAttributes=I(),D.insert=x().bind(null,"head"),D.domAPI=_(),D.insertStyleElement=P(),C()(j.Z,D),j.Z&&j.Z.locals&&j.Z.locals;const E=(0,e(51900).Z)(f,(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)()),i.default.mixin({methods:{t:o.Iu}}),(new(i.default.extend(E))).$mount("#recommended-apps"),r.debug("recommended apps view rendered")},46202:(t,n,e)=>{e.d(n,{Z:()=>r});var a=e(87537),o=e.n(a),i=e(23645),s=e.n(i)()(o());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 o=e[t];if(void 0!==o)return o.exports;var i=e[t]={id:t,loaded:!1,exports:{}};return n[t].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}a.m=n,t=[],a.O=(n,e,o,i)=>{if(!e){var s=1/0;for(c=0;c<t.length;c++){e=t[c][0],o=t[c][1],i=t[c][2];for(var r=!0,l=0;l<e.length;l++)(!1&i||s>=i)&&Object.keys(a.O).every((t=>a.O[t](e[l])))?e.splice(l--,1):(r=!1,i<s&&(s=i));if(r){t.splice(c--,1);var p=o();void 0!==p&&(n=p)}}return n}i=i||0;for(var c=t.length;c>0&&t[c-1][2]>i;c--)t[c]=t[c-1];t[c]=[e,o,i]},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.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 o,i,s=e[0],r=e[1],l=e[2],p=0;if(s.some((n=>0!==t[n]))){for(o in r)a.o(r,o)&&(a.m[o]=r[o]);if(l)var c=l(a)}for(n&&n(e);p<s.length;p++)i=s[p],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return a.O(c)},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 o=a.O(void 0,[7874],(()=>a(69897)));o=a.O(o)})();
  3. //# sourceMappingURL=core-recommendedapps.js.map?v=0719ad302d2eef84daea