mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
applist: fix apps label and name
This commit is contained in:
parent
372942d5e3
commit
a90cc5f160
1 changed files with 2 additions and 19 deletions
|
@ -68,25 +68,8 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const multiInstances = {}
|
this.apps = apps.map(({ id, name, description, manifest }) => {
|
||||||
this.apps = apps.map(({ id, name, description, permissions, manifest }) => {
|
return { id, name: manifest.name, label: name, description }
|
||||||
// FIXME seems like some apps may no have a label (replace with id)
|
|
||||||
const label = permissions[id + '.main'].label
|
|
||||||
// Display the `id` of the instead of its `name` if multiple apps share the same name
|
|
||||||
if (manifest.multi_instance) {
|
|
||||||
if (!(name in multiInstances)) {
|
|
||||||
multiInstances[name] = []
|
|
||||||
}
|
|
||||||
const labels = multiInstances[name]
|
|
||||||
if (labels.includes(label)) {
|
|
||||||
name = id
|
|
||||||
}
|
|
||||||
labels.push(label)
|
|
||||||
}
|
|
||||||
if (label === name) {
|
|
||||||
name = null
|
|
||||||
}
|
|
||||||
return { id, name, description, label }
|
|
||||||
}).sort((prev, app) => {
|
}).sort((prev, app) => {
|
||||||
return prev.label > app.label ? 1 : -1
|
return prev.label > app.label ? 1 : -1
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue