Skip to content

Commit

Permalink
Merge pull request #5732 from pulumi/thoward/native-provider-package-…
Browse files Browse the repository at this point in the history
…search-special-case

Add special case to package search logic for native providers.
  • Loading branch information
thoward authored Oct 17, 2024
2 parents b41d6e2 + 09ee3a1 commit 0523de1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions themes/default/theme/src/ts/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,26 @@ const filterByTextAndTags = (filters, filterText) => {

const packageType = el.attr("data-type");
const packageCategory = el.attr("data-category");
const packageIsNative = packageType === "native-provider";
let packageIsNative = packageType === "native-provider";

const packageHasSelectedType =
!!filters.find(f => f.group === "type" && f.value === packageType) || (filters.find(f => f.group === "type" && f.value === "provider") && packageIsNative);
const packageHasSelectedCategory = !!filters.find(f => f.group === "category" && f.value === packageCategory);

const packageTitle = el.attr("data-title");
const downcasedPackageTitle = packageTitle.toLowerCase();
const downcasedFilterText = filterText?.trim().toLowerCase();
let downcasedFilterText = filterText?.trim().toLowerCase();


let packageIsAMatch;

// hack to include anything marked as native as responsive to a filter text including the word "native"
// see https://github.com/pulumi/registry/issues/5715 for reasoning
if (downcasedFilterText.includes("native")) {
downcasedFilterText = downcasedFilterText.replace(/native/g, "");
packageIsNative = true;
}

if (downcasedFilterText === AMAZON_STRING || downcasedFilterText === AWS_STRING){
packageIsAMatch = downcasedPackageTitle.includes(AMAZON_STRING) || downcasedPackageTitle.includes(AWS_STRING);
} else if (downcasedFilterText === GOOGLE_CLOUD_STRING || downcasedFilterText === GCP_STRING || downcasedFilterText === GOOGLE_STRING){
Expand Down

0 comments on commit 0523de1

Please sign in to comment.