cachethq / core

🚦 The core of Cachet, the open-source status page system.
https://cachethq.io
MIT License
149 stars 32 forks source link

Time-controlled status for Planned Maintenances / Schedules #111

Open swoga opened 1 week ago

swoga commented 1 week ago

A practical extension for Planned Maintenances / Schedules would be the automatic time-controlled determination of the status.

condition status
now < scheduled_at Upcoming
now > scheduled_at and now < completed_at In Progress
now > completed_at Complete

This would be useful to announce maintenance carried out by third parties, where you only get information about the planned start and end.

I tried to hack this feature together, but I'm not versed enough with Laravel to implement this properly.

jbrooksuk commented 1 week ago

Yeah, I guess we don't really need a status field for maintenance when it can be deduced from the timestamps themselves, right?

Or, are you thinking this would be an option?

swoga commented 1 week ago

At first I thought of an additional option so as not to change any existing behavior (currently probably not relevant as there is no release yet). I also tried to implement it this way with an additional dummy status “Timed” where the real status is determined from time, but the code gets messy.

A purely time-controlled status would be sufficient for my (and most?) purposes. Would also fit better with the name "Schedules". One could still adjust the start and end time if one wants to change the status manually (such as the premature completion of a maintenance).

So my vote would be for pure time control and removal of the manual status field.

jbrooksuk commented 1 week ago

This should be simple enough to change. We remove the status field from the table and add an attribute to Schedule model that determines the status by matching the scheduled_at and completed_at fields. I can't remember off the top of my head how we pull schedules from the database, whether we use the status or the timestamps, but that'd be easy to change anyway.

@swoga do you fancy giving this a go?

swoga commented 1 week ago

I will give it a try!

jbrooksuk commented 1 week ago

That's presuming that a scheduled_at and completed_at is enough data to be usable?