180 lines
8.8 KiB
HTML
180 lines
8.8 KiB
HTML
{{ $scratch := newScratch }}
|
|
{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
|
|
{{ $product := index $productPathData 0 }}
|
|
{{ $currentVersion := index $productPathData 1 }}
|
|
{{ $pageRoot := print $product "/" $currentVersion }}
|
|
{{ $isOSSv2 := in $pageRoot "influxdb/v2" }}
|
|
{{ $isCloud := eq $pageRoot "influxdb/cloud" }}
|
|
{{ $isServerless := eq $pageRoot "influxdb/cloud-serverless" }}
|
|
{{ $isDedicated := eq $pageRoot "influxdb/cloud-dedicated" }}
|
|
{{ $isClustered := eq $pageRoot "influxdb/clustered" }}
|
|
{{ $altLinks := .Page.Params.alt_links | default dict }}
|
|
{{ $sortedProducts := sort .Site.Data.products "list_order" "asc"}}
|
|
|
|
{{/* //////////////////// INFLUXDB PRODUCT DICTIONARIES /////////////////// */}}
|
|
{{ $ossInfo := dict $.Site.Data.products.influxdb.name (dict "path" (print "influxdb/" (index $.Site.Data.products.influxdb.versions 0)) "key" "oss") }}
|
|
{{ $cloudInfo := dict $.Site.Data.products.influxdb_cloud.name (dict "path" "influxdb/cloud" "key" "cloud") }}
|
|
{{ $serverlessInfo := dict $.Site.Data.products.influxdb_cloud_serverless.name (dict "path" "influxdb/cloud-serverless" "key" "cloud-serverless") }}
|
|
{{ $dedicatedInfo := dict $.Site.Data.products.influxdb_cloud_dedicated.name (dict "path" "influxdb/cloud-dedicated" "key" "cloud-dedicated") }}
|
|
{{ $clusteredInfo := dict $.Site.Data.products.influxdb_clustered.name (dict "path" "influxdb/clustered" "key" "clustered") }}
|
|
{{ $influxdbInfo := merge $ossInfo $cloudInfo $serverlessInfo $dedicatedInfo $clusteredInfo }}
|
|
|
|
<div class="dropdown">
|
|
{{ if or (eq $product nil) (eq $product "platform") (eq $product "resources") }}
|
|
<p class="selected">Select product</p>
|
|
{{ else }}
|
|
{{ $scratch.Set "displayName" "" }}
|
|
{{ if $isCloud }}{{ $scratch.Set "displayName" $.Site.Data.products.influxdb_cloud.name}}
|
|
{{ else if $isServerless }}{{ $scratch.Set "displayName" $.Site.Data.products.influxdb_cloud_serverless.name }}
|
|
{{ else if $isDedicated }}{{ $scratch.Set "displayName" $.Site.Data.products.influxdb_cloud_dedicated.name }}
|
|
{{ else if $isClustered }}{{ $scratch.Set "displayName" $.Site.Data.products.influxdb_clustered.name }}
|
|
{{ else }}
|
|
{{ $productData := (index .Site.Data.products $product) }}
|
|
{{ $scratch.Set "displayName" (cond (isset $productData "altname") $productData.altname $productData.name) }}
|
|
{{ end }}
|
|
{{ $displayName := $scratch.Get "displayName" }}
|
|
<p class="selected">{{ $displayName }}</p>
|
|
{{ end }}
|
|
|
|
<ul class="item-list products" data-category="Managed">
|
|
{{ range $sortedProducts }}
|
|
{{ if eq .menu_category "managed" }}
|
|
{{ $isCurrentProduct := and (eq .namespace $product) (in .versions $currentVersion) }}
|
|
{{ if not $isCurrentProduct }}
|
|
{{ $scratch.Set "link" (print "/" .namespace "/" (index .versions 0) "/") }}
|
|
|
|
{{ if eq $product "influxdb" }}
|
|
{{ $replacementPath := index (index $influxdbInfo .name) "path" }}
|
|
{{ $altProductPage := $.GetPage ((replaceRE $pageRoot $replacementPath $.Page.RelPermalink) | replaceRE `\/$` "") }}
|
|
|
|
{{/* ////////////// GET ALT LINKS FROM FRONTMATTER ////////////// */}}
|
|
{{ if (gt (len $altLinks) 0) }}
|
|
{{ $productKey := index (index $influxdbInfo .name) "key" | default "" }}
|
|
{{ if isset $altLinks $productKey }}
|
|
{{ $scratch.Set "link" (index $altLinks $productKey) }}
|
|
{{ else if gt (len $altProductPage.Title) 0 }}
|
|
{{ $scratch.Set "link" $altProductPage.RelPermalink }}
|
|
{{ end }}
|
|
|
|
{{/* ///////////// GET DEFAULT ALT PAGE AT SAME PATH //////////// */}}
|
|
{{ else if gt (len $altProductPage.Title) 0 }}
|
|
{{ $scratch.Set "link" $altProductPage.RelPermalink }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
{{ $scratch.Set "link" "" }}
|
|
{{ end }}
|
|
{{ $link := $scratch.Get "link" }}
|
|
<li>
|
|
<a href='{{ $link }}' {{ if $isCurrentProduct }}class="active"{{ end }}>{{ .name }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
<ul class="item-list products" data-category="Self-managed">
|
|
{{ range $sortedProducts }}
|
|
{{ if eq .menu_category "self-managed" }}
|
|
{{ $isCurrentProduct := and (eq .namespace $product) (in .versions $currentVersion) }}
|
|
|
|
{{ if not $isCurrentProduct }}
|
|
{{ $scratch.Set "link" (print "/" .namespace "/" (index .versions 0) "/") }}
|
|
|
|
{{ if and (eq $product "influxdb") (gt (len (findRE `^influxdb` .namespace)) 0) }}
|
|
{{ $replacementPath := index (index $influxdbInfo .name) "path" }}
|
|
{{ $altProductPage := $.GetPage ((replaceRE $pageRoot $replacementPath $.Page.RelPermalink) | replaceRE `\/$` "") }}
|
|
|
|
{{/* ////////////// GET ALT LINKS FROM FRONTMATTER ////////////// */}}
|
|
{{ if (gt (len $altLinks) 0) }}
|
|
{{ $productKey := index (index $influxdbInfo .name) "key" | default "" }}
|
|
{{ if isset $altLinks $productKey }}
|
|
{{ $scratch.Set "link" (index $altLinks $productKey) }}
|
|
{{ end }}
|
|
|
|
{{/* ///////////// GET DEFAULT ALT PAGE AT SAME PATH //////////// */}}
|
|
{{ else if gt (len $altProductPage.Title) 0 }}
|
|
{{ $scratch.Set "link" $altProductPage.RelPermalink }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
{{ $scratch.Set "link" "" }}
|
|
{{ end }}
|
|
|
|
{{ $link := $scratch.Get "link" }}
|
|
<li>
|
|
<a href='{{ $link }}' {{ if $isCurrentProduct }}class="active"{{ end }}>{{ if .altname }}{{.altname}}{{ else }}{{ .name }}{{ end }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
<ul class="item-list products" data-category="Other products">
|
|
{{ range $sortedProducts }}
|
|
{{ if eq .menu_category "other" }}
|
|
{{ $isCurrentProduct := and (eq .namespace $product) (in .versions $currentVersion) }}
|
|
{{ if not $isCurrentProduct }}
|
|
{{ $scratch.Set "link" (print "/" .namespace "/" (index .versions 0) "/") }}
|
|
|
|
{{ if and (eq $product "influxdb") (gt (len (findRE `^influxdb` .namespace)) 0) }}
|
|
{{ $replacementPath := index (index $influxdbInfo .name) "path" }}
|
|
{{ $altProductPage := $.GetPage ((replaceRE $pageRoot $replacementPath $.Page.RelPermalink) | replaceRE `\/$` "") }}
|
|
|
|
{{/* ////////////// GET ALT LINKS FROM FRONTMATTER ////////////// */}}
|
|
{{ if (gt (len $altLinks) 0) }}
|
|
{{ $productKey := index (index $influxdbInfo .name) "key" | default "" }}
|
|
{{ if isset $altLinks $productKey }}
|
|
{{ $scratch.Set "link" (index $altLinks $productKey) }}
|
|
{{ end }}
|
|
|
|
{{/* ///////////// GET DEFAULT ALT PAGE AT SAME PATH //////////// */}}
|
|
{{ else if gt (len $altProductPage.Title) 0 }}
|
|
{{ $scratch.Set "link" $altProductPage.RelPermalink }} true
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
{{ $scratch.Set "link" "" }}
|
|
{{ end }}
|
|
{{ $link := $scratch.Get "link" }}
|
|
<li>
|
|
<a href='{{ $link }}' {{ if $isCurrentProduct }}class="active"{{ end }}>{{ if .altname }}{{.altname}}{{ else }}{{ .name }}{{ end }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
<ul class="item-list products" data-category="Languages">
|
|
{{ range $sortedProducts }}
|
|
{{ if eq .menu_category "languages" }}
|
|
{{ $isCurrentProduct := and (eq .namespace $product) (in .versions $currentVersion) }}
|
|
{{ if not $isCurrentProduct }}
|
|
{{ $scratch.Set "link" (print "/" .namespace "/" (index .versions 0) "/") }}
|
|
|
|
{{ if and (eq $product "influxdb") (gt (len (findRE `^influxdb` .namespace)) 0) }}
|
|
{{ $replacementPath := index (index $influxdbInfo .name) "path" }}
|
|
{{ $altProductPage := $.GetPage ((replaceRE $pageRoot $replacementPath $.Page.RelPermalink) | replaceRE `\/$` "") }}
|
|
|
|
{{/* ////////////// GET ALT LINKS FROM FRONTMATTER ////////////// */}}
|
|
{{ if (gt (len $altLinks) 0) }}
|
|
{{ $productKey := index (index $influxdbInfo .name) "key" | default "" }}
|
|
{{ if isset $altLinks $productKey }}
|
|
{{ $scratch.Set "link" (index $altLinks $productKey) }}
|
|
{{ end }}
|
|
|
|
{{/* ///////////// GET DEFAULT ALT PAGE AT SAME PATH //////////// */}}
|
|
{{ else if gt (len $altProductPage.Title) 0 }}
|
|
{{ $scratch.Set "link" $altProductPage.RelPermalink }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
{{ $scratch.Set "link" "" }}
|
|
{{ end }}
|
|
{{ $link := $scratch.Get "link" }}
|
|
<li>
|
|
<a href='{{ $link }}' {{ if $isCurrentProduct }}class="active"{{ end }}>{{ if .altname }}{{.altname}}{{ else }}{{ .name }}{{ end }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|