File tree Expand file tree Collapse file tree 2 files changed +37
-24
lines changed
src/webview/create-component Expand file tree Collapse file tree 2 files changed +37
-24
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,10 @@ export default class CreateComponentLoader {
235235 action : 'cloneFailed' ,
236236 } ) ;
237237 } else {
238+ void CreateComponentLoader . panel . webview . postMessage ( {
239+ action : 'devfileExists' ,
240+ data : await isDevfileExists ( tmpFolder ) ,
241+ } ) ;
238242 CreateComponentLoader . getRecommendedDevfile ( tmpFolder ) ;
239243 }
240244 break ;
@@ -283,11 +287,13 @@ export default class CreateComponentLoader {
283287 await fse . copy ( tmpFolder . fsPath , componentFolder ) ;
284288 }
285289 const devfileType = getDevfileType ( message . data . devfileDisplayName ) ;
286- await OdoImpl . Instance . createComponentFromLocation (
287- devfileType ,
288- componentName ,
289- Uri . file ( componentFolder ) ,
290- ) ;
290+ if ( ! await isDevfileExists ( Uri . file ( componentFolder ) ) ) {
291+ await OdoImpl . Instance . createComponentFromLocation (
292+ devfileType ,
293+ componentName ,
294+ Uri . file ( componentFolder ) ,
295+ ) ;
296+ }
291297 await sendTelemetry ( 'newComponentCreated' , {
292298 strategy,
293299 component_type : devfileType ,
Original file line number Diff line number Diff line change 88 AccordionDetails ,
99 AccordionSummary ,
1010 Alert ,
11+ Box ,
1112 Button ,
1213 CircularProgress ,
1314 Divider ,
@@ -331,17 +332,21 @@ export function FromExistingGitRepo({ setCurrentView }) {
331332 ? 'Selected Devfile'
332333 : 'Recommended Devfile' }
333334 </ Typography >
334- < DevfileRecommendationInfo />
335+ { recommendedDevfile . isDevfileExistsInRepo ? (
336+ < Alert severity = "info" >
337+ The Devfile that exists in the repo will be used
338+ </ Alert >
339+ ) : (
340+ < DevfileRecommendationInfo />
341+ ) }
335342 </ Stack >
336- { ! recommendedDevfile . noRecommendation && (
337- < DevfileListItem
338- devfile = {
339- selectedDevfile
340- ? selectedDevfile
341- : recommendedDevfile . devfile
342- }
343- />
344- ) }
343+ < DevfileListItem
344+ devfile = {
345+ selectedDevfile
346+ ? selectedDevfile
347+ : recommendedDevfile . devfile
348+ }
349+ />
345350 < Stack
346351 direction = "row"
347352 justifyContent = "flex-end"
@@ -369,15 +374,17 @@ export function FromExistingGitRepo({ setCurrentView }) {
369374 >
370375 BACK
371376 </ Button >
372- < Button
373- variant = "contained"
374- onClick = { ( ) => {
375- setSelectedDevfile ( undefined ) ;
376- setCurrentPage ( 'selectDifferentDevfile' ) ;
377- } }
378- >
379- SELECT A DIFFERENT DEVFILE
380- </ Button >
377+ { ! recommendedDevfile . isDevfileExistsInRepo && (
378+ < Button
379+ variant = "contained"
380+ onClick = { ( ) => {
381+ setSelectedDevfile ( undefined ) ;
382+ setCurrentPage ( 'selectDifferentDevfile' ) ;
383+ } }
384+ >
385+ SELECT A DIFFERENT DEVFILE
386+ </ Button >
387+ ) }
381388 < Button
382389 variant = "contained"
383390 onClick = { ( ) => {
You can’t perform that action at this time.
0 commit comments