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
4 changes: 2 additions & 2 deletions apps/settings/js/vue-4.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-4.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/settings/js/vue-5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-5.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/settings/js/vue-settings-apps-users-management.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

52 changes: 16 additions & 36 deletions apps/settings/src/components/AppList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@
</template>

<script>
import pLimit from 'p-limit'

import AppItem from './AppList/AppItem'
import PrefixMixin from './PrefixMixin'
import recommended from '../recommendedApps'
import pLimit from 'p-limit'

export default {
name: 'AppList',
Expand Down Expand Up @@ -131,26 +129,26 @@ export default {
return OC.Util.naturalSortCompare(sortStringA, sortStringB)
})

switch (this.category) {
case 'installed':
if (this.category === 'installed') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much cleaner :p

return apps.filter(app => app.installed)
case 'recommended':
return apps.filter(app => recommended.includes(app.id))
case 'enabled':
}
if (this.category === 'enabled') {
return apps.filter(app => app.active && app.installed)
case 'disabled':
}
if (this.category === 'disabled') {
return apps.filter(app => !app.active && app.installed)
case 'app-bundles':
}
if (this.category === 'app-bundles') {
return apps.filter(app => app.bundles)
case 'updates':
}
if (this.category === '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)
Expand All @@ -177,7 +175,7 @@ export default {
return !this.useListView && !this.useBundleView
},
useListView() {
return ['installed', 'recommended', 'enabled', 'disabled', 'updates'].includes(this.category)
return (this.category === 'installed' || this.category === 'enabled' || this.category === 'disabled' || this.category === 'updates')
},
useBundleView() {
return (this.category === 'app-bundles')
Expand All @@ -198,24 +196,6 @@ 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)) {
Expand Down
15 changes: 2 additions & 13 deletions apps/settings/src/views/Apps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
</ul>
</AppNavigation>
<AppContent class="app-settings-content" :class="{ 'icon-loading': loadingList }">
<AppList v-if="!loadingList"
:category="category"
:app="currentApp"
:search="searchQuery" />
<AppList :category="category" :app="currentApp" :search="searchQuery" />
</AppContent>
<AppSidebar v-if="id && currentApp" @close="hideAppDetails">
<AppDetails :category="category" :app="currentApp" />
Expand Down Expand Up @@ -136,21 +133,13 @@ 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',
Expand Down
53 changes: 53 additions & 0 deletions core/Controller/RecommendedAppsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php declare(strict_types=1);

/**
* @copyright 2019 Christoph Wurst <[email protected]>
*
* @author 2019 Christoph Wurst <[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/>.
*/

namespace OC\Core\Controller;

use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\IInitialStateService;
use OCP\IRequest;

class RecommendedAppsController extends Controller {

/** @var IInitialStateService */
private $initialStateService;

public function __construct(IRequest $request,
IInitialStateService $initialStateService) {
parent::__construct('core', $request);
$this->initialStateService = $initialStateService;
}

/**
* @NoCSRFRequired
* @return Response
*/
public function index(): Response {
$this->initialStateService->provideInitialState('core', 'defaultPageUrl', \OC_Util::getDefaultPageUrl());
return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest');
}

}
2 changes: 1 addition & 1 deletion core/Controller/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private function finishSetup(bool $installRecommended) {

if ($installRecommended) {
$urlGenerator = \OC::$server->getURLGenerator();
$location = $urlGenerator->getAbsoluteURL('/index.php/settings/apps/recommended?download&returnTo=' . urlencode(\OC_Util::getDefaultPageUrl()));
$location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended');
header('Location: ' . $location);
exit();
}
Expand Down
40 changes: 20 additions & 20 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.

58 changes: 29 additions & 29 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.

26 changes: 13 additions & 13 deletions 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.

36 changes: 36 additions & 0 deletions core/js/dist/recommendedapps.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/js/dist/recommendedapps.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
['name' => 'RecommendedApps#index', 'url' => '/core/apps/recommended', 'verb' => 'GET'],
['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}', 'verb' => 'GET'],
['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'],
['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
Expand Down
Loading