Mouseover title with actual datetime when last checked for updates

This commit is contained in:
Arjan H
2020-04-14 11:52:19 +02:00
parent cf6042efa8
commit 26ff625487
2 changed files with 17 additions and 11 deletions

View File

@@ -285,7 +285,8 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
if err == nil {
checkUpdates(false)
dashboardData["UpdateAvailable"] = updateAvailable
dashboardData["UpdateChecked"] = humanize.RelTime(updateChecked, time.Now(), "", "")
dashboardData["UpdateChecked"] = strings.Replace(updateChecked.Format("02-Jan-2006 15:04:05 MST"), "+0000", "GMT", -1)
dashboardData["UpdateCheckedRel"] = humanize.RelTime(updateChecked, time.Now(), "", "")
render(w, r, "dashboard", dashboardData)
}
@@ -847,17 +848,20 @@ func (res *Result) ManageComponents(w http.ResponseWriter, r *http.Request, acti
func _checkUpdatesHandler(w http.ResponseWriter, r *http.Request) {
res := struct {
Success bool
UpdateAvailable bool
UpdateChecked string
Versions []string
Descriptions []string
Errors map[string]string
Success bool
UpdateAvailable bool
UpdateChecked string
UpdateCheckedRel string
Versions []string
Descriptions []string
Errors map[string]string
}{Success: true, Errors: make(map[string]string)}
res.Versions, res.Descriptions = checkUpdates(true)
res.UpdateAvailable = updateAvailable
res.UpdateChecked = humanize.RelTime(updateChecked, time.Now(), "", "")
res.UpdateChecked = updateChecked.Format("02-Jan-2006 15:04:05 MST")
res.UpdateChecked = strings.Replace(res.UpdateChecked, "+0000", "GMT", -1)
res.UpdateCheckedRel = humanize.RelTime(updateChecked, time.Now(), "", "")
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(res)
@@ -964,7 +968,8 @@ func _manageGet(w http.ResponseWriter, r *http.Request) {
checkUpdates(false)
manageData["UpdateAvailable"] = updateAvailable
manageData["UpdateChecked"] = humanize.RelTime(updateChecked, time.Now(), "", "")
manageData["UpdateChecked"] = strings.Replace(updateChecked.Format("02-Jan-2006 15:04:05 MST"), "+0000", "GMT", -1)
manageData["UpdateCheckedRel"] = humanize.RelTime(updateChecked, time.Now(), "", "")
components := _parseComponents(getLog(w, r, "components"))
for i := 0; i < len(components); i++ {

View File

@@ -50,7 +50,7 @@
<button class="btn btn-outline btn-wide btn-success mt5" type="button" id="version-check" title="Check if there is a newer version available">Check for updates</button>
<span id="update-checked-span">
<br/>
Last checked: <span id="update-last-checked">{{ $.UpdateChecked }}</span>
Last checked: <span id="update-last-checked" title="{{ $.UpdateChecked }}">{{ $.UpdateCheckedRel }}</span>
</span>
{{ end }}
</td>
@@ -659,7 +659,8 @@
}]
});
}
$("#update-last-checked").text(data.UpdateChecked)
$("#update-last-checked").attr("title", data.UpdateChecked)
$("#update-last-checked").text(data.UpdateCheckedRel)
}
})