-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add new endpoints * Add pool actions * Add form stepper component * Add create application form
- Loading branch information
Sergio Betanzos
committed
Sep 7, 2020
1 parent
22ff32e
commit 4b5b2ad
Showing
37 changed files
with
1,203 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
makeStyles, | ||
Card, | ||
Button, | ||
CardHeader, | ||
CardActions, | ||
Fade | ||
} from '@material-ui/core'; | ||
|
||
import { Tr } from 'client/components/HOC'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
height: '100%', | ||
minHeight: 140, | ||
display: 'flex', | ||
flexDirection: 'column' | ||
}, | ||
header: { | ||
overflowX: 'hidden', | ||
flexGrow: 1 | ||
}, | ||
subheader: { | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'initial', | ||
display: '-webkit-box', | ||
lineClamp: 2, | ||
boxOrient: 'vertical' | ||
}, | ||
remove: { | ||
backgroundColor: theme.palette.error.dark | ||
} | ||
})); | ||
|
||
const NetworkCard = React.memo( | ||
({ info, handleEdit, handleClone, handleRemove }) => { | ||
const classes = useStyles(); | ||
const { mandatory, name, description, type, id, extra } = info; | ||
|
||
return ( | ||
<Fade in unmountOnExit={false}> | ||
<Card className={classes.root}> | ||
<CardHeader | ||
avatar={mandatory ? 'M' : ''} | ||
className={classes.header} | ||
classes={{ content: classes.headerContent }} | ||
title={name} | ||
titleTypographyProps={{ | ||
variant: 'body2', | ||
noWrap: true, | ||
title: name | ||
}} | ||
subheader={description} | ||
subheaderTypographyProps={{ | ||
variant: 'body2', | ||
noWrap: true, | ||
className: classes.subheader, | ||
title: description | ||
}} | ||
/> | ||
<CardActions> | ||
<Button variant="contained" size="small" onClick={handleEdit}> | ||
{Tr('Edit')} | ||
</Button> | ||
<Button variant="contained" size="small" onClick={handleClone}> | ||
{Tr('Clone')} | ||
</Button> | ||
<Button size="small" onClick={handleRemove}> | ||
{Tr('Remove')} | ||
</Button> | ||
</CardActions> | ||
</Card> | ||
</Fade> | ||
); | ||
} | ||
); | ||
|
||
export default NetworkCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
makeStyles, | ||
Card, | ||
Button, | ||
CardHeader, | ||
CardActions, | ||
Badge, | ||
Fade | ||
} from '@material-ui/core'; | ||
import DesktopWindowsIcon from '@material-ui/icons/DesktopWindows'; | ||
|
||
import { Tr } from 'client/components/HOC'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
height: '100%', | ||
minHeight: 140, | ||
display: 'flex', | ||
flexDirection: 'column' | ||
}, | ||
header: { | ||
overflowX: 'hidden', | ||
flexGrow: 1 | ||
}, | ||
headerContent: {}, | ||
title: { | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'initial', | ||
display: '-webkit-box', | ||
lineClamp: 2, | ||
boxOrient: 'vertical' | ||
} | ||
})); | ||
|
||
const RoleCard = React.memo( | ||
({ info, handleEdit, handleClone, handleRemove }) => { | ||
const classes = useStyles(); | ||
const { | ||
name = 'Role name', | ||
cardinality, | ||
vm_template = 0, | ||
elasticity_policies, | ||
scheduled_policies | ||
} = info; | ||
|
||
const ConditionalWrapper = ({ condition, wrapper, children }) => | ||
condition ? wrapper(children) : children; | ||
console.log(info); | ||
return ( | ||
<Fade in unmountOnExit={false}> | ||
<Card className={classes.root}> | ||
<CardHeader | ||
avatar={ | ||
<ConditionalWrapper | ||
condition={cardinality > 1} | ||
wrapper={children => ( | ||
<Badge | ||
badgeContent={cardinality} | ||
color="primary" | ||
anchorOrigin={{ | ||
vertical: 'top', | ||
horizontal: 'left' | ||
}} | ||
> | ||
{children} | ||
</Badge> | ||
)} | ||
> | ||
<DesktopWindowsIcon /> | ||
</ConditionalWrapper> | ||
} | ||
className={classes.header} | ||
classes={{ content: classes.headerContent }} | ||
title={name} | ||
titleTypographyProps={{ | ||
variant: 'body2', | ||
noWrap: true, | ||
className: classes.title, | ||
title: name | ||
}} | ||
subheader={`Template id: ${vm_template}`} | ||
subheaderTypographyProps={{ | ||
variant: 'body2', | ||
noWrap: true, | ||
title: `Template id: ${vm_template}` | ||
}} | ||
/> | ||
<CardActions> | ||
<Button variant="contained" size="small" onClick={handleEdit}> | ||
{Tr('Edit')} | ||
</Button> | ||
<Button size="small" onClick={handleRemove}> | ||
{Tr('Remove')} | ||
</Button> | ||
</CardActions> | ||
</Card> | ||
</Fade> | ||
); | ||
} | ||
); | ||
|
||
export default RoleCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import NetworkCard from './NetworkCard'; | ||
import RoleCard from './RoleCard'; | ||
|
||
export { NetworkCard, RoleCard }; |
Oops, something went wrong.