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

View file

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