diff --git a/app/src/helpers/filters/human.js b/app/src/helpers/filters/human.js index 050f70ba..bdad91e9 100644 --- a/app/src/helpers/filters/human.js +++ b/app/src/helpers/filters/human.js @@ -4,3 +4,10 @@ export function humanSize (bytes) { const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))) return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i] } + + +export function humanPermissionName (text) { + return text.split('.')[1].replace('_', ' ').replace(/\w\S*/g, part => { + return part.charAt(0).toUpperCase() + part.substr(1).toLowerCase() + }) +} diff --git a/app/src/views/app/AppInfo.vue b/app/src/views/app/AppInfo.vue index b27e8ef1..b9bfb972 100644 --- a/app/src/views/app/AppInfo.vue +++ b/app/src/views/app/AppInfo.vue @@ -25,7 +25,7 @@
{{ $t('app_info_access_desc') }}
- {{ app.permissions.length > 0 ? app.permissions.join(', ') + '.' : $t('nobody') }}
+ {{ allowedGroups.length > 0 ? allowedGroups.join(', ') + '.' : $t('nobody') }}
{{ description }}
@@ -61,14 +61,9 @@ export default { filteredApps () { if (!this.apps) return const search = this.search.toLowerCase() - const keys = ['id', 'name', 'description'] const match = (item) => item.toLowerCase().includes(search) - return this.apps.filter(app => { - if (match(app.settings.label)) return true - for (const key of keys) { - if (match(app[key])) return true - } - }) + // Check if any value in apps (label, id, name, description) match the search query. + return this.apps.filter(app => Object.values(app).some(match)) } }, @@ -76,7 +71,10 @@ export default { fetchData () { api.get('apps?full').then(({ apps }) => { if (apps.length === 0) this.apps = null - this.apps = apps.sort((prev, app) => { + this.apps = apps.map(({ id, name, description, permissions }) => { + // FIXME seems like some apps may no have a label (replace with id) + return { id, name, description, label: permissions[id + '.main'].label } + }).sort((prev, app) => { return prev.id > app.id ? 1 : -1 }) })