Skip to content

Commit

Permalink
Add a configurable alert to convey shutdown info (#1078)
Browse files Browse the repository at this point in the history
Add the ability to display a bootstrap 5 alert to convey shutdown
information to users. The alert visibility and message are controlled
via the config file.
  • Loading branch information
ian-noaa committed Sep 29, 2023
2 parents 11720e9 + 15dc7fb commit 35485a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion home/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ First, you'll need a settings file like so in `MATS/home`:
"config": {
"is_met_express": false,
"is_production": false,
"environment_label": "Development"
"environment_label": "Development",
"alert_message": "Lorem ipsum dolor shutdown amet..."
},
"groups": [
{
Expand Down
1 change: 1 addition & 0 deletions home/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ConfigJSON struct {
IsMETexpress bool `json:"is_met_express"`
IsProduction bool `json:"is_production"`
EnvironmentLabel string `json:"environment_label"`
AlertMessage string `json:"alert_message"`
} `json:"config"`
Groups []struct {
Name string `json:"name"`
Expand Down
9 changes: 9 additions & 0 deletions home/templates/alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Mostly used to convey government shutdowns -->

<div class="container-fluid p-3" style="background-color: #dddddd">
<div class="alert alert-danger" role="alert">
<!-- <p>{{ .Config.AlertMessage }}</p> -->
<!-- When congress hands out shutdown lemons, sometimes you need to make shutdown lemonade :-) -->
<marquee>{{ .Config.AlertMessage }}</marquee>
</div>
</div>
4 changes: 4 additions & 0 deletions home/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<div id="main" class="container-fluid">
{{ template "navbar.html" . }}

{{ if .Config.AlertMessage }}
{{ template "alert.html" . }}
{{ end }}

{{ if .Config.IsMETexpress }}
{{ else }}
{{ template "toggles.html" . }}
Expand Down

0 comments on commit 35485a7

Please sign in to comment.