diff --git a/cmd/dkl-local-server/ws-download-set.go b/cmd/dkl-local-server/ws-download-set.go index 1bf5734..bfc2ee1 100644 --- a/cmd/dkl-local-server/ws-download-set.go +++ b/cmd/dkl-local-server/ws-download-set.go @@ -262,14 +262,17 @@ func wsDownloadSet(req *restful.Request, resp *restful.Response) { for _, item := range set.Items { names := make([]string, 0) + section := "" switch item.Kind { case "cluster": + section = "Cluster" for _, c := range cfg.Clusters { if globMatch(item.Name, c.Name) { names = append(names, c.Name) } } case "host": + section = "Host" for _, h := range cfg.Hosts { if globMatch(item.Name, h.Name) { names = append(names, h.Name) @@ -278,12 +281,22 @@ func wsDownloadSet(req *restful.Request, resp *restful.Response) { } for _, name := range names { - fmt.Fprintf(buf, "

%s %s

", strings.Title(item.Kind), name) - fmt.Fprintf(buf, "

\n") + buf.WriteString("

") + fmt.Fprintf(buf, "%s %s:", section, name) + buf.WriteString(" ") for _, asset := range item.Assets { - fmt.Fprintf(buf, " %s\n", item.Kind, name, asset, setStr, asset) + for _, v := range hostAssetVariants(asset) { + url := fmt.Sprintf("/public/download-set/%s/%s/%s", item.Kind, name, v.url) + if strings.Contains(url, "?") { + url += "&" + } else { + url += "?" + } + url += "set=" + setStr + fmt.Fprintf(buf, " %s\n", url, v.name) + } } - fmt.Fprintf(buf, `

`) + buf.WriteString("

\n") } } diff --git a/cmd/dkl-local-server/ws-downloads.go b/cmd/dkl-local-server/ws-downloads.go index 54b8991..b22a549 100644 --- a/cmd/dkl-local-server/ws-downloads.go +++ b/cmd/dkl-local-server/ws-downloads.go @@ -188,11 +188,15 @@ func wsDownloadPage(req *restful.Request, resp *restful.Response) { buf := new(bytes.Buffer) buf.WriteString(htmlHeader(fmt.Sprintf("Token assets: %s %s", spec.Kind, spec.Name))) - buf.WriteString("