Skip to content

Commit a317cf7

Browse files
joshtrichardsAndyScherzinger
authored andcommitted
fix(settings): sort app list by status bucket and app name
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent ea30ac2 commit a317cf7

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

apps/settings/src/components/AppList.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,12 @@ export default {
226226
const apps = [...this.$store.getters.getAllApps, ...exApps]
227227
.filter((app) => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1)
228228
.sort(function(a, b) {
229-
const natSortDiff = OC.Util.naturalSortCompare(a, b)
230-
if (natSortDiff === 0) {
231-
const sortStringA = '' + (a.active ? 0 : 1) + (a.update ? 0 : 1)
232-
const sortStringB = '' + (b.active ? 0 : 1) + (b.update ? 0 : 1)
233-
return Number(sortStringA) - Number(sortStringB)
229+
const statusA = (a.active ? 0 : 2) + (a.update ? 0 : 1)
230+
const statusB = (b.active ? 0 : 2) + (b.update ? 0 : 1)
231+
if (statusA !== statusB) {
232+
return statusA - statusB
234233
}
235-
return natSortDiff
234+
return OC.Util.naturalSortCompare(a.name, b.name)
236235
})
237236
238237
if (this.category === 'installed') {

0 commit comments

Comments
 (0)