-
Couldn't load subscription status.
- Fork 66
feat: mutiple backends for recipes #3114
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -289,9 +289,14 @@ export class CatalogManager extends Publisher<ApplicationCatalog> implements Dis | |
| result = res; | ||
| break; | ||
| } | ||
| case 'tools': | ||
| result = result.filter(r => values.includes(r.backend ?? '')); | ||
| case 'tools': { | ||
| let res: Recipe[] = []; | ||
| for (const value of values) { | ||
| res = [...res, ...result.filter(r => r.backends?.includes(value))]; | ||
| } | ||
| result = res; | ||
| break; | ||
| } | ||
| case 'frameworks': { | ||
| let res: Recipe[] = []; | ||
| for (const value of values) { | ||
|
|
@@ -325,13 +330,13 @@ export class CatalogManager extends Publisher<ApplicationCatalog> implements Dis | |
| choices.tools = this.filterRecipes(subfilters).choices.tools; | ||
| } else { | ||
| choices.tools = result | ||
| .map(r => r.backend) | ||
| .flatMap(r => r.backends) | ||
| .filter(b => b !== undefined) | ||
| .filter((value, index, array) => array.indexOf(value) === index) | ||
| .sort((a, b) => a.localeCompare(b)) | ||
|
Comment on lines
+333
to
336
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remark (non-blocking): non related to this PR, but this filtering chain is unreadable, what is |
||
| .map(t => ({ | ||
| name: t, | ||
| count: result.filter(r => r.backend === t).length, | ||
| count: result.filter(r => r.backends?.includes(t)).length, | ||
| })); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I don't understand what this code is doing? can we add a comment? filtering result? shallow copy?