Merge pull request #23275 from nextcloud/fix/dashboard-statuses-sort

Fix dashboard statuses sort
This commit is contained in:
Roeland Jago Douma 2020-10-08 15:23:09 +02:00 committed by GitHub
commit e10cad4a71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -180,7 +180,7 @@ export default {
return (status) => !(status in this.enabledStatuses) || this.enabledStatuses[status] return (status) => !(status in this.enabledStatuses) || this.enabledStatuses[status]
}, },
sortedAllStatuses() { sortedAllStatuses() {
return Object.keys(this.allCallbacksStatus).slice().sort((a, b) => a > b) return Object.keys(this.allCallbacksStatus).slice().sort(this.sortStatuses)
}, },
sortedPanels() { sortedPanels() {
return Object.values(this.panels).sort((a, b) => { return Object.values(this.panels).sort((a, b) => {
@ -193,7 +193,7 @@ export default {
}) })
}, },
sortedRegisteredStatus() { sortedRegisteredStatus() {
return this.registeredStatus.slice().sort((a, b) => a > b) return this.registeredStatus.slice().sort(this.sortStatuses)
}, },
}, },
watch: { watch: {
@ -352,6 +352,15 @@ export default {
} }
this.saveStatuses() this.saveStatuses()
}, },
sortStatuses(a, b) {
const al = a.toLowerCase()
const bl = b.toLowerCase()
return al > bl
? 1
: al < bl
? -1
: 0
},
handleScroll() { handleScroll() {
if (window.scrollY > 70) { if (window.scrollY > 70) {
document.body.classList.add('dashboard--scrolled') document.body.classList.add('dashboard--scrolled')