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

3701 update UX for helm view #3702

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
20 changes: 0 additions & 20 deletions src/webview/helm-chart/app/fromHelm.tsx

This file was deleted.

93 changes: 53 additions & 40 deletions src/webview/helm-chart/app/helmListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ function HelmChartListContent(props: HelmListItemProps) {
// for the width setting:
// one unit of padding is 8px with the default MUI theme, and we add a margin on both sides

const numOfTags = !props.isDetailedPage ? 6 : 4;

function capitalizeFirstLetter(value: string): string {
if (value.indexOf('-') === -1) {
return value[0].toUpperCase() + value.substring(1);
Expand All @@ -65,14 +67,14 @@ function HelmChartListContent(props: HelmListItemProps) {
<Link href={props.href} underline='none' variant='body2'>
<Button
variant='text'
style={{ textTransform: 'none' }}
sx={{ textTransform: 'lowercase !important' }}
onClick={(e) => {
if (props.onClick) {
props.onClick();
}
e.preventDefault();
}}
endIcon={<Launch />}
endIcon={<Launch fontSize='small' />}
>
{props.children}
</Button>
Expand All @@ -81,12 +83,12 @@ function HelmChartListContent(props: HelmListItemProps) {
}

return (
<Stack direction='row' spacing={3} sx={{ width: 'calc(100% - 16px)' }} alignItems='center'>
<Stack direction='row' spacing={3} alignItems='center'>
<Box
sx={{
display: 'flex',
width: '7em',
height: '7em',
width: !props.isDetailedPage ? '4em' : '7em',
height: !props.isDetailedPage ? '4em' : '7em',
bgcolor: 'white',
alignItems: 'center',
justifyContent: 'center',
Expand All @@ -95,19 +97,24 @@ function HelmChartListContent(props: HelmListItemProps) {
>
{
props.selectedVersion.icon ?
<img src={props.selectedVersion.icon} style={{ maxWidth: '6em', maxHeight: '6em' }} />
<img src={props.selectedVersion.icon} style={{
maxWidth: !props.isDetailedPage ? '3em' : '6em',
maxHeight: !props.isDetailedPage ? '3em' : '6em'
}} />
:
<SvgIcon
component={HelmIcon}
fontSize='large'
style={{ width: '2em', height: '2em', }} inheritViewBox />
style={{ maxWidth: '1em', maxHeight: '1em' }} inheritViewBox />
}

</Box>
<Stack
direction='column'
spacing={1}
sx={{ flexShrink: '5', minWidth: '0', maxWidth: '35rem' }}
maxWidth={!props.isDetailedPage ? '90%' : '50rem'}
minWidth={0}
sx={{ flexShrink: '10' }}
>
<Stack direction='row' spacing={2} alignItems='center'>
<Typography
Expand All @@ -116,15 +123,51 @@ function HelmChartListContent(props: HelmListItemProps) {
sx={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
textOverflow: 'ellipsis'
}}
>
{capitalizeFirstLetter(props.helmChart.displayName || props.helmChart.chartName)}
</Typography>
<Stack direction='row' spacing={1}>
<Tooltip title={props.helmChart.repoURL}>
<Chip
size='small'
label={props.helmChart.repoName}
color={'success'} />
</Tooltip>
{props.selectedVersion.annotations && props.selectedVersion.annotations['charts.openshift.io/providerType'] &&
<Chip
size='small'
label={props.selectedVersion.annotations['charts.openshift.io/providerType']}
color={'primary'} />
}
{(props.selectedVersion.keywords && props.selectedVersion.keywords.map((tag, i) => {
if (i >= numOfTags) {
return;
}
return <Chip size="small" label={tag} key={tag} />;
}))}
{(props.selectedVersion.keywords && props.selectedVersion.keywords.length > numOfTags && (
<Tooltip title={props.selectedVersion.keywords.slice(numOfTags).join(', ')}>
<Chip size="small" label="• • •" />
</Tooltip>
))}
<Chip
size='small'
label={props.selectedVersion.version}
color={'error'}
/>
</Stack>
</Stack>
<Typography
variant='body2'
sx={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}
sx={{
whiteSpace: !props.isDetailedPage ? 'nowrap' : 'pre-wrap',
overflow: !props.isDetailedPage ? 'hidden' : 'visible',
textOverflow: !props.isDetailedPage ? 'ellipsis' : 'unset',
textAlign: 'justify',
maxHeight: !props.isDetailedPage ? '4rem' : 'unset'
}}
>
{props.selectedVersion.description}
</Typography>
Expand All @@ -147,36 +190,6 @@ function HelmChartListContent(props: HelmListItemProps) {
}} >{props.helmChart.repoURL}
</LinkButton>
}
<Stack direction='row' spacing={1}>
<Tooltip title={props.helmChart.repoURL}>
<Chip
size='small'
label={props.helmChart.repoName}
color={'success'} />
</Tooltip>
{props.selectedVersion.annotations && props.selectedVersion.annotations['charts.openshift.io/providerType'] &&
<Chip
size='small'
label={props.selectedVersion.annotations['charts.openshift.io/providerType']}
color={'primary'} />
}
{(props.selectedVersion.keywords && props.selectedVersion.keywords.map((tag, i) => {
if (i >= 2) {
return;
}
return <Chip size="small" label={tag} key={tag} />;
}))}
{(props.selectedVersion.keywords && props.selectedVersion.keywords.length > 2 && (
<Tooltip title={props.selectedVersion.keywords.slice(2).join(', ')}>
<Chip size="small" label="• • •" />
</Tooltip>
))}
<Chip
size='small'
label={props.selectedVersion.version}
color={'error'}
/>
</Stack>
</Stack>
</Stack>
);
Expand Down
2 changes: 1 addition & 1 deletion src/webview/helm-chart/app/helmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const HelmModal = React.forwardRef(
helperText = 'No available versions';
break;
case 1:
helperText = 'Only one versions available in this Chart';
helperText = 'Only one version is available for the Helm Chart';
break;
default:
if (isInteracted && !selectedVersion) {
Expand Down
Loading
Loading