Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registry: put 'offical' languages first in dropdown #3844

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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