Skip to content

Commit fd1ea8d

Browse files
Show all the devfiles when no devfile.yaml in the git repo (#2943)
* show all the devfiles when no devfile.yaml in the repo Signed-off-by: msivasubramaniaan <[email protected]> * changed recommendation message Signed-off-by: msivasubramaniaan <[email protected]> * updated the message strin Signed-off-by: msivasubramaniaan <[email protected]> --------- Signed-off-by: msivasubramaniaan <[email protected]>
1 parent 9c0b457 commit fd1ea8d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/webview/git-import/app/gitImport.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ export class GitImport extends React.Component<DefaultProps, {
469469
{!isDevFile &&
470470
<div className='strategyContainer strategyWarning'>
471471
<ErrorIcon color='warning' style={{ fontSize: 20 }} />
472-
<Typography variant='body2' style={{ margin: '0 5px' }}>Here is the recommended devfile:</Typography>
472+
<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>
473473
</div>}
474474
<div className='cardContainer'>
475475
<div className='devfileGalleryGrid'>

src/webview/git-import/gitImportLoader.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ async function parseGitURL(event: any) {
238238
} else {
239239
closeWithMessage('Devfile version not supported, Unable to proceed the component creation', clonedFolder);
240240
}
241+
} else {
242+
compDescriptions = getCompDescription(analyzeRes);
241243
}
242244
} finally {
243245
panel?.webview.postMessage({
@@ -306,6 +308,9 @@ function validateGitURL(event: any) {
306308

307309
function getCompDescription(devfiles: AnalyzeResponse[]): ComponentTypeDescription[] {
308310
const compDescriptions = ComponentTypesView.instance.getCompDescriptions();
311+
if (devfiles.length === 0) {
312+
return Array.from(compDescriptions);
313+
}
309314
return Array.from(compDescriptions).filter(({ name, version, registry }) => devfiles.some((res) => res.devfile === name &&
310315
res.devfileVersion === version && res.devfileRegistry === registry.name));
311316
}

0 commit comments

Comments
 (0)