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

Implement clickable flag buttons to filter records without updating search term #5611

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
4 changes: 4 additions & 0 deletions assets/js/registrySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let selectedLanguage = 'all';
let selectedComponent = 'all';
let selectedFlag = 'all'; // Added selectedFlag


basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
parseUrlParams();

if (pathName.includes('registry')) {
Expand Down Expand Up @@ -144,6 +145,7 @@ function showBody() {
}
}


basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
// Runs search through Fuse for fuzzy search
function executeSearch(searchQuery) {
if (searchQuery === '') {
Expand All @@ -160,7 +162,9 @@ function executeSearch(searchQuery) {
const run = function (searchQuery) {
// The 0-timeout is here if search is blocking, such that the "search loading" is rendered properly
setTimeout(() => {

basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
let results = miniSearch.search(searchQuery);

basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
document.getElementById('search-loading').style.display = 'none';

if (results.length > 0) {
Expand Down
23 changes: 13 additions & 10 deletions layouts/partials/ecosystem/registry/entry.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{ $languageNames := .languageNames -}}

{{ with .value -}}
{{
{{
$remoteRegistries := dict
"npm" (dict
"npm" (dict
"urlPattern" "https://npmjs.com/package/%s"
"installTemplate" "ecosystem/registry/quickinstall/default.md"
"installLine" "npm install %s"
Expand Down Expand Up @@ -116,16 +116,19 @@ <h4 class="card-title mb-0 d-flex flex-row">
<span class="badge rounded-pill text-bg-info"><i class="fa-regular fa-star"></i> new</span>
{{ end -}}
{{ if $isNative -}}
<span class="badge rounded-pill text-bg-success text-white"><i class="fa-solid fa-puzzle-piece"></i> native</span>
<a href="/ecosystem/registry?flag=native" class="badge rounded-pill text-bg-success text-white" title="Click to filter by native tag">
basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
<i class="fa-solid fa-puzzle-piece"></i> native</a>
{{ end -}}
{{ if $isFirstParty -}}
<span class="badge rounded-pill text-bg-success text-white"><i class="fa-solid fa-heart"></i> first party integration</span>
<a href="/ecosystem/registry?flag=first_party" class="badge rounded-pill text-bg-success text-white" title="Click to filter by first party tag">
basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
<i class="fa-solid fa-heart"></i> first party integration</a>
{{ end -}}
{{ if $usedInDemo -}}
<span class="badge rounded-pill text-bg-secondary text-white" title="This package is used in the OpenTelemetry Demo!"><i class="fa-solid fa-shapes"></i> OTel Demo</span>
{{ end -}}
{{ if $deprecated -}}
<span class="badge rounded-pill text-bg-danger text-white" title=""><i class="fa-solid fa-ban"></i> deprecated</span>
<a href="/ecosystem/registry?flag=deprecated" class="badge rounded-pill text-bg-danger text-white" title="Click to filter by deprecated tag">
basiratkareem marked this conversation as resolved.
Show resolved Hide resolved
<i class="fa-solid fa-ban"></i> deprecated</a>
{{ end -}}
{{ if .cncfProjectLevel -}}
<span class="badge rounded-pill text-bg-primary text-white" title="CNCF {{ .cncfProjectLevel}} Project">
Expand All @@ -136,7 +139,7 @@ <h4 class="card-title mb-0 d-flex flex-row">
</h4>
<p class="card-text">
<small class="text-body-secondary">
by
by
{{ range $index, $author := .authors -}}
{{ if $index }}, {{ end }}
{{ if eq $author.name "OpenTelemetry Authors" -}}
Expand Down Expand Up @@ -191,7 +194,7 @@ <h6><i class="fa-solid fa-forward"></i> Quick Install</h6>
{{ .package.version }}
</div>
<small>Version</small>
</div>
</div>
</li>
{{- end -}}
{{ with .language -}}
Expand All @@ -201,7 +204,7 @@ <h6><i class="fa-solid fa-forward"></i> Quick Install</h6>
{{ $languageNames.Get . | default (humanize .) }}
</div>
<small>Language</small>
</div>
</div>
</li>
{{- end }}
{{ with .registryType -}}
Expand All @@ -211,7 +214,7 @@ <h6><i class="fa-solid fa-forward"></i> Quick Install</h6>
{{ . | humanize }}
</div>
<small>Component</small>
</div>
</div>
</li>
{{- end -}}
{{ with .license -}}
Expand All @@ -221,7 +224,7 @@ <h6><i class="fa-solid fa-forward"></i> Quick Install</h6>
{{ . }}
</div>
<small>License</small>
</div>
</div>
</li>
{{- end -}}
</div>
Expand Down
Loading