Sort apps by a proper hierarchical order (active, update, name)

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-08-10 13:56:14 +02:00
parent 1abf0717df
commit e74181b84b
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 3 additions and 7 deletions

View File

@ -92,13 +92,9 @@ export default {
let apps = this.$store.getters.getAllApps let apps = this.$store.getters.getAllApps
.filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1) .filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1)
.sort(function (a, b) { .sort(function (a, b) {
if (a.active !== b.active) { const sortStringA = '' + (a.active ? 0 : 1) + (a.update ? 0 : 1) + a.name;
return (a.active ? -1 : 1) const sortStringB = '' + (b.active ? 0 : 1) + (b.update ? 0 : 1) + b.name;
} return OC.Util.naturalSortCompare(sortStringA, sortStringB);
if (a.update !== b.update) {
return (a.update ? -1 : 1)
}
return OC.Util.naturalSortCompare(a.name, b.name);
}); });
if (this.category === 'installed') { if (this.category === 'installed') {