Skip to content

Commit

Permalink
Registry: put 'offical' languages first in dropdown (open-telemetry#3844
Browse files Browse the repository at this point in the history
)

Signed-off-by: svrnm <[email protected]>
Co-authored-by: Phillip Carter <[email protected]>
  • Loading branch information
2 people authored and jaydeluca committed Jan 31, 2024
1 parent d829c7d commit 601d86a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data/registry/tools-cpp-alpine-apk.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: Alpine Linux Packages for OpenTelemetry C++
registryType: core exporter
registryType: core
language: cpp
tags:
- cpp
Expand Down
30 changes: 25 additions & 5 deletions layouts/shortcodes/ecosystem/registry/search-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@
{{ $languageNames.Set "js" "JavaScript" -}}
{{ $languageNames.Set "php" "PHP" -}}

{{ $officialLanguages := slice "collector" "cpp" "erlang" "elixir" "dotnet" "go" "java" "js" "php" "python" "ruby" "rust" "swift" -}}


{{ $langs := slice -}}
{{ range $registry -}}
{{ $language := .language -}}
{{ $langs = $langs | append $language -}}
{{- $val := (dict
"name" .language
"isOfficial" (in $officialLanguages .language)
)
-}}
{{ $langs = $langs | append $val -}}
{{ if ne $language (lower $language) -}}
{{ errorf "Language keys must be in lowercase. Registry entry '%s' has the following invalid key: %s" .title $language -}}
{{ end -}}
{{ end -}}
{{ $langs = $langs | uniq | sort -}}
{{ $langs = sort ($langs | uniq) "name" -}}

{{ $types := slice -}}
{{ range $registry -}}
Expand Down Expand Up @@ -53,9 +60,22 @@
<button class="btn btn-outline-secondary dropdown-toggle" id="languageDropdown" type="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Language</button>
<div class="dropdown-menu" id="languageFilter">
<a value="all" class="dropdown-item">Any Language</a>
{{ range $langs -}}
<a value="{{ . }}" id="language-item-{{ . }}" class="dropdown-item">{{ $languageNames.Get . | default (humanize .) }}</a>
<li><a value="all" class="dropdown-item">Any Language</a></li>
<li><hr class="dropdown-divider"></li>
{{ range (where $langs "isOfficial" true) -}}
<li>
<a value="{{ .name }}" id="language-item-{{ .name }}" class="dropdown-item">
{{ $languageNames.Get .name | default (humanize .name) }}
</a>
</li>
{{ end -}}
<li><hr class="dropdown-divider"></li>
{{ range (where $langs "isOfficial" false) -}}
<li>
<a value="{{ .name }}" id="language-item-{{ .name }}" class="dropdown-item">
{{ $languageNames.Get .name | default (humanize .name) }}
</a>
</li>
{{ end -}}
</div>

Expand Down

0 comments on commit 601d86a

Please sign in to comment.