updated telegraf plugin shortcode to version the plugin list

pull/1345/head^2
Scott Anderson 2020-07-30 17:36:06 -06:00
parent e0b506bf75
commit 773d55d795
3 changed files with 18 additions and 15 deletions

View File

@ -139,7 +139,7 @@
&:after { &:after {
content: attr(data-count); content: attr(data-count);
margin-left: .25rem; margin-left: 0;
font-size: .85rem; font-size: .85rem;
opacity: .5; opacity: .5;
} }

View File

@ -1,2 +1 @@
stable_version: v2.0 stable_version: v2.0
telegraf_version: 1.15.0

View File

@ -1,20 +1,24 @@
{{ $type := .Get "type" }} {{ $type := .Get "type" }}
{{ $telegrafVersion := replaceRE `\.[^.]*$` "" .Site.Data.versions.telegraf_version }} {{ $pathData := findRE "[^/]+.*?" .Page.RelPermalink }}
{{ $currentTelegrafVersion := replaceRE `v` "" (index $pathData 1) }}
{{ range (index .Site.Data.telegraf_plugins $type ) }} {{ range (index .Site.Data.telegraf_plugins $type ) }}
{{ $pluginTags := delimit .tags " " }} {{ $pluginTags := delimit .tags " " }}
{{ $minorVer := replaceRE `\.[^.]*$` "" .introduced }} {{ $minorVer := replaceRE `\.[^.]*$` "" .introduced }}
<div class="plugin-card visible{{ if eq $minorVer $telegrafVersion }} new{{ end }}" id="{{ .id }}" data-tags="{{ $type }} {{ lower $pluginTags }} {{ if eq $minorVer $telegrafVersion }}new{{ end }} {{ if .deprecated }}deprecated{{ end }} "> <!-- Only include plugins available for the current viewed version -->
<div class="info"> {{ if ge $currentTelegrafVersion $minorVer}}
<h3 id="{{ .id }}">{{ .name }}</h3> <div class="plugin-card visible{{ if eq $minorVer $currentTelegrafVersion }} new{{ end }}" id="{{ .id }}" data-tags="{{ $type }} {{ lower $pluginTags }} {{ if eq $minorVer $currentTelegrafVersion }}new{{ end }} {{ if .deprecated }}deprecated{{ end }} ">
<p class="meta"> <div class="info">
Plugin ID: <code>{{ $type }}s.{{ .id }}</code><br/> <h3 id="{{ .id }}">{{ .name }}</h3>
Telegraf {{ if not .deprecated }}{{ .introduced }}+{{ else }}{{ .introduced }} - {{ .deprecated }} <span class="deprecated">Deprecated</span>{{ end }} <p class="meta">
</p> Plugin ID: <code>{{ $type }}s.{{ .id }}</code><br/>
<p>{{ .description | markdownify | safeHTML }}</p> Telegraf {{ if not .deprecated }}{{ .introduced }}+{{ else }}{{ .introduced }} - {{ .deprecated }} <span class="deprecated">Deprecated</span>{{ end }}
</p>
<p>{{ .description | markdownify | safeHTML }}</p>
</div>
<a class="btn github-link" href="{{ if .link }}{{ .link }}{{ else }}https://github.com/influxdata/telegraf/blob/release-{{ $currentTelegrafVersion }}/plugins/{{ $type }}s/{{ .id }}/README.md{{ end }}" target="_blank">
<span class="icon-github"></span> <span class="hide">View</span>
</a>
</div> </div>
<a class="btn github-link" href="{{ if .link }}{{ .link }}{{ else }}https://github.com/influxdata/telegraf/blob/release-{{ $telegrafVersion }}/plugins/{{ $type }}s/{{ .id }}/README.md{{ end }}" target="_blank"> {{ end }}
<span class="icon-github"></span> <span class="hide">View</span>
</a>
</div>
{{ end }} {{ end }}