fixed categorical values view
This commit is contained in:
parent
0c73b3af4b
commit
9894fac8ea
2 changed files with 27 additions and 20 deletions
|
@ -38,34 +38,38 @@ GoWatch {{ .Watch.Name }}
|
||||||
</canvas>
|
</canvas>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $first := true }}
|
||||||
{{ if .categoricalMap }}
|
{{ if .categoricalMap }}
|
||||||
<ul class="nav nav-tabs" id="categoricalTab" role="tablist">
|
<ul class="nav nav-tabs" id="categoricalTab" role="tablist">
|
||||||
{{ range $name, $values := .categoricalMap }}
|
{{ range $name, $values := .categoricalMap }}
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link active" id="{{ $name }}-tab" data-bs-toggle="tab" data-bs-target="#{{ $name }}-tab-pane" type="button" role="tab" aria-controls="{{ $name }}-tab-pane" aria-selected="true">{{ $name }}</button>
|
<button class="nav-link {{ if $first }}active{{ end }}" id="{{ $name }}-tab" data-bs-toggle="tab" data-bs-target="#{{ $name }}-tab-pane" type="button" role="tab" aria-controls="{{ $name }}-tab-pane" aria-selected="{{ if $first }}true{{ else }}false{{ end }}">{{ $name }}</button>
|
||||||
</li>
|
</li>
|
||||||
|
{{ $first = false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content" id="categoricalTabContent">
|
<div class="tab-content" id="categoricalTabContent">
|
||||||
|
{{ $first = true }}
|
||||||
{{ range $name, $values := .categoricalMap }}
|
{{ range $name, $values := .categoricalMap }}
|
||||||
<div class="tab-pane fade show active" id="{{ $name }}-tab-pane" role="tabpanel" aria-labelledby="{{ $name }}-tab" tabindex="0">
|
<div class="tab-pane {{ if $first }}active{{ end }}" id="{{ $name }}-tab-pane" role="tabpanel" aria-labelledby="{{ $name }}-tab" tabindex="0">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>When</th>
|
<th>When</th>
|
||||||
<th>Value</th>
|
<th>Value</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{ range $value := $values }}
|
{{ range $value := $values }}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $value.Time.Format "2006-01-02 15:04:05" }}</td>
|
<td>{{ $value.Time.Format "2006-01-02 15:04:05" }}</td>
|
||||||
<td>{{ $value.Value }}</td>
|
<td>{{ $value.Value }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{{ $first = false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -714,7 +714,10 @@ func (web *Web) watchView(c *gin.Context) {
|
||||||
numericalMap[value.Name] = append(numericalMap[value.Name], value)
|
numericalMap[value.Name] = append(numericalMap[value.Name], value)
|
||||||
} else {
|
} else {
|
||||||
// probably very inefficient to prepend, but want newest values at the top
|
// probably very inefficient to prepend, but want newest values at the top
|
||||||
categoricalMap[value.Name] = append([]*FilterOutput{value}, categoricalMap[value.Name]...)
|
valueName := strings.ReplaceAll(value.Name, " ", "_")
|
||||||
|
valueName = strings.ToLower(valueName)
|
||||||
|
categoricalMap[valueName] = append([]*FilterOutput{value}, categoricalMap[valueName]...)
|
||||||
|
log.Println(categoricalMap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue