Skip to content

Commit bc5ad30

Browse files
committed
Don't show card if existing Devfile is used
Instead, show an information message indicating that the existing devfile will be used. Fixes #3129 Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 0fdcb8b commit bc5ad30

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

src/webview/common/setNameAndFolder.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55
import {
6+
Alert,
7+
Box,
68
Button,
79
Checkbox,
810
FormControl,
@@ -114,18 +116,22 @@ export function SetNameAndFolder(props: SetNameAndFolderProps) {
114116
</div>
115117

116118
<Stack direction="column" spacing={2} marginTop={2}>
117-
<Paper elevation={4}>
118-
<Stack margin={2} spacing={2}>
119-
<DevfileListItem devfile={props.devfile} />
120-
{/* padding here is to match the padding build into the devfile list component */}
121-
{props.templateProject && (
122-
<Stack direction="row" alignItems="center" spacing={1} paddingX={1}>
123-
<Typography variant="body1">Project:</Typography>
124-
<code>{props.templateProject}</code>
125-
</Stack>
126-
)}
127-
</Stack>
128-
</Paper>
119+
{props.devfile ? (
120+
<Paper elevation={4}>
121+
<Stack margin={2} spacing={2}>
122+
<DevfileListItem devfile={props.devfile} />
123+
{/* padding here is to match the padding build into the devfile list component */}
124+
{props.templateProject && (
125+
<Stack direction="row" alignItems="center" spacing={1} paddingX={1}>
126+
<Typography variant="body1">Project:</Typography>
127+
<code>{props.templateProject}</code>
128+
</Stack>
129+
)}
130+
</Stack>
131+
</Paper>
132+
) : (
133+
<Alert severity="info">The Devfile that exists in the repo will be used</Alert>
134+
)}
129135
<ComponentNameInput
130136
isComponentNameFieldValid={isComponentNameFieldValid}
131137
componentNameErrorMessage={componentNameErrorMessage}

src/webview/create-component/pages/fromExistingGitRepo.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,25 @@ export function FromExistingGitRepo({ setCurrentView }) {
332332
? 'Selected Devfile'
333333
: 'Recommended Devfile'}
334334
</Typography>
335-
{recommendedDevfile.isDevfileExistsInRepo ? (
336-
<Alert severity="info">
337-
The Devfile that exists in the repo will be used
338-
</Alert>
339-
) : (
335+
{!recommendedDevfile.isDevfileExistsInRepo && (
340336
<DevfileRecommendationInfo />
341337
)}
342338
</Stack>
343-
<DevfileListItem
344-
devfile={
345-
selectedDevfile
346-
? selectedDevfile
347-
: recommendedDevfile.devfile
348-
}
349-
/>
339+
{recommendedDevfile.isDevfileExistsInRepo ? (
340+
<Box margin={2}>
341+
<Alert severity="info">
342+
The Devfile that exists in the repo will be used
343+
</Alert>
344+
</Box>
345+
) : (
346+
<DevfileListItem
347+
devfile={
348+
selectedDevfile
349+
? selectedDevfile
350+
: recommendedDevfile.devfile
351+
}
352+
/>
353+
)}
350354
<Stack
351355
direction="row"
352356
justifyContent="flex-end"
@@ -407,7 +411,7 @@ export function FromExistingGitRepo({ setCurrentView }) {
407411
setCurrentPage('fromGitRepo');
408412
}}
409413
createComponent={createComponentFromGitRepo}
410-
devfile={selectedDevfile ? selectedDevfile : recommendedDevfile.devfile}
414+
devfile={recommendedDevfile.isDevfileExistsInRepo ? undefined : selectedDevfile ? selectedDevfile : recommendedDevfile.devfile}
411415
initialComponentName={gitURL.url.substring(gitURL.url.lastIndexOf('/') + 1)}
412416
/>
413417
);

0 commit comments

Comments
 (0)