Add package update count and reboot pending to host server info card
This commit is contained in:
1 parent
a21bf2c215
commit
2c0da87fac
2 files changed
+74
-2
No files matched your search
+22
-2
@@ -125,8 +125,19 @@ if cgi.params.key?("content")
|
||||
html << %(<div>)
|
||||
|
||||
if server
|
||||
srv_stats = []
|
||||
if updates = server["updates"]
|
||||
cls = updates == 0 ? "ok" : "warn"
|
||||
srv_stats << [cls, "#{updates} update#{updates == 1 ? "" : "s"}"]
|
||||
end
|
||||
if server["reboot_pending"]
|
||||
srv_stats << ["warn", "Reboot pending"]
|
||||
end
|
||||
srv_cls = srv_stats.any? { |c, _| c == "bad" } ? "bad" :
|
||||
srv_stats.any? { |c, _| c == "warn" } ? "warn" : "ok"
|
||||
|
||||
html << %(<div class="section-label">Server</div>)
|
||||
html << %(<div class="card ok"><div class="card-header"><span class="card-title">Server Info</span></div><div class="subitems">)
|
||||
html << %(<div class="card #{srv_cls}"><div class="card-header"><span class="card-title">Server Info</span></div><div class="subitems">)
|
||||
|
||||
if server["os_name"]
|
||||
html << <<~HTML
|
||||
@@ -178,7 +189,16 @@ if cgi.params.key?("content")
|
||||
HTML
|
||||
end
|
||||
|
||||
html << %(</div></div>)
|
||||
html << %(</div>)
|
||||
|
||||
if srv_stats.any?
|
||||
srv_stats_html = srv_stats.map { |c, txt|
|
||||
%(<span class="stat #{c}">#{CGI.escapeHTML(txt)}</span>)
|
||||
}.join
|
||||
html << %(<div class="drive-stats" style="margin-top:0.45rem;padding:0 0.6rem;">#{srv_stats_html}</div>)
|
||||
end
|
||||
|
||||
html << %(</div>)
|
||||
end
|
||||
|
||||
if filesystems.any?
|
||||
|
||||
Reference in new issue
Block a user