From d5c02fc627e87a301eb4d7e9ff6466f05424773d Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 11 Oct 2022 01:59:47 +0800 Subject: [PATCH] Update Maintenance list order by status --- src/pages/ManageMaintenance.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/ManageMaintenance.vue b/src/pages/ManageMaintenance.vue index 28bea9b82..5820aadad 100644 --- a/src/pages/ManageMaintenance.vue +++ b/src/pages/ManageMaintenance.vue @@ -83,6 +83,13 @@ export default { data() { return { selectedMaintenanceID: undefined, + statusOrderList: { + "under-maintenance": 1000, + "scheduled": 900, + "inactive": 800, + "ended": 700, + "unknown": 0, + } }; }, computed: { @@ -90,7 +97,11 @@ export default { let result = Object.values(this.$root.maintenanceList); result.sort((m1, m2) => { - return m1.title.localeCompare(m2.title); + if (this.statusOrderList[m1.status] === this.statusOrderList[m2.status]) { + return m1.title.localeCompare(m2.title); + } else { + return this.statusOrderList[m1.status] < this.statusOrderList[m2.status]; + } }); return result;