Maintenance Mode Feature

From floodzilla-wiki
Jump to navigation Jump to search

This document describes the current proposal for reworking how "Maintenance Mode" works for gages.

Stage 1: Object Model

I propose that we should have three flags for determining the status of a gage:

  • IsRetired
  • IsTestOnly
  • IsOffline
IsRetired

We will store:

boolean IsRetired
Date DateRetired
IsTestOnly

This flag is the opposite of the current IsPublic flag, and will be defaulted to be the opposite of IsPublic for all gages. We will store:

boolean IsTestOnly
Date DateMadePublic
IsOffline

This is mostly equivalent to the current IsOfflien flag, only with additional information. We will store:

boolean IsOffline
Date DateOffline
string OfflineReason (maintenance, malfunction, season)
POSSIBLY: string ExpectedReturnTime

These new flags will be implemented entirely separate from the existing flags (except that IsOffline will be reused). No "magic" will happen -- the existing flags and these new flags will be separately controllable initially.

The existing flags will be marked as Deprecated.

The new flags will be added to the API, but the client will not be changed during this stage.

Stage 2: Admin Tools

All actions specified in this section will be logged in the Site Log feature of the admin site and in the #site-logbook Slack channel.

IsRetired

We will add a "Retire Gage" button to the Edit Location page. This button will allow the admin to enter a date when the gage was retired (defaults to today). If a gage is retired, the button will be "Reinstatate Gage", and it will clear the DateRetired.

No existing flags will be changed when this flag is set.

IsTestOnly

Newly-added locations will be marked as IsTestOnly. The Edit Location page will get a button "Make Gage Public", which will record the date/time when the button was pressed. If a gage is already not TestOnly, the button will be "Make Gage TestOnly".

The existing IsPublic flag will be set to the opposite of IsTestOnly, so the existing client will show/hide it correctly.

IsOffline

The "Take Gage Offline" button from the Readings page, and a new "Take Gage Offline" button on Edit Location, will allow the user to choose a reason from a dropdown. If we want the "expected fix time" feature, there will be a TEXT field (not a date/time) for the admin to fill in an expected resolution time. For offline gages, a "Take Gage Offline" button will clear the IsOffline flag.

Stage 3: Main site

Once the admin tools are updated and the new fields are being set when we manipulate gages, we will update the main site to use the new flags. Expected functionality:

If a gage is IsTestOnly, it will ONLY show if the user is an Administrator. It will have a special icon/status. OPEN ISSUE: Show these on front page or on "All Gages" only?

If a gage is IsOffline, it will always still show on the front page, even if no data has arrived in the last 12 hours. It will have a special icon/status. The "offline reason" will be shown -- somewhere (spec TBD).

If a gage is Retired, it will show on the "All Gages" view, but not on the main front page. Selecting the gage will show the existing Gage Details page, and the user can choose a historical date to see historical data. When we implement "historical date views" for the main page, the gage will appear if it has data for any part of the selected date range. In any case, the gage will have a special icon/status.

Stage 4: Cleanup

After everything is updated to use the new flags, the now-deprecated flags/code will be removed from the database and site. We will retain any existing Site Log entries for gage changes that were done before this feature was implemented.