- include SMB drop-ins from /etc/samba/smb.conf.d into the generated smb.conf - keep smbd/nfs-server running while other services (/etc/exports.d, drop-ins) share, instead of disabling them when nasmon has no shares of its own - list those shares read-only on /shares - settings: RepoISO URL; poll its /api/integration/status, dashboard card, menu link, alerts for portal down, stale worker, failed jobs, unmounted publications Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,9 @@ import (
|
||||
"io/fs"
|
||||
"log"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -105,6 +107,7 @@ type pageData struct {
|
||||
Data any
|
||||
Flash string
|
||||
Error string
|
||||
RepoISO string // browser URL of the RepoISO portal ("" = integration off)
|
||||
}
|
||||
|
||||
// render writes a full page, or only the "content" block when ?partial=1 is
|
||||
@@ -112,6 +115,7 @@ type pageData struct {
|
||||
func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, pd pageData) {
|
||||
pd.Page = name
|
||||
pd.Partial = r.URL.Query().Get("partial") == "1"
|
||||
pd.RepoISO = browserURL(s.cfg.Get().Integrations.RepoISOURL, r.Host)
|
||||
if pd.Alerts == 0 {
|
||||
pd.Alerts = len(s.sch.Status().Alerts)
|
||||
}
|
||||
@@ -288,3 +292,33 @@ func sparkline(vals []float64, max float64, class string) template.HTML {
|
||||
`<svg class="spark %s" viewBox="0 0 %d %d" preserveAspectRatio="none"><polygon points="0,%d %s %d,%d"/><polyline points="%s"/></svg>`,
|
||||
class, int(w), int(h), int(h), p, int(w), int(h), p))
|
||||
}
|
||||
|
||||
// browserURL turns the configured RepoISO address into one the user's browser
|
||||
// can open: a loopback host is replaced by the host the browser used for nasmon.
|
||||
func browserURL(cfg, reqHost string) string {
|
||||
if cfg == "" {
|
||||
return ""
|
||||
}
|
||||
u, err := url.Parse(cfg)
|
||||
if err != nil || u.Host == "" {
|
||||
return cfg
|
||||
}
|
||||
switch u.Hostname() {
|
||||
case "127.0.0.1", "localhost", "::1":
|
||||
host := reqHost
|
||||
if h, _, err := net.SplitHostPort(reqHost); err == nil {
|
||||
host = h
|
||||
}
|
||||
if host == "" {
|
||||
return cfg
|
||||
}
|
||||
if strings.Contains(host, ":") {
|
||||
host = "[" + host + "]"
|
||||
}
|
||||
if p := u.Port(); p != "" {
|
||||
host += ":" + p
|
||||
}
|
||||
u.Host = host
|
||||
}
|
||||
return u.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user