aceberg/miniboard

View on GitHub
internal/web/templates/index.html

Summary

Maintainability
Test Coverage
{{ define "index" }}
<!--Auto refresh (seconds)-->
    <meta http-equiv="refresh" content="{{ .Config.WebRefresh }}">
</head>
<body>
    <div class="container">
        <br>
        <div class="row">
            {{ range .Panels }}
            {{ if $.Horiz }}
            <a href="/panel_edit/?edit={{ .Name }}"><h5>{{ .Name }}</h5></a>
            <div class="gap-3 hstack flex-wrap">
            {{ else }}
            <div class="col-md-auto">
                <a class="text-center" href="/panel_edit/?edit={{ .Name }}"><h5>{{ .Name }}</h5></a>
            {{ end }}
                {{ $scan:= .Scan }}
                {{ range .Hosts }}
                <p>{{ if .URL }}
                <a href="{{ .URL }}" target="_blank">
                {{ else }}
                <a href="http://{{ .Addr }}:{{ .Port }}" target="_blank">
                {{ end }}
                    <button class="btn btn-primary my-btn-width" type="button">
                        {{ if .Icon }}
                        <img src="{{ .Icon }}" style="height:1.3em;"/>&nbsp;
                        {{ end }}
                        {{ .Name }}
                    </button>
                </a>
                {{ if $scan }}
                <a href="http://{{ .Addr }}:{{ .Port }}" target="_blank">
                    <button class="btn btn-primary">
                        {{ if .State }}
                        <i class="bi bi-circle-fill my-col-on"></i>
                        {{ else }}
                        <i class="bi bi-circle-fill my-col-off"></i>
                        {{ end }}
                    </button>
                </a>
                {{ end }}
                </p>
                {{ end }}
            </div>
            {{ end }}
        </div>
    </div>

{{ template "footer" }}
{{ end }}