Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions core/Controller/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function run($post) {
$options = array_merge($opts, $post, $errors);
$this->display($options);
} else {
$this->finishSetup(isset($post['install-recommended-apps']));
$this->finishSetup();
}
} else {
$options = array_merge($opts, $post);
Expand Down Expand Up @@ -106,7 +106,7 @@ public function display($post) {
\OC_Template::printGuestPage('', 'installation', $parameters);
}

private function finishSetup(bool $installRecommended) {
private function finishSetup() {
if (file_exists($this->autoConfigFile)) {
unlink($this->autoConfigFile);
}
Expand All @@ -118,13 +118,8 @@ private function finishSetup(bool $installRecommended) {
}
}

if ($installRecommended) {
$urlGenerator = \OC::$server->getURLGenerator();
$location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended');
header('Location: ' . $location);
exit();
}
\OC_Util::redirectToDefaultPage();
header('Location: ' . \OC::$server->getURLGenerator()->getAbsoluteURL('index.php/core/apps/recommended'));
exit();
}

public function loadAutoConfig($post) {
Expand Down
8 changes: 2 additions & 6 deletions core/css/guest.css
Original file line number Diff line number Diff line change
Expand Up @@ -667,18 +667,14 @@ form #selectDbType label span {
margin: 5px 0 !important;
}

#install-recommended-apps + label span {
display: inline-block;
opacity: .7;
}

/* Errors */
/* Warnings and errors are the same */
.body-login-container,
.warning,
.update,
.error {
display: block;
display: flex;
flex-direction: column;
margin-top: 15px;
padding: 15px;
background-color: rgba(0,0,0,.3);
Expand Down
4 changes: 2 additions & 2 deletions core/js/dist/files_client.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_client.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_fileinfo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_fileinfo.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_iedavclient.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_iedavclient.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions core/js/dist/install.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/install.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions core/js/dist/login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/login.js.map

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions core/js/dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/maintenance.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/maintenance.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions core/js/dist/recommendedapps.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/recommendedapps.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions core/js/dist/unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/unified-search.js.map

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions core/src/components/setup/InstallButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
- @copyright 2022 Christopher Ng <[email protected]>
-
- @author Christopher Ng <[email protected]>
-
- @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/>.
-
-->

<template>
<button
class="primary"
:autofocus="true"
v-on="$listeners">
{{ t('core', 'Install recommended apps') }}
</button>
</template>

<script>
export default {
name: 'InstallButton',
}
</script>

<style lang="scss" scoped>
button {
margin: 24px auto 10px auto;
padding: 10px 20px;
font-size: 20px;
}
</style>
64 changes: 42 additions & 22 deletions core/src/components/setup/RecommendedApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
<p v-else-if="loadingAppsError" class="loading-error text-center">
{{ t('core', 'Could not fetch list of apps from the App Store.') }}
</p>
<p v-else class="text-center">
<p v-else-if="installingApps" class="text-center">
{{ t('core', 'Installing apps …') }}
</p>

<div v-for="app in recommendedApps" :key="app.id" class="app">
<img :src="customIcon(app.id)" alt="">
<div class="info">
Expand All @@ -51,6 +52,10 @@
</p>
</div>
</div>

<InstallButton v-if="showInstallButton"
@click.stop.prevent="installApps" />

<p class="text-center">
<a :href="defaultPageUrl">{{ t('core', 'Cancel') }}</a>
</p>
Expand All @@ -64,6 +69,9 @@ import { loadState } from '@nextcloud/initial-state'
import pLimit from 'p-limit'
import { translate as t } from '@nextcloud/l10n'

// TODO replace with Button component when @nextcloud/vue is upgraded to v5
import InstallButton from './InstallButton'

import logger from '../../logger'

const recommended = {
Expand Down Expand Up @@ -94,8 +102,13 @@ const defaultPageUrl = loadState('core', 'defaultPageUrl')

export default {
name: 'RecommendedApps',
components: {
InstallButton,
},
data() {
return {
showInstallButton: false,
installingApps: false,
loadingApps: true,
loadingAppsError: false,
apps: [],
Expand All @@ -107,28 +120,28 @@ export default {
return this.apps.filter(app => recommendedIds.includes(app.id))
},
},
mounted() {
return axios.get(generateUrl('settings/apps/list'))
.then(resp => resp.data)
.then(data => {
logger.info(`${data.apps.length} apps fetched`)

this.apps = data.apps.map(app => Object.assign(app, { loading: false, installationError: false }))
logger.debug(`${this.recommendedApps.length} recommended apps found`, { apps: this.recommendedApps })

this.installApps()
})
.catch(error => {
logger.error('could not fetch app list', { error })

this.loadingAppsError = true
})
.then(() => {
this.loadingApps = false
})
async mounted() {
try {
const { data } = await axios.get(generateUrl('settings/apps/list'))
logger.info(`${data.apps.length} apps fetched`)

this.apps = data.apps.map(app => Object.assign(app, { loading: false, installationError: false }))
logger.debug(`${this.recommendedApps.length} recommended apps found`, { apps: this.recommendedApps })

this.showInstallButton = true
} catch (error) {
logger.error('could not fetch app list', { error })

this.loadingAppsError = true
} finally {
this.loadingApps = false
}
},
methods: {
installApps() {
this.showInstallButton = false
this.installingApps = true

const limit = pLimit(1)
const installing = this.recommendedApps
.filter(app => !app.active && app.isCompatible && app.canInstall)
Expand Down Expand Up @@ -177,8 +190,15 @@ export default {

}

p.loading, p.loading-error {
height: 100px;
p {
&.loading,
&.loading-error {
height: 100px;
}

&:last-child {
margin-top: 10px;
}
}

.text-center {
Expand Down
12 changes: 1 addition & 11 deletions core/templates/installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,9 @@
</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')); ?>
<span><?php p($l->t('Calendar, Contacts, Talk, Mail & Collaborative editing')); ?></span>
</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>
<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Install')); ?>" data-finishing="<?php p($l->t('Installing …')); ?>"></div>

<p class="info">
<span class="icon-info-white"></span>
Expand Down
3 changes: 0 additions & 3 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@
'OCP\\Dashboard\\RegisterWidgetEvent' => $baseDir . '/lib/public/Dashboard/RegisterWidgetEvent.php',
'OCP\\Dashboard\\Service\\IEventsService' => $baseDir . '/lib/public/Dashboard/Service/IEventsService.php',
'OCP\\Dashboard\\Service\\IWidgetsService' => $baseDir . '/lib/public/Dashboard/Service/IWidgetsService.php',
'OCP\\DataCollector\\AbstractDataCollector' => $baseDir . '/lib/public/DataCollector/AbstractDataCollector.php',
'OCP\\DataCollector\\IDataCollector' => $baseDir . '/lib/public/DataCollector/IDataCollector.php',
'OCP\\DataCollector\\IManager' => $baseDir . '/lib/public/DataCollector/IManager.php',
'OCP\\Defaults' => $baseDir . '/lib/public/Defaults.php',
'OCP\\Diagnostics\\IEvent' => $baseDir . '/lib/public/Diagnostics/IEvent.php',
'OCP\\Diagnostics\\IEventLogger' => $baseDir . '/lib/public/Diagnostics/IEventLogger.php',
Expand Down
3 changes: 0 additions & 3 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Dashboard\\RegisterWidgetEvent' => __DIR__ . '/../../..' . '/lib/public/Dashboard/RegisterWidgetEvent.php',
'OCP\\Dashboard\\Service\\IEventsService' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Service/IEventsService.php',
'OCP\\Dashboard\\Service\\IWidgetsService' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Service/IWidgetsService.php',
'OCP\\DataCollector\\AbstractDataCollector' => __DIR__ . '/../../..' . '/lib/public/DataCollector/AbstractDataCollector.php',
'OCP\\DataCollector\\IDataCollector' => __DIR__ . '/../../..' . '/lib/public/DataCollector/IDataCollector.php',
'OCP\\DataCollector\\IManager' => __DIR__ . '/../../..' . '/lib/public/DataCollector/IManager.php',
'OCP\\Defaults' => __DIR__ . '/../../..' . '/lib/public/Defaults.php',
'OCP\\Diagnostics\\IEvent' => __DIR__ . '/../../..' . '/lib/public/Diagnostics/IEvent.php',
'OCP\\Diagnostics\\IEventLogger' => __DIR__ . '/../../..' . '/lib/public/Diagnostics/IEventLogger.php',
Expand Down