Add checkbox to install recommended apps during setup

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
Christoph Wurst 2019-11-26 18:15:10 +01:00 committed by Roeland Jago Douma
parent 293585ec12
commit a8f2e6914d
No known key found for this signature in database
GPG Key ID: F941078878347C0C
12 changed files with 102 additions and 31 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
!function(t){function e(e){for(var n,o,i=e[0],a=e[1],s=0,c=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&c.push(r[o][0]),r[o]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(u&&u(e);c.length;)c.shift()()}var n={},r={2:0};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var i=new Promise((function(e,o){n=r[t]=[e,o]}));e.push(n[2]=i);var a,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(t){return o.p+"vue-"+({}[t]||t)+".js?v="+{0:"f1063acdadacc88028ec",4:"1b9a9a854189f065cd3c",5:"d26e956d157c0c427e8e",6:"60121aec3037a1fa3701"}[t]}(t);var u=new Error;a=function(e){s.onerror=s.onload=null,clearTimeout(c);var n=r[t];if(0!==n){if(n){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;u.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,n[1](u)}r[t]=void 0}};var c=setTimeout((function(){a({type:"timeout",target:s})}),12e4);s.onerror=s.onload=a,document.head.appendChild(s)}return Promise.all(e)},o.m=t,o.c=n,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/js/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonpSettings=window.webpackJsonpSettings||[],a=i.push.bind(i);i.push=e,i=i.slice();for(var s=0;s<i.length;s++)e(i[s]);var u=a;o(o.s=313)}([function(t,e,n){var r=n(2),o=n(34),i=n(50),a=n(224),s=r.Symbol,u=o("wks");t.exports=function(t){return u[t]||(u[t]=a&&s[t]||(a?s:i)("Symbol."+t))}},function(t,e,n){"use strict";var r=n(79),o=n(163),i=Object.prototype.toString;function a(t){return"[object Array]"===i.call(t)}function s(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),a(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:a,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:u,isStream:function(t){return s(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,(function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(7))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";n.r(e),function(t,n){
!function(t){function e(e){for(var n,o,i=e[0],a=e[1],s=0,c=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&c.push(r[o][0]),r[o]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(u&&u(e);c.length;)c.shift()()}var n={},r={2:0};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var i=new Promise((function(e,o){n=r[t]=[e,o]}));e.push(n[2]=i);var a,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(t){return o.p+"vue-"+({}[t]||t)+".js?v="+{0:"f1063acdadacc88028ec",4:"57623c76b02684c2b53b",5:"6aedce1af43a98e73126",6:"60121aec3037a1fa3701"}[t]}(t);var u=new Error;a=function(e){s.onerror=s.onload=null,clearTimeout(c);var n=r[t];if(0!==n){if(n){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;u.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,n[1](u)}r[t]=void 0}};var c=setTimeout((function(){a({type:"timeout",target:s})}),12e4);s.onerror=s.onload=a,document.head.appendChild(s)}return Promise.all(e)},o.m=t,o.c=n,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/js/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonpSettings=window.webpackJsonpSettings||[],a=i.push.bind(i);i.push=e,i=i.slice();for(var s=0;s<i.length;s++)e(i[s]);var u=a;o(o.s=313)}([function(t,e,n){var r=n(2),o=n(34),i=n(50),a=n(224),s=r.Symbol,u=o("wks");t.exports=function(t){return u[t]||(u[t]=a&&s[t]||(a?s:i)("Symbol."+t))}},function(t,e,n){"use strict";var r=n(79),o=n(163),i=Object.prototype.toString;function a(t){return"[object Array]"===i.call(t)}function s(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),a(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:a,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:u,isStream:function(t){return s(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,(function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(7))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";n.r(e),function(t,n){
/*!
* Vue.js v2.6.10
* (c) 2014-2019 Evan You
@ -110,4 +110,4 @@ o.default.use(Jt.a);var he={API_FAILURE:function(e,n){try{var r=n.error.response
*
*/
o.default.use(i.a,{defaultHtml:!1}),Object(a.sync)(ve,Xt),r.nc=btoa(OC.requestToken),r.p=OC.linkTo("settings","js/"),o.default.prototype.t=t,o.default.prototype.OC=OC,o.default.prototype.OCA=OCA,o.default.prototype.oc_userconfig=oc_userconfig;var me=new o.default({router:Xt,store:ve,render:function(t){return t(c)}}).$mount("#content")}]);
//# sourceMappingURL=vue-settings-apps-users-management.js.map?v=21b1b0c316e16114eb71
//# sourceMappingURL=vue-settings-apps-users-management.js.map?v=9bdbad57494eb1f6b825

File diff suppressed because one or more lines are too long

View File

@ -96,9 +96,11 @@
</template>
<script>
import pLimit from 'p-limit'
import AppItem from './AppList/AppItem'
import PrefixMixin from './PrefixMixin'
import pLimit from 'p-limit'
import recommended from '../recommendedApps'
export default {
name: 'AppList',
@ -129,26 +131,26 @@ export default {
return OC.Util.naturalSortCompare(sortStringA, sortStringB)
})
if (this.category === 'installed') {
switch (this.category) {
case 'installed':
return apps.filter(app => app.installed)
}
if (this.category === 'enabled') {
case 'recommended':
return apps.filter(app => recommended.includes(app.id))
case 'enabled':
return apps.filter(app => app.active && app.installed)
}
if (this.category === 'disabled') {
case 'disabled':
return apps.filter(app => !app.active && app.installed)
}
if (this.category === 'app-bundles') {
case 'app-bundles':
return apps.filter(app => app.bundles)
}
if (this.category === 'updates') {
case 'updates':
return apps.filter(app => app.update)
default:
// filter app store categories
return apps.filter(app => {
return app.appstore && app.category !== undefined
&& (app.category === this.category || app.category.indexOf(this.category) > -1)
})
}
// filter app store categories
return apps.filter(app => {
return app.appstore && app.category !== undefined
&& (app.category === this.category || app.category.indexOf(this.category) > -1)
})
},
bundles() {
return this.$store.getters.getServerData.bundles.filter(bundle => this.bundleApps(bundle.id).length > 0)
@ -175,7 +177,7 @@ export default {
return !this.useListView && !this.useBundleView
},
useListView() {
return (this.category === 'installed' || this.category === 'enabled' || this.category === 'disabled' || this.category === 'updates')
return ['installed', 'recommended', 'enabled', 'disabled', 'updates'].includes(this.category)
},
useBundleView() {
return (this.category === 'app-bundles')
@ -196,6 +198,24 @@ export default {
}
}
},
mounted() {
if (this.category === 'recommended' && 'download' in this.$route.query) {
const limit = pLimit(1)
const installing = this.apps
.filter(app => !app.active && app.canInstall)
.map(app => limit(() => this.$store.dispatch('enableApp', { appId: app.id, groups: [] })))
console.debug(`installing ${installing.length} recommended apps`)
Promise.all(installing)
.then(() => {
console.info('recommended apps installed')
if ('returnTo' in this.$route.query) {
window.location = this.$route.query.returnTo
}
})
.catch(e => console.error('could not install recommended apps', e))
}
},
methods: {
toggleBundle(id) {
if (this.allBundlesEnabled(id)) {

View File

@ -0,0 +1,26 @@
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export default [
'contacts',
'calendar',
'mail'
]

View File

@ -31,7 +31,10 @@
</ul>
</AppNavigation>
<AppContent class="app-settings-content" :class="{ 'icon-loading': loadingList }">
<AppList :category="category" :app="currentApp" :search="searchQuery" />
<AppList v-if="!loadingList"
:category="category"
:app="currentApp"
:search="searchQuery" />
</AppContent>
<AppSidebar v-if="id && currentApp" @close="hideAppDetails">
<AppDetails :category="category" :app="currentApp" />
@ -133,13 +136,21 @@ export default {
icon: 'icon-category-installed',
text: t('settings', 'Your apps')
},
{
id: 'app-category-recommended',
classes: [],
router: { name: 'apps-category', params: { category: 'recommended' } },
icon: 'icon-category-installed',
text: t('settings', 'Recommended apps')
},
{
id: 'app-category-enabled',
classes: [],
icon: 'icon-category-enabled',
router: { name: 'apps-category', params: { category: 'enabled' } },
text: t('settings', 'Active apps')
}, {
},
{
id: 'app-category-disabled',
classes: [],
icon: 'icon-category-disabled',

View File

@ -31,6 +31,7 @@ namespace OC\Core\Controller;
use OC\Setup;
use OCP\ILogger;
use function urlencode;
class SetupController {
/** @var Setup */
@ -76,7 +77,7 @@ class SetupController {
$options = array_merge($opts, $post, $errors);
$this->display($options);
} else {
$this->finishSetup();
$this->finishSetup(isset($post['install-recommended-apps']));
}
} else {
$options = array_merge($opts, $post);
@ -105,7 +106,7 @@ class SetupController {
\OC_Template::printGuestPage('', 'installation', $parameters);
}
public function finishSetup() {
private function finishSetup(bool $installRecommended) {
if( file_exists( $this->autoConfigFile )) {
unlink($this->autoConfigFile);
}
@ -117,6 +118,12 @@ class SetupController {
}
}
if ($installRecommended) {
$urlGenerator = \OC::$server->getURLGenerator();
$location = $urlGenerator->getAbsoluteURL('/index.php/settings/apps/recommended?download&returnTo=' . urlencode(\OC_Util::getDefaultPageUrl()));
header('Location: ' . $location);
exit();
}
\OC_Util::redirectToDefaultPage();
}

View File

@ -41,8 +41,6 @@ $(document).ready(function() {
$('#dbname').attr('pattern','[0-9a-zA-Z$_-.]+');
});
$('input[checked]').trigger('click');
$('#showAdvanced').click(function(e) {
e.preventDefault();
$('#datadirContent').slideToggle(250);

View File

@ -158,6 +158,15 @@ script('core', [
</fieldset>
<?php endif ?>
<fieldset>
<p class="info">
<input type="checkbox" id="install-recommended-apps" name="install-recommended-apps" class="checkbox checkbox--white" checked>
<label for="install-recommended-apps">
<?php p($l->t( 'Install recommended apps' )); ?>
</label>
</p>
</fieldset>
<div class="icon-loading-dark float-spinner">&nbsp;</div>
<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div>