forked from freifunk-franken/docs
add infrastructure for hardware database
To keep device information consistent, use a small per device database embedded in the frontmatter of the device page source. Device information is extracted from the database and formatted into tables with the provided shortcodes The data can then further be used to build comparison tables and filters for specific usecases. New devices should make use of the provided archetype, which provides an example of most used fields: ``` hugo new content/hardware/my-device.md ``` Fixes: #5
This commit is contained in:
parent
6b56b1a9a9
commit
28031bd3d7
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
hardware:
|
||||
manufacturer: MFG
|
||||
model: Model
|
||||
chip: SoC
|
||||
recommended: true
|
||||
cores: 2
|
||||
threads: 4
|
||||
clock: 1000
|
||||
ram: 262144
|
||||
flash: 262144
|
||||
serial:
|
||||
- ttl
|
||||
- usb
|
||||
- rj45
|
||||
interface:
|
||||
- dev: eth0
|
||||
type: rj45
|
||||
speed: 1000
|
||||
features: [ 24V, dsa, PD ]
|
||||
roleL3: wan
|
||||
roleNode: wan
|
||||
- dev: eth1
|
||||
type: rj45
|
||||
speed: 1000
|
||||
features: [ 802.3af, dsa ]
|
||||
roleL3: client
|
||||
roleNode: client
|
||||
- dev: eth4
|
||||
type: sfp
|
||||
speed: 1000
|
||||
features: [ ]
|
||||
roleL3: client
|
||||
roleNode: batman
|
||||
- dev: wifi2
|
||||
type: 2ghz
|
||||
speed: 150
|
||||
features: [ "n", 1T, 1R ]
|
||||
- dev: wifi5
|
||||
type: 5ghz
|
||||
speed: 866
|
||||
features: [ ac, 2T, 2R ]
|
||||
benchmark:
|
||||
benchmark1: measurement
|
||||
---
|
||||
|
||||
## Spezifikation
|
||||
{{< detailsofhardware >}}
|
|
@ -4,4 +4,4 @@ bookCollapseSection: true
|
|||
date: 2022-12-01T17:25:00+01:00
|
||||
---
|
||||
|
||||
{{< section >}}
|
||||
{{< tableofhardware >}}
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
{{ $hw := .Page.Params.hardware }}
|
||||
<h3>Datenblatt</h3>
|
||||
{{ with $hw }}
|
||||
<table>
|
||||
<tr>
|
||||
<td>Bezeichnung</td>
|
||||
<td>{{ .manufacturer }} {{ .model }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Empfohlen</td>
|
||||
<td>{{ cond .recommended (emojify ":heavy_check_mark:") (emojify ":x:") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SoC</td>
|
||||
<td>{{ .chip }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CPU</td>
|
||||
<td>{{ .cores }} Core {{ .threads }} Threads @ {{ .clock }} MHz</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RAM</td>
|
||||
<td>{{ div .ram 1024 }}MiB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flash</td>
|
||||
<td>{{ div .flash 1024 }}MiB</td>
|
||||
</tr>
|
||||
{{ with .serial }}
|
||||
<tr>
|
||||
<td>Serielle Schnittstelle</td>
|
||||
<td>{{ delimit . ", " }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ with $hw.interface }}
|
||||
<h3>Schnittstellen</h3>
|
||||
{{ $wired := where . "type" "in" (slice "rj45" "sfp") }}
|
||||
{{ with $wired }}
|
||||
<h4>Kabelgebunden</h4>
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
{{ range . -}}
|
||||
<th>{{ .dev }}</th>
|
||||
{{ end }}
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
{{ range . -}}
|
||||
<td>{{ .speed }}Mbps {{ .type | upper }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ if where . ".features" "intersect" (slice "24V" "802.3af" "802.3at" "PD") }}
|
||||
<tr>
|
||||
<th>PoE</th>
|
||||
{{ range . -}}
|
||||
<td>{{ delimit (intersect .features (slice "24V" "802.3af" "802.3at" "PD")) ", " }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if where . ".features" "intersect" (slice "dsa") }}
|
||||
<tr>
|
||||
<th>DSA Port</th>
|
||||
{{ range . -}}
|
||||
<td>{{ cond (in .features "dsa") (emojify ":heavy_check_mark:") "" }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if where . "roleL3" "!=" nil }}
|
||||
<tr>
|
||||
<th>Belegung L3</th>
|
||||
{{ range . -}}
|
||||
<td>{{ echoParam . "roleL3" }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if where . "roleNode" "!=" nil }}
|
||||
<tr>
|
||||
<th>Belegung Node</th>
|
||||
{{ range . -}}
|
||||
<td>{{ echoParam . "roleNode" }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
|
||||
{{ $wireless := where $hw.interface "type" "in" (slice "2ghz" "5ghz") }}
|
||||
{{ with $wireless }}
|
||||
<h4>Wireless</h4>
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
{{ range . -}}
|
||||
<th>{{ .dev }}</th>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ if where . ".features" "intersect" (slice "bg" "n" "ac" "ax") }}
|
||||
<tr>
|
||||
<th>Standard</th>
|
||||
{{ range . -}}
|
||||
<td>{{ delimit (intersect .features (slice "bg" "n" "ac" "ax")) ", " }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if where . ".speed" "!=" nil }}
|
||||
<tr>
|
||||
<th>Datenrate</th>
|
||||
{{ range . -}}
|
||||
<td>{{ echoParam . "speed" }} Mbit/s</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with $hw.benchmark }}
|
||||
<h4>Benchmarks</h4>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Benchmark</th>
|
||||
<th>Messung</th>
|
||||
</tr>
|
||||
{{ range $b, $m := . }}
|
||||
<tr>
|
||||
<td>{{ $b }}</td>
|
||||
<td>{{ $m }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
|
||||
<!-- test -->
|
||||
<h2>debug :)</h2>
|
||||
{{ template "treeview" .Page.Params.hardware }}
|
||||
{{ define "treeview" }}
|
||||
<ul>
|
||||
{{ range $k, $v := . }}
|
||||
<li>{{ $k }}
|
||||
{{ if (or (reflect.IsMap $v) (reflect.IsSlice $v)) }}{{ template "treeview" $v }}{{ else }}{{ $v }}{{end}}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ highlight (jsonify (dict "indent" "\t") .Page.Params.hardware) "json" }}
|
|
@ -0,0 +1,26 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th>Hersteller</th>
|
||||
<th>Modell</th>
|
||||
<th>DSA Ports</th>
|
||||
<th>Radios</th>
|
||||
<th>Schnittstellen</th>
|
||||
<th>Empfohlen</th>
|
||||
</tr>
|
||||
{{ range $device := where .Page.Pages "Params.hardware" "!=" nil }}
|
||||
{{ $hw := $device.Params.hardware }}
|
||||
<tr>
|
||||
<td>{{ $hw.manufacturer }}</td>
|
||||
<td><a href="{{ $device.RelPermalink }}">{{ $hw.model }}</a></td>
|
||||
<td>{{ where $hw.interface "features" "intersect" (slice "dsa") | len }}</td>
|
||||
<td>{{ where $hw.interface "type" "in" (slice "2ghz" "5ghz") | len }}</td>
|
||||
<td>
|
||||
{{ range $type := slice "sfp" "rj45" "2ghz" "5ghz" }}
|
||||
{{ $n := (where $hw.interface "type" "in" (slice $type) | len) }}
|
||||
{{ if gt $n 0 }}{{ $n }}x<code>{{ $type }}</code>{{ end }}
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>{{ cond $hw.recommended (emojify ":heavy_check_mark:") (emojify ":x:") }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
Loading…
Reference in New Issue