ks888 / LambStatus

[Maintenance mode] Serverless Status Page System
https://lambstatus.github.io
Apache License 2.0
1.3k stars 119 forks source link

scheduled maintenance ordering #120

Closed stevenolen closed 6 years ago

stevenolen commented 6 years ago

Hey! Awesome project, thank you!

I noticed when scheduling two maintenances that the ordering can feel very odd (eg. the ordering is based on the createdAt field, rather than the startAt field). The natural idea here feels like having the maintenance that is most pressing/approaching soonest should be listed first.

I don't have much experience with frontend code in order to actually make this a configurable setting, but can offer a one-line patch if this would generally useful idea:

diff --git a/packages/frontend/src/reducers/maintenances.js b/packages/frontend/src/reducers/maintenances.js
index 431f0e8..64e5c8f 100644
--- a/packages/frontend/src/reducers/maintenances.js
+++ b/packages/frontend/src/reducers/maintenances.js
@@ -4,7 +4,7 @@ import { LIST_MAINTENANCES, LIST_MAINTENANCE, ADD_MAINTENANCE, EDIT_MAINTENANCE,
 function listMaintenancesHandler (state = { }, action) {
   const maintenances = action.maintenances
   maintenances.sort((a, b) => {
-    return a.createdAt < b.createdAt
+    return a.startAt > b.startAt
   })

   return Object.assign({}, state, {
ks888 commented 6 years ago

Thank you for your suggestion and sorry for my late reply. Yes, especially in the status page, it's better to sort the unfinished maintenance by soonest-first order. I'm not sure the best order for the admin page, though.

I've created the pull request https://github.com/ks888/LambStatus/pull/123 which:

Further suggestions are welcome!

ks888 commented 6 years ago

I believe the main ordering issue is solved, so let me close this issue.

stevenolen commented 6 years ago

perfect, thank you so much!!