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
3 changes: 3 additions & 0 deletions images/title/dark/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions images/title/dark/open-preview.svg

This file was deleted.

3 changes: 3 additions & 0 deletions images/title/light/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions images/title/light/open-preview.svg

This file was deleted.

1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"@mui/lab": "^5.0.0-alpha.61",
"@mui/material": "^5.4.1",
"@patternfly/react-core": "^4.198.19",
"@patternfly/react-icons": "^4.49.19",
"@rjsf/material-ui": "^3.2.1",
"@segment/analytics-next": "^1.17.4",
"@types/byline": "^4.2.33",
Expand Down Expand Up @@ -856,11 +855,11 @@
},
{
"command": "openshift.componentTypesView.registry.openInView",
"title": "Show View",
"title": "Open Registry View",
"category": "OpenShift",
"icon": {
"dark": "images/title/dark/open-preview.svg",
"light": "images/title/light/open-preview.svg"
"dark": "images/title/dark/book.svg",
"light": "images/title/light/book.svg"
}
},
{
Expand Down
71 changes: 45 additions & 26 deletions src/webview/devfile-registry/app/cardItem.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default (theme: Theme) =>
margin: '0.2rem',
cursor: 'pointer',
borderRadius: '1rem',
border: '1px solid var(--vscode-focusBorder)',
border: '1px solid',
borderColor: 'inherit',
backgroundColor: 'var(--vscode-editor-background)',
color: 'var(--vscode-editor-foreground)',
transition: 'all ease 200ms',
transform: 'scale(0.95)',
'&:hover': {
Expand Down Expand Up @@ -44,8 +47,8 @@ export default (theme: Theme) =>
marginRight: '1.5rem'
},
cardRegistryTitle: {
color: 'var(--vscode-textPreformat-foreground)',
width: '15rem',
color: 'var(--vscode-textLink-activeForeground)',
minWidth: '5rem',
height: '2rem',
whiteSpace: 'nowrap',
overflow: 'hidden',
Expand All @@ -54,7 +57,9 @@ export default (theme: Theme) =>
textDecoration: 'none',
textOverflow: 'ellipsis',
wordBreak: 'break-all',
paddingTop: '0rem'
float: 'right',
paddingTop: '0.5rem',
margin: '1rem'
},
badge: {
minWidth: '0.5rem',
Expand All @@ -65,9 +70,10 @@ export default (theme: Theme) =>
borderRadius: '0.5rem!important',
marginLeft: '0.5rem',
alignItems: 'center',
color: 'var(--vscode-badge-foreground)',
color: 'inherit',
backgroundColor: 'var(--vscode-badge-background)',
outline: '0.0625rem solid var(--vscode-focusBorder)'
outline: '0.0625rem solid',
outlineColor: 'inherit'
},
headerBadge: {
height: '1px',
Expand Down Expand Up @@ -95,19 +101,25 @@ export default (theme: Theme) =>
backgroundColor: 'var(--vscode-editor-background)',
fontSize: 'var(--vscode-font-size)',
fontFamily: 'var(--vscode-font-family)',
height: '40rem',
border: '1px solid',
borderColor: 'inherit',
maxHeight: '40rem',
maxWidth: '50rem',
margin: 'auto',
overflow: 'none'
overflowY: 'auto'
},
yamlCardHeader: {
padding: '1.5rem!important',
paddingTop: '1.5rem!important',
borderBottom: '1px solid var(--vscode-focusBorder)',
borderBottom: '1px solid',
borderBottomColor: 'inherit',
height: 'auto'
},
yamlCardBody: {
position: 'relative',
width: '100%',
overflow: 'scroll'
height: '50rem',
overflow: 'auto'
},
copyButton: {
display: 'block',
Expand All @@ -117,25 +129,25 @@ export default (theme: Theme) =>
},
cardButton: {
display: 'block',
color: 'var(--vscode-button-foreground)',
backgroundColor: 'var(--vscode-button-background)',
width: '8rem',
marginTop: '0.5rem'
marginTop: '0.3rem',
marginBottom: '0.5rem'
},
button: {
width: '7.85rem',
height: '1.5rem',
width: 'auto',
maxHeight: '2rem',
textAlign: 'center',
outline: '0.0625rem solid transparent',
outlineOffset: '0.125rem!important',
fontSize: 'var(--vscode-font-size)',
fontFamily: 'var(--vscode-font-family)',
justifyContent: 'space-between',
color: 'var(--vscode-button-foreground)',
backgroundColor: 'var(--vscode-button-background)',
'&:hover': {
cursor: 'pointer',
background: 'var(--vscode-button-hoverBackground)'
backgroundColor: 'var(--vscode-button-hoverBackground)',
},
'&:foucs': {
outlineColor: 'var(--vscode-focusBorder)'
}
textTransform: 'none'
},
backBtnCardBody: {
height: 'auto',
Expand All @@ -153,16 +165,19 @@ export default (theme: Theme) =>
zIndex: 2
},
modal: {
border: '1px solid var(--vscode-focusBorder)',
border: '1px solid',
borderColor: 'inherit',
zIndex: 3
},
devPageTitle: {
display: 'flex',
height: '3rem'
},
devPageCard: {
color: 'var(--vscode-foreground)',
backgroundColor: 'var(--vscode-editor-background)',
height: 'auto',
width: '100%',
width: '40rem',
zIndex: 1
},
devPageCardHeader: {
Expand All @@ -179,10 +194,12 @@ export default (theme: Theme) =>
backgroundColor: 'var(--vscode-editor-background)',
fontSize: 'var(--vscode-font-size)',
fontFamily: 'var(--vscode-font-family)',
height: 'auto',
maxWidth: '25rem',
maxHeight: '18rem',
margin: 'auto',
overflow: 'hidden',
border: '1px solid var(--vscode-focusBorder)'
border: '1px solid',
borderColor: 'inherit'
},
starterProjectCardHeader: {
display: 'flex',
Expand All @@ -191,7 +208,8 @@ export default (theme: Theme) =>
},
starterProjectCardBody: {
display: 'flex',
borderTop: '1px solid var(--vscode-focusBorder)',
borderTop: '1px solid',
borderTopColor: 'inherit',
paddingTop: '1rem'
},
starterProjectSelect: {
Expand Down Expand Up @@ -239,6 +257,7 @@ export default (theme: Theme) =>
width: '40%',
alignItems: 'center',
marginLeft: 'auto',
marginRight: 'auto'
marginRight: 'auto',
marginBottom: '0.5rem'
}
});
57 changes: 27 additions & 30 deletions src/webview/devfile-registry/app/cardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter';
import {
Brand,
Card,
CardBody,
CardHeader,
CardTitle,
TextContent,
TextVariants,
Text,
Modal,
ModalVariant,
Backdrop,
Button,
CardActions,
Tooltip,
CardFooter
} from '@patternfly/react-core';
Expand All @@ -27,8 +21,8 @@ import { DevFileProps } from './wrapperCardItem';
import { VSCodeMessage } from '../vsCodeMessage';
import { StarterProject } from '../../../odo/componentTypeDescription';
import { StarterProjectDisplay } from './starterProjectDisplay';
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
import { Badge } from '@material-ui/core';
import { Badge, Backdrop, Button, Card, CardActions, Modal } from '@material-ui/core';
import { FileCopy } from '@material-ui/icons';

export class CardItem extends React.Component<DevFileProps, {
numOfCall: number,
Expand Down Expand Up @@ -77,12 +71,14 @@ export class CardItem extends React.Component<DevFileProps, {
}
};

onCloseClick = (): void => {
this.setState({
numOfCall: 0,
isExpanded: false,
devFileYAML: ''
});
onCloseClick = (event, reason): void => {
if (reason === 'backdropClick' || reason === 'escapeKeyDown') {
this.setState({
numOfCall: 0,
isExpanded: false,
devFileYAML: ''
});
}
};

createComponent = (): void => {
Expand Down Expand Up @@ -183,6 +179,7 @@ export class CardItem extends React.Component<DevFileProps, {
<CardActions className={this.props.cardItemStyle.cardButton}>
<Button
color='default'
variant='contained'
component='span'
className={this.props.cardItemStyle.button}
onClick={this.createComponent}>
Expand Down Expand Up @@ -224,15 +221,18 @@ export class CardItem extends React.Component<DevFileProps, {
</Card>;

const modalViewCard = <Modal
isOpen={isExpanded}
open={isExpanded}
className={this.props.cardItemStyle.modal}
variant={ModalVariant.small}
aria-labelledby={`modal-${this.props.compDescription.Devfile.metadata.name}`}
showClose
disableFocusTrap
onClose={this.onCloseClick}
closeAfterTransition
BackdropComponent={Backdrop}
disableAutoFocus
BackdropProps={{
timeout: 500,
}}
style={{
width: '100%', height: '100%'
width: '100%', height: '100%', marginTop: '5rem'
}}>
<Card data-testid='dev-page-yaml' className={this.props.cardItemStyle.yamlCard}>
<CardHeader className={this.props.cardItemStyle.yamlCardHeader}>
Expand Down Expand Up @@ -264,13 +264,14 @@ export class CardItem extends React.Component<DevFileProps, {
<Button
id='tooltip-selector'
component='span'
icon={<CopyIcon />}
style={{ cursor: 'pointer' }}
onClick={(): void => this.copyClicked(true)}
>
<FileCopy style={{ color: 'white' }} fontSize='small' />
</Button>
<Tooltip
content={

copyClicked ? 'Copied' : 'Copy'
}
position='bottom'
Expand All @@ -282,7 +283,7 @@ export class CardItem extends React.Component<DevFileProps, {
<SyntaxHighlighter language='yaml' useInlineStyles={false}
wrapLines
showLineNumbers
lineNumberStyle={{marginLeft: '0.5rem'}}
lineNumberStyle={{ marginLeft: '0.5rem' }}
customStyle={{ marginLeft: '-1.5rem' }}
codeTagProps={{
style: {
Expand All @@ -301,7 +302,6 @@ export class CardItem extends React.Component<DevFileProps, {
<Card
className={this.props.cardItemStyle.card}
onClick={this.onCardClick}
isHoverable
data-testid={`card-${this.props.compDescription.Devfile.metadata.name.replace(/\.| /g, '')}`}
>
<CardHeader className={this.props.cardItemStyle.cardHeader}>
Expand All @@ -310,17 +310,16 @@ export class CardItem extends React.Component<DevFileProps, {
src={this.props.compDescription.Devfile.metadata.icon}
alt={`${this.props.compDescription.Devfile.metadata.name} icon`}
className={this.props.cardItemStyle.cardImage} />

{this.props.compDescription.RegistryName.toLowerCase() !== 'defaultdevfileregistry' &&
<TextContent className={this.props.cardItemStyle.cardRegistryTitle}>
<Text component={TextVariants.p}>{this.props.compDescription.RegistryName}</Text>
</TextContent>}
</div>
</CardHeader>
<CardTitle style={{ margin: '1rem 1.5rem' }}>
<TextContent>
<Text component={TextVariants.h1}>{this.props.compDescription.Devfile.metadata.displayName}</Text>
</TextContent>
{this.props.compDescription.RegistryName.toLowerCase() !== 'defaultdevfileregistry' &&
<TextContent className={this.props.cardItemStyle.cardRegistryTitle}>
<Text component={TextVariants.p}>{this.props.compDescription.RegistryName}</Text>
</TextContent>}
</CardTitle>
<CardBody className={this.props.cardItemStyle.cardBody}>
{
Expand Down Expand Up @@ -370,9 +369,7 @@ export class CardItem extends React.Component<DevFileProps, {
{
devFileYAML.length > 0 && isExpanded &&
<>
<Backdrop className={this.props.cardItemStyle.backDrop}>
{modalViewCard}
</Backdrop>
{modalViewCard}
</>
}
</>
Expand Down
8 changes: 3 additions & 5 deletions src/webview/devfile-registry/app/filterElements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Tooltip } from '@mui/material';

interface FilterProps extends DefaultProps {
id: string,
label: string,
registries: Registry[],
onCheckBoxChange: (event: ChangeEvent<HTMLInputElement>, checked: boolean) => void;
}
Expand All @@ -25,7 +24,6 @@ const filterStyle = makeStyles(filterElementsStyle);

export const FilterElements: React.FC<FilterProps> = ({
id,
label,
registries,
onCheckBoxChange
}: FilterProps) => {
Expand All @@ -36,15 +34,15 @@ export const FilterElements: React.FC<FilterProps> = ({
<Text style={{ fontSize: 'var(--vscode-editor-font-size)' }}>Registries:</Text>
</TextContent>
{
registries.map((registry) => (
<FormControlLabel className={filterStyleCSS.checkBoxItem}
registries.map((registry, index) => (
<FormControlLabel className={filterStyleCSS.checkBoxItem} key={registry.Name + '-' + index}
control={
<Checkbox id={`${id}-${registry.Name}`}
className={filterStyleCSS.checkbox}
onChange={onCheckBoxChange}
name={registry.Name}
checked={registry.state}
key={registry.Name}
key={registry.Name + '-' + index}
color='primary'
size='medium' />
}
Expand Down
Loading