Skip to content

Commit

Permalink
fix: update catalog ordering and search fields
Browse files Browse the repository at this point in the history
* quickstarts are now sorted alphanumerically by the title field
* catalog search now compares against title instead of name, to align
with the internal catalog.
* catalog search now includes summary
aswanson-nr committed Sep 20, 2021

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 24277d4 commit ba1e216
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pages/instant-observability.js
Original file line number Diff line number Diff line change
@@ -51,14 +51,20 @@ const stringIncludes = (substring) => (fullstring) =>
* @param {String} search Search term.
* @returns {(Function) => Boolean} Callback function to be used by filter.
*/
const filterBySearch = (search) => ({ name, description, keywords }) => {
const filterBySearch = (search) => ({
title,
summary,
description,
keywords,
}) => {
if (!search) {
return true;
}

const searchIncludes = stringIncludes(search);
return (
searchIncludes(name) ||
searchIncludes(title) ||
searchIncludes(summary) ||
searchIncludes(description) ||
keywords.some(searchIncludes)
);
@@ -152,7 +158,8 @@ const QuickstartsPage = ({ data, location }) => {

const quickstarts = data.allQuickstarts.nodes;

const sortedQuickstarts = sortFeaturedQuickstarts(quickstarts);
const alphaSort = quickstarts.sort((a, b) => a.title.localeCompare(b.title));
const sortedQuickstarts = sortFeaturedQuickstarts(alphaSort);

const filteredQuickstarts = sortedQuickstarts
.filter(filterBySearch(search))

0 comments on commit ba1e216

Please sign in to comment.