Show tokens that have expired
This commit is contained in:
parent
b654198e3f
commit
f9d4206bab
3 changed files with 14 additions and 6 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
func addFuncMap(t *template.Template) {
|
||||
funcMap := template.FuncMap{
|
||||
"bigNumber": bigNumber,
|
||||
"hasPassed": hasPassed,
|
||||
"html": unescapeHTML,
|
||||
"json": unescapeJS,
|
||||
"GISStatement": gisStatement,
|
||||
|
|
@ -62,6 +63,10 @@ func timeAsRelativeDate(d time.Time) string {
|
|||
return d.Format("01-02")
|
||||
}
|
||||
|
||||
func hasPassed(t time.Time) bool {
|
||||
return t.Before(time.Now())
|
||||
}
|
||||
|
||||
// FormatTimeDuration returns a human-readable string representing a time.Duration
|
||||
// as "X units early" or "X units late"
|
||||
func timeDelta(d time.Duration) string {
|
||||
|
|
|
|||
|
|
@ -69,13 +69,17 @@
|
|||
<tr>
|
||||
<td width="30%"><strong>OAuth Token Status</strong></td>
|
||||
<td>
|
||||
{{ if .ArcGISOAuth.InvalidatedAt.IsNull }}
|
||||
<span class="status-active">
|
||||
<i class="bi bi-check-circle-fill me-1"></i> Active
|
||||
{{ if not .ArcGISOAuth.InvalidatedAt.IsNull }}
|
||||
<span class="status-inactive">
|
||||
<i class="bi bi-x-circle-fill me-1"></i> Invalidated
|
||||
</span>
|
||||
{{ else if hasPassed .ArcGISOAuth.AccessTokenExpires }}
|
||||
<span class="status-inactive">
|
||||
<i class="bi bi-x-circle-fill me-1"></i> Expired
|
||||
</span>
|
||||
{{ else }}
|
||||
<span class="status-inactive">
|
||||
<i class="bi bi-x-circle-fill me-1"></i> Active
|
||||
<span class="status-active">
|
||||
<i class="bi bi-check-circle-fill me-1"></i> Active
|
||||
</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/arcgis"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue