diff options
-rw-r--r-- | settings/Controller/AppSettingsController.php | 37 | ||||
-rw-r--r-- | settings/src/components/appList.vue | 17 |
2 files changed, 36 insertions, 18 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 81a507c9430..2203b654fae 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -140,6 +140,7 @@ class AppSettingsController extends Controller { $params['urlGenerator'] = $this->urlGenerator; $params['updateCount'] = count($this->getAppsWithUpdates()); $params['developerDocumentation'] = $this->urlGenerator->linkToDocs('developer-manual'); + $params['bundles'] = $this->getBundles(); $this->navigationManager->setActiveEntry('core_apps'); $templateResponse = new TemplateResponse('settings', 'settings', ['serverData' => $params]); @@ -150,6 +151,20 @@ class AppSettingsController extends Controller { return $templateResponse; } + private function getBundles() { + $result = []; + $bundles = $this->bundleFetcher->getBundles(); + foreach ($bundles as $bundle) { + $result[] = [ + 'name' => $bundle->getName(), + 'id' => $bundle->getIdentifier(), + 'appIdentifiers' => $bundle->getAppIdentifiers() + ]; + } + return $result; + + } + private function getAllCategories() { $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); @@ -385,28 +400,22 @@ class AppSettingsController extends Controller { foreach($bundles as $bundle) { $newCategory = true; $allApps = $appClass->listAllApps(); - $categories = $this->getAllCategories(); - foreach($categories as $singleCategory) { - $newApps = $this->getAppsForCategory($singleCategory['id']); - foreach($allApps as $app) { - foreach($newApps as $key => $newApp) { - if($app['id'] === $newApp['id']) { - unset($newApps[$key]); - } + + $newApps = $this->getAppsForCategory(); + foreach($allApps as $app) { + foreach($newApps as $key => $newApp) { + if($app['id'] === $newApp['id']) { + unset($newApps[$key]); } } - $allApps = array_merge($allApps, $newApps); } + $allApps = array_merge($allApps, $newApps); + foreach($bundle->getAppIdentifiers() as $identifier) { foreach($allApps as $app) { if($app['id'] === $identifier) { - if($newCategory) { - $app['newCategory'] = true; - $app['categoryName'] = $bundle->getName(); - } $app['bundleId'] = $bundle->getIdentifier(); - $newCategory = false; $apps[] = $app; continue; } diff --git a/settings/src/components/appList.vue b/settings/src/components/appList.vue index 2bec287a28e..ebaab914d88 100644 --- a/settings/src/components/appList.vue +++ b/settings/src/components/appList.vue @@ -27,16 +27,16 @@ </div> <div id="apps-list" class="installed" v-if="useBundleView"> - <template v-for="app in apps"> - <div class="apps-header" v-if="app.newCategory"> + <template v-for="bundle in bundles"> + <div class="apps-header"> <div class="app-image"></div> - <h2>{{ app.categoryName }} <input class="enable" type="button" value="Alle aktivieren"></h2> + <h2>{{ bundle.name }} <input class="enable" type="button" value="Alle aktivieren"></h2> <div class="app-version"></div> <div class="app-level"></div> <div class="app-groups"></div> <div class="actions"> </div> </div> - <app-item v-else :key="app.id" :app="app" :category="category"/> + <app-item v-for="app in bundleApps(bundle.id)" :key="app.id" :app="app" :category="category"/> </template> </div> @@ -82,6 +82,15 @@ export default { return this.$store.getters.getApps .filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1) }, + bundles() { + return this.$store.getters.getServerData.bundles; + }, + bundleApps() { + return function(bundle) { + return this.$store.getters.getApps + .filter(app => app.bundleId === bundle); + } + }, searchApps() { if (this.search === '') { return []; |