Skip to content
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
36 changes: 5 additions & 31 deletions src/webview/git-import/app/cardItem.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Theme, createStyles } from '@material-ui/core/styles';

export default (theme: Theme) =>
export default (_theme: Theme) =>
createStyles({
card: {
display: 'inline-table',
Expand Down Expand Up @@ -43,17 +43,17 @@ export default (theme: Theme) =>
},
cardBody: {
height: 'auto',
width: '50%',
overflow: 'hidden',
margin: '1.5rem 1rem'
},
cardRegistryTitle: {
color: 'var(--vscode-textLink-activeForeground)',
minWidth: '5rem',
height: '2rem',
whiteSpace: 'nowrap',
overflow: 'hidden',
display: 'block',
textAlign: 'left',
textAlign: 'right',
textDecoration: 'none',
textOverflow: 'ellipsis',
wordBreak: 'break-all',
Expand All @@ -62,38 +62,12 @@ export default (theme: Theme) =>
margin: '1rem'
},
badge: {
minWidth: '0.5rem',
maxWidth: '5rem',
height: '1px',
padding: '0.5rem',
minHeight: '2px',
maxHeight: '1rem',
borderRadius: '0.5rem!important',
marginLeft: '0.5rem',
alignItems: 'center',
color: 'inherit',
backgroundColor: 'var(--vscode-badge-background)',
outline: '0.0625rem solid',
outlineColor: 'inherit'
},
headerBadge: {
height: '1px',
outline: 'none'
},
firstBadge: {
marginLeft: '0rem'
},
cardFooterTag: {
marginTop: '0.125rem',
marginLeft: '1.5rem',
marginBottom: '1rem'
},
text: {
textAlign: 'right'
},
longDescription: {
overflow: 'hidden',
display: '-webkit-box',
WebkitLineClamp: 3,
WebkitBoxOrient: 'vertical'
outlineColor: '#EE0000'
}
});
44 changes: 28 additions & 16 deletions src/webview/git-import/app/cardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/
import React from 'react';
import StarIcon from '@mui/icons-material/Star';
import StarBorderIcon from '@mui/icons-material/StarBorder';
import { Card, makeStyles, Typography } from '@material-ui/core';
import CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';
import CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined';
import { Badge, Card, makeStyles, Typography } from '@material-ui/core';
import { CompTypeDesc } from './gitImport';
import cardItemStyle from './cardItem.style';

Expand Down Expand Up @@ -36,27 +36,39 @@ export const CardItem: React.FC<CardProps> = ({
src={compDesc.devfileData.devfile.metadata.icon}
className={style.cardImage} />
<div className={style.cardRegistryTitle}>
{compDesc.selected ? <StarIcon style={{ fontSize: 20 }} /> : <StarBorderIcon style={{ fontSize: 20 }} />}
{compDesc.selected ? <CheckBoxOutlinedIcon style={{ fontSize: 20, color: '#EE0000' }} /> : <CheckBoxOutlineBlankOutlinedIcon style={{ fontSize: 20, color: '#EE0000' }} />}
</div>
</div>
</div>
<div style={{ margin: '1.5rem' }}>
<Typography variant='body1'>{compDesc.devfileData.devfile.metadata.name}</Typography>
</div>
<div className={style.cardBody}>
<div style={{ display: 'flex', flexDirection: 'row', gap: '1rem', width: 'auto' }}>
<div className={style.cardBody}>
{
compDesc.devfileData.devfile.metadata.version && (
<Typography variant='caption'>
Version: {compDesc.devfileData.devfile.metadata.version}<br />
</Typography>
)
}
<Typography variant='caption'>
Project Type: {capitalizeFirstLetter(compDesc.devfileData.devfile.metadata.projectType)}<br />
</Typography>
<Typography variant='caption'>
Language: {capitalizeFirstLetter(compDesc.devfileData.devfile.metadata.language)}<br />
</Typography>
</div>
{
compDesc.devfileData.devfile.metadata.version && (
<Typography variant='caption'>
Version: {compDesc.devfileData.devfile.metadata.version}<br />
</Typography>
)
compDesc.registry.name.toLowerCase() !== 'defaultdevfileregistry' &&
<div style={{alignSelf:'flex-end', marginBottom: '2rem'}}>
<Badge key='badge' className={style.badge}
overlap='rectangular'
variant='standard'>
{compDesc.registry.name}
</Badge>
</div>
}
<Typography variant='caption'>
Project Type: {capitalizeFirstLetter(compDesc.devfileData.devfile.metadata.projectType)}<br />
</Typography>
<Typography variant='caption'>
Language: {capitalizeFirstLetter(compDesc.devfileData.devfile.metadata.language)}<br />
</Typography>
</div>
</Card>
</>
Expand Down
5 changes: 3 additions & 2 deletions src/webview/git-import/app/gitImport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ export class GitImport extends React.Component<DefaultProps, {

handleSelectedCard(compTypeDesc: CompTypeDesc): void {
this.state.compDescription.forEach((compDesc) => {
if (compDesc.devfileData.devfile.metadata.name === compTypeDesc.devfileData.devfile.metadata.name) {
if (compDesc.devfileData.devfile.metadata.name === compTypeDesc.devfileData.devfile.metadata.name
&& compDesc.registry.name === compTypeDesc.registry.name) {
compTypeDesc.selected = !compTypeDesc.selected;
compDesc.selected = compTypeDesc.selected;
} else {
Expand Down Expand Up @@ -341,7 +342,7 @@ export class GitImport extends React.Component<DefaultProps, {
helperText={gitURL.helpText}>
</TextField>
{gitURL.helpText !== '' ?
gitURL.helpText === 'Validated' ?
gitURL.helpText.indexOf('valid') !== -1 ?
<CheckCircleIcon color='success' style={{ paddingTop: '1rem' }} /> :
gitURL.helpText.indexOf('but cannot be reached') !== -1 ?
<ErrorIcon color='warning' style={{ paddingTop: '1rem' }} /> :
Expand Down
1 change: 1 addition & 0 deletions src/webview/git-import/gitImportLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class Command {
projectName: event.projectName,
applicationName: event.applicationName,
compName: event.componentName,
registryName: event.compDesc?.registry.name,
devFilePath: !event.devFilePath || event.devFilePath === 'devfile.yaml' || event.devFilePath === 'devfile.yml' ?
'' : event.devFilePath
}, true);
Expand Down