Properly search for other apps

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-05-25 16:27:45 +02:00
parent d52aa55a4f
commit 8b919ecdc4
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
4 changed files with 22 additions and 9 deletions

View File

@ -485,6 +485,7 @@ class AppSettingsController extends Controller {
$apps = array_map(function($appData) use ($manager) {
$appStoreData = $manager->getApp($appData['id']);
$appData['appstoreData'] = $appStoreData;
$appData['license'] = $appStoreData['releases'][0]['licenses'];
$appData['preview'] = isset($appStoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/'.base64_encode($appStoreData['screenshots'][0]['url']) : '';
return $appData;
}, $apps);

View File

@ -28,11 +28,11 @@
<app-score v-if="app.appstoreData && app.appstoreData.ratingNumOverall > 5" :score="app.appstoreData.ratingOverall"></app-score>
<div class="app-author">
{{ t('settings', 'by') }}
<span v-if="author.length > 0" v-for="a in author">
<a v-if="a['@attributes']['homepage']" :href="a['@attributes']['homepage']">{{ a['@value'] }}</a> &nbsp;
<span v-for="a in author">
<a v-if="a['@attributes'] && a['@attributes']['homepage']" :href="a['@attributes']['homepage']">{{ a['@value'] }}</a>
<span v-else>{{ a['@value'] }}</span>
&nbsp;
</span>
<span v-else>{{ author }}</span>
</div>
{{ licence }}
<div class="actions">
@ -103,7 +103,6 @@ export default {
},
computed: {
groups() {
console.log(this.$store.getters.getGroups);
return this.$store.getters.getGroups
.filter(group => group.id !== 'disabled')
.sort((a, b) => a.name.localeCompare(b.name));
@ -112,8 +111,17 @@ export default {
return this.app.license + t('settings', '-licensed');
},
author() {
if (typeof this.app.author === 'string') {
return [
{
'@value': this.app.author
}
]
}
if (this.app.author['@value']) {
return [this.app.author];
}
return this.app.author;
return t('settings', 'by') + ' ' + this.app.author;
},
renderMarkdown() {
// TODO: bundle marked as well

View File

@ -45,7 +45,7 @@
</div>
<div id="apps-list" class="installed" v-if="search !== ''">
<div>
<div class="section">
<div></div>
<h2>{{ t('settings', 'Results from other categories') }}</h2>
</div>
@ -95,10 +95,15 @@ export default {
},
searchApps() {
return this.$store.getters.getAllApps
.filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1)
.filter(app => {
if (app.name.toLowerCase().search(this.search.toLowerCase()) !== -1) {
return (!this.apps.find(_app => _app.id === app.id));
}
return false;
});
},
groups() {
console.log(this.$store.getters.getGroups);
return this.$store.getters.getGroups
.filter(group => group.id !== 'disabled')
.sort((a, b) => a.name.localeCompare(b.name));

View File

@ -23,7 +23,6 @@
<template>
<div class="section" v-bind:class="{ selected: isSelected }">
<div class="app-image app-image-icon" v-on:click="showAppDetails">
{{ isSelected }}
<div v-if="!app.preview" class="icon-settings-dark"></div>
<img v-if="!app.previewAsIcon && app.preview" :src="app.preview" width="100%" />
<svg v-if="app.previewAsIcon && app.preview" width="32" height="32" viewBox="0 0 32 32">