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

Show all the devfiles when no devfile.yaml in the git repo #2943

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
2 changes: 1 addition & 1 deletion src/webview/git-import/app/gitImport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export class GitImport extends React.Component<DefaultProps, {
{!isDevFile &&
<div className='strategyContainer strategyWarning'>
<ErrorIcon color='warning' style={{ fontSize: 20 }} />
<Typography variant='body2' style={{ margin: '0 5px' }}>Here is the recommended devfile:</Typography>
<Typography variant='body2' style={{ margin: '0 5px' }}> {compDescription?.length > 1 ? 'Please select a devfile that corresponds to the language/framework that you are using' : 'Here is the recommended devfile:'} </Typography>
</div>}
<div className='cardContainer'>
<div className='devfileGalleryGrid'>
Expand Down
5 changes: 5 additions & 0 deletions src/webview/git-import/gitImportLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ async function parseGitURL(event: any) {
} else {
closeWithMessage('Devfile version not supported, Unable to proceed the component creation', clonedFolder);
}
} else {
compDescriptions = getCompDescription(analyzeRes);
}
} finally {
panel?.webview.postMessage({
Expand Down Expand Up @@ -306,6 +308,9 @@ function validateGitURL(event: any) {

function getCompDescription(devfiles: AnalyzeResponse[]): ComponentTypeDescription[] {
const compDescriptions = ComponentTypesView.instance.getCompDescriptions();
if (devfiles.length === 0) {
return Array.from(compDescriptions);
}
return Array.from(compDescriptions).filter(({ name, version, registry }) => devfiles.some((res) => res.devfile === name &&
res.devfileVersion === version && res.devfileRegistry === registry.name));
}
Expand Down