Skip to content

Commit

Permalink
Merge pull request #10 from Financial-Times/panicguidelinks
Browse files Browse the repository at this point in the history
Only link to Panic Guide when a URL is given
  • Loading branch information
lucas42 authored May 25, 2017
2 parents bc27ed1 + d9c2412 commit e7ccca0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion v1_1/check.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package v1_1

import "time"
import (
"strings"
"time"
)

type Check struct {
ID string
Expand All @@ -20,6 +23,7 @@ func (ch *Check) runChecker() CheckResult {
BusinessImpact: ch.BusinessImpact,
TechnicalSummary: ch.TechnicalSummary,
PanicGuide: ch.PanicGuide,
PanicGuideIsLink: strings.HasPrefix(ch.PanicGuide, "http"),
LastUpdated: time.Now(),
}
out, err := ch.Checker()
Expand Down
3 changes: 2 additions & 1 deletion v1_1/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func writeHTMLResp(w http.ResponseWriter, health HealthResult) error {
<li> Severity: {{ $value.Severity }} </li>
<li> Business impact: {{ $value.BusinessImpact }} </li>
<li> Technical summary: {{ $value.TechnicalSummary }} </li>
<li> Panic guide: <a href="{{ $value.PanicGuide }}">{{ $value.PanicGuide }}</a> </li>
{{if $value.PanicGuideIsLink }}<li> Panic guide: <a href="{{ $value.PanicGuide }}">{{ $value.PanicGuide }}</a> </li>
{{ else }}<li> Panic guide: <pre>{{ $value.PanicGuide }}</pre> </li>{{ end }}
<li> Output: {{ $value.CheckOutput }} </li>
<li> Last updated: {{ $value.LastUpdated }} </li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions v1_1/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type CheckResult struct {
CheckOutput string `json:"checkOutput"`
LastUpdated time.Time `json:"lastUpdated"`
Ack string `json:"ack,omitempty"`
PanicGuideIsLink bool `json:"-"`
}

type HealthResult struct {
Expand Down

0 comments on commit e7ccca0

Please sign in to comment.