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

collection filter - hardcode default tags for insights mode #4857

Merged
merged 3 commits into from
Feb 15, 2024
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
17 changes: 8 additions & 9 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
src/index.html
*.json
.*.sw[po]
*.xml
*.sh
Dockerfile
.DS_Store
*.md
*.png
*.mp4
*.png
*.po
*.sh
*.xml
.*.sw[po]
.DS_Store
.eslintrc
Dockerfile
test/cypress.env.json.template
test/cypress/fixtures/
test/cypress/e2e/*/compose.env
.eslintrc
test/cypress/fixtures/
1 change: 1 addition & 0 deletions CHANGES/3073.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
insights: hardcode list of default filter tags
34 changes: 27 additions & 7 deletions src/components/collection-list/collection-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,34 @@ const loadRepos = (inputText) =>
})),
);

// insights-only
const defaultTags = [
'application',
'cloud',
'database',
'eda',
'infrastructure',
'linux',
'monitoring',
'networking',
'security',
'storage',
'tools',
'windows',
].map((tag) => ({ id: tag, title: tag }));

const loadTags = (inputText) =>
TagAPI.listCollections({ name__icontains: inputText, sort: '-count' }).then(
({ data: { data } }) =>
data.map(({ name, count }) => ({
id: name,
title: count === undefined ? name : t`${name} (${count})`,
})),
);
!inputText && IS_INSIGHTS
? Promise.resolve(defaultTags)
: TagAPI.listCollections({
name__icontains: inputText,
sort: '-count',
}).then(({ data: { data } }) =>
data.map(({ name, count }) => ({
id: name,
title: count === undefined ? name : t`${name} (${count})`,
})),
);

export const collectionFilter = ({
featureFlags: { display_signatures, display_repositories },
Expand Down
16 changes: 8 additions & 8 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.applicationName %></title>
</head>
<body>
<div id="root"></div>
</body>
<head>
<meta charset="UTF-8" />
<title><%= htmlWebpackPlugin.options.applicationName %></title>
</head>
<body>
<div id="root"></div>
</body>
</html>
Loading