mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
change search strategy and add app description in checked values
This commit is contained in:
parent
6210eef3a9
commit
f28f26ecc7
1 changed files with 2 additions and 11 deletions
|
@ -160,7 +160,6 @@ export default {
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
searchAppsKeys: ['id', 'state', 'manifest.name'],
|
|
||||||
qualityOptions: [
|
qualityOptions: [
|
||||||
{ value: 'isHighQuality', text: this.$i18n.t('only_highquality_apps') },
|
{ value: 'isHighQuality', text: this.$i18n.t('only_highquality_apps') },
|
||||||
{ value: 'isDecentQuality', text: this.$i18n.t('only_decent_quality_apps') },
|
{ value: 'isDecentQuality', text: this.$i18n.t('only_decent_quality_apps') },
|
||||||
|
@ -201,11 +200,6 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
filteredApps () {
|
filteredApps () {
|
||||||
const search = this.search.toLowerCase()
|
const search = this.search.toLowerCase()
|
||||||
function findValue (key, obj) {
|
|
||||||
if (!key.includes('.')) return obj[key]
|
|
||||||
// deep search in nested keys
|
|
||||||
return key.split('.').reduce((obj, key) => obj[key], obj)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.quality === 'all' && this.category === 'all' && search === '') {
|
if (this.quality === 'all' && this.category === 'all' && search === '') {
|
||||||
return this.apps
|
return this.apps
|
||||||
|
@ -223,11 +217,7 @@ export default {
|
||||||
if (!appMatchSubtag) return false
|
if (!appMatchSubtag) return false
|
||||||
}
|
}
|
||||||
if (search === '') return true
|
if (search === '') return true
|
||||||
const searchMatchSome = this.searchAppsKeys.some(searchKey => {
|
if (app.searchValues.includes(search)) return true
|
||||||
return findValue(searchKey, app).toLowerCase().includes(search)
|
|
||||||
})
|
|
||||||
// app match search string
|
|
||||||
if (searchMatchSome) return true
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -270,6 +260,7 @@ export default {
|
||||||
app.maintained = app.maintained ? 'maintained' : 'orphaned'
|
app.maintained = app.maintained ? 'maintained' : 'orphaned'
|
||||||
}
|
}
|
||||||
app.color = this.getColor(app)
|
app.color = this.getColor(app)
|
||||||
|
app.searchValues = [app.id, app.state, app.manifest.name.toLowerCase(), app.manifest.description.toLowerCase()].join(' ')
|
||||||
apps.push(app)
|
apps.push(app)
|
||||||
}
|
}
|
||||||
this.apps = apps.sort((a, b) => a.id > b.id ? 1 : -1)
|
this.apps = apps.sort((a, b) => a.id > b.id ? 1 : -1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue