Closed iocanel closed 8 months ago
Should only display the selected templates, however this seems to be broken at the moment.
It should only display the extensions set as default values BUT will it be possible to select more ? @iocanel
No, it should prevent users from seeing or selecting anything that does not match the filters.
filter: extensions:
Was this filter parameter working before ? Which project ? @iocanel
No, it should prevent users from seeing or selecting anything that does not match the filters.
Why don't we then, int this case, convert the existing ui into an enum as you force the user to use the fixed list of extensions instead of what we got from code.quarkus.io ? @iocanel
Because this approach allows us to use wildcards, filtering by category and filtering by keyword.
Should only display the selected templates
Can you elaborate a little as the wording seems wrong ? Why do you speak about templates here ? @iocanel
The error which is reported by the browser's console is about =>
This is because the ui:options
of the template don't specify the codeQuarkusUrl
. This problem is fixed if we specify it like this:
ui:options:
codeQuarkusUrl: https://code.quarkus.io
filter:
extensions:
- io.quarkus:quarkus-resteasy-reactive-jackson
- io.quarkus:quarkus-smallrye-openapi
- io.quarkus:quarkus-smallrye-graphql
- io.quarkus:quarkus-hibernate-orm-rest-data-panache
@iocanel
I got such a warning without using the ui:options + filter
BUT i don't know if this is blocking or not ...
useAutocomplete.js:249 Material-UI: The value provided to useAutocomplete is invalid.
None of the options match with `{"id":"io.quarkus:quarkus-resteasy-reactive","name":"RESTEasy Reactive"}`.
You can use the `getOptionSelected` prop to customize the equality test.
at QuarkusExtensionList (webpack-internal:///../../node_modules/@qshift/plugin-quarkus/dist/index.esm.js:142:33)
at eval (webpack-internal:///../../node_modules/@backstage/plugin-scaffolder-react/dist/alpha.esm.js:663:47)
at div
at FormControl (webpack-internal:///../../node_modules/@material-ui/core/esm/FormControl/FormControl.js:84:24)
at WithStyles (webpack-internal:///../../node_modules/@material-ui/styles/esm/withStyles/withStyles.js:64:31)
at ScaffolderField (webpack-internal:///../../node_modules/@backstage/plugin-scaffolder-react/dist/alpha.esm.js:529:5)
at div
at WrapIfAdditionalTemplate (webpack-internal:///../../node_modules/@rjsf/material-ui/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js:19:13)
at FieldTemplate (webpack-internal:///../../node_modules/@backstage/plugin-scaffolder-react/dist/alpha.esm.js:562:5)
at SchemaFieldRender (webpack-internal:///../../node_modules/@rjsf/core/lib/components/fields/SchemaField.js:74:21)
at SchemaField (webpack-internal:///../../node_modules/@rjsf/core/lib/components/fields/SchemaField.js:178:1)
See discussion: https://stackoverflow.com/questions/62494672/what-is-getoptionselected-and-getoptionlabel-in-material-ui-with-an-example
If I understand well the problem, when the values evaluated within the function filterExtension
of matchingCategory
, matchingName
, matchingKeywords
are all equal to TRUE, then the extension should be added to the list = quarkusExtensions
, otherwise they should be skipped
Correct ? @iocanel
Problem is fixed but extensions should be filtered Remark: User cannot selected others extensions except what it is displayed within the list
The codestart url should be made optional and default to https://code.quarkus.io if one not specified.
The codestart url should be made optional and default to https://code.quarkus.io if one not specified.
This is another thing to be fixed later. Let's fix this issue first ;-)
If we sort the options => options: quarkusExtensions.sort((a, b) => a.name.localeCompare(b.name)),
then the result looks like this
Do you know why we have twice some extensions ? @iocanel
This is another thing to be fixed later. Let's fix this issue first ;-)
Fixed using such a syntax
const codeQuarkusUrl = (uiSchema ?? {})['ui:options']?.codeQuarkusUrl ?? 'https://code.quarkus.io';
const apiUrl = `${codeQuarkusUrl}/api/extensions`
@iocanel
If we sort the options =>
options: quarkusExtensions.sort((a, b) => a.name.localeCompare(b.name)),
then the result looks like thisDo you know why we have twice some extensions ? @iocanel
No, i can't say I do. I've seen in before but I don't recall how I worked around that.
Maybe add some logic to enforce uniqueness.
Maybe add some logic to enforce uniqueness.
https://stackoverflow.com/questions/2218999/how-to-remove-all-duplicates-from-an-array-of-objects
I will create a PR @iocanel =>
Adding something like:
Should only display the provided extensions, however this seems to be broken at the moment.
Note: Extensions may be provided using wildcards