github.com/zppinho/prow@v0.0.0-20240510014325-1738badeb017/pkg/spyglass/lenses/restcoverage/template.html (about)

     1  {{define "header"}}
     2    <link rel="stylesheet" type="text/css" href="style.css">
     3    <script type="text/javascript" src="script_bundle.min.js"></script>
     4  {{end}}
     5  
     6  {{ define "body" }}
     7  {{ $warnTh := .Thresholds.Warning }}
     8  {{ $errorTh := .Thresholds.Error }}
     9  <div id="report-brief">
    10    <span class="info">
    11        Total coverage:
    12        <span class="info-highlight {{ if le .Percent $errorTh }}error{{ else if le .Percent $warnTh }}warn{{ end }}">
    13         {{ printf "%.2f" .Percent }}&#37;
    14        </span>
    15        , unique hits: {{ .UniqueHits }}, expected unique hits: {{ .ExpectedUniqueHits }}
    16    </span>
    17    <span id="report-expander">details</span><i class="material-icons" style="font-size: 1em; vertical-align: middle;">unfold_more</i>
    18  </div>
    19  <div id="report" class="hidden">
    20    <ul id="paths">
    21    {{ range $uri, $methods := .Endpoints }}
    22      <li class="path">{{ $uri }}
    23        <ul class="methods">
    24        {{ range $method, $stats := $methods }}
    25          <li class="method">
    26            <span {{ if le $stats.Percent $errorTh }} class="error" {{ else if le $stats.Percent $warnTh }} class="warn" {{ end }}>
    27            {{ $method }}: {{ if $stats.Percent }}{{ printf "%.2f" $stats.Percent }}{{ else }}{{ $stats.Percent }}{{ end }}&#37;
    28            </span>
    29            {{ if or $stats.Params.Body.Root.Items $stats.Params.Query.Root.Items }}
    30            <i class="material-icons" style="font-size: 1em; vertical-align: middle;">arrow_drop_down</i>
    31            {{ end }}
    32            <span class="method-not-called error">{{ if not $stats.MethodCalled }}not called{{ end }}</span>
    33          </li>
    34          <li class="hidden">
    35            <ul class="params">
    36              {{ if $stats.Params.Query.Root.Items }}
    37              <li {{if not $stats.Params.Query.Root.Hits }} class="error" {{ end }}>
    38                  <span class="param-type">query</span>
    39                  {{ template "params" $stats.Params.Query.Root }}
    40              </li>
    41              {{ end }}
    42              {{ if $stats.Params.Body.Root.Items }}
    43              <li {{if not $stats.Params.Body.Root.Hits }} class="error" {{ end }}>
    44                <span class="param-type">body</span>
    45                {{ template "params" $stats.Params.Body.Root }}
    46              </li>
    47              {{ end }}
    48            </ul>
    49          </li>
    50        {{ end }}
    51        </ul>
    52      </li>
    53    {{ end }}
    54    </ul>
    55  </div>
    56  {{ end }}
    57  
    58  {{ define "params" }}
    59    {{ if .Items }}
    60    <ul class="params">
    61      {{ range $n, $v := .Items }}
    62        <li {{ if not $v.Hits }} class="error" {{ end }}>
    63        {{ $n }}: {{ $v.Hits }}
    64        {{ if $v.Items }}
    65          {{ template "params" $v }}
    66        {{ end }}
    67        </li>
    68      {{ end }}
    69    </ul>
    70    {{ end }}
    71  {{ end }}