File tree Expand file tree Collapse file tree 5 files changed +67
-30
lines changed
Expand file tree Collapse file tree 5 files changed +67
-30
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { makeStyles } from '@material-ui/core/styles' ;
33import Button from '@material-ui/core/Button' ;
4- import Menu from '@material-ui/core/Menu' ;
5- import MenuItem from '@material-ui/core/MenuItem' ;
64
75const useStyles = makeStyles ( ( theme ) => ( {
86 root : {
@@ -14,38 +12,18 @@ const useStyles = makeStyles((theme) => ({
1412
1513export default function AppButton ( props ) {
1614 const classes = useStyles ( ) ;
17- const [ anchorEl , setAnchorEl ] = React . useState ( null ) ;
1815
19- const handleClick = ( event ) => {
20- setAnchorEl ( event . currentTarget ) ;
21- } ;
22-
23- const handleClose = ( ) => {
24- setAnchorEl ( null ) ;
25- } ;
26-
27- const handleSelect = ( showValues ) => {
28- setAnchorEl ( null ) ;
16+ const handleClick = ( ) => {
2917 if ( props . onClick ) {
30- props . onClick ( showValues , props . app ) ;
18+ return props . onClick ( props . app ) ;
3119 }
3220 } ;
3321
3422 return (
3523 < span className = { classes . root } >
36- < Button aria-controls = "simple-menu" aria-haspopup = "true " color = "primary" onClick = { handleClick } >
24+ < Button variant = "contained " color = "primary" onClick = { handleClick } >
3725 { props . app . name }
3826 </ Button >
39- < Menu
40- id = "simple-menu"
41- anchorEl = { anchorEl }
42- keepMounted
43- open = { Boolean ( anchorEl ) }
44- onClose = { handleClose }
45- >
46- < MenuItem onClick = { ( ) => handleSelect ( false ) } > Manifest</ MenuItem >
47- < MenuItem onClick = { ( ) => handleSelect ( true ) } > Values</ MenuItem >
48- </ Menu >
4927 </ span >
5028 ) ;
5129}
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { makeStyles } from '@material-ui/core/styles' ;
3+ import Button from '@material-ui/core/Button' ;
4+ import Menu from '@material-ui/core/Menu' ;
5+ import MenuItem from '@material-ui/core/MenuItem' ; ;
6+
7+ const useStyles = makeStyles ( ( theme ) => ( {
8+ root : {
9+ '& > *' : {
10+ margin : theme . spacing ( 1 ) ,
11+ } ,
12+ } ,
13+ paper : {
14+ border : '1px solid #d3d4d5' ,
15+ } ,
16+ } ) ) ;
17+
18+ export default function AppInstanceButton ( props ) {
19+ const classes = useStyles ( ) ;
20+ const [ anchorEl , setAnchorEl ] = React . useState ( null ) ;
21+
22+ const handleClick = ( event ) => {
23+ setAnchorEl ( event . currentTarget ) ;
24+ } ;
25+
26+ const handleClose = ( ) => {
27+ setAnchorEl ( null ) ;
28+ } ;
29+
30+ const handleSelect = ( showValues ) => {
31+ setAnchorEl ( null ) ;
32+ if ( props . onClick ) {
33+ props . onClick ( showValues , props . app ) ;
34+ }
35+ } ;
36+
37+ return (
38+ < span className = { classes . root } >
39+ < Button
40+ aria-controls = "customized-menu"
41+ aria-haspopup = "true"
42+ variant = "contained"
43+ color = "primary"
44+ onClick = { handleClick } >
45+ { props . app . name }
46+ </ Button >
47+ < Menu
48+ id = "simple-menu"
49+ anchorEl = { anchorEl }
50+ keepMounted
51+ open = { Boolean ( anchorEl ) }
52+ onClose = { handleClose }
53+ >
54+ < MenuItem onClick = { ( ) => handleSelect ( false ) } > Manifest</ MenuItem >
55+ < MenuItem onClick = { ( ) => handleSelect ( true ) } > Values</ MenuItem >
56+ </ Menu >
57+ </ span >
58+ ) ;
59+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { connect } from 'react-redux';
33
44// from core components
55import EnvironmentSelects from "../environments/EnvironmentSelects" ;
6- import AppButton from "./AppButton " ;
6+ import AppInstanceButton from "./AppInstanceButton " ;
77
88// from Redux
99import IconButton from "@material-ui/core/IconButton" ;
@@ -41,7 +41,7 @@ class ApplicationInstances extends React.Component {
4141 < >
4242 < h3 > { enabledAppInstances . length } Application Instances</ h3 >
4343 { enabledAppInstances . map ( ( applicationInstance ) => {
44- return < AppButton key = { applicationInstance . id } app = { applicationInstance } onClick = { ( showValues ) => { this . showAppView ( showValues , applicationInstance ) } } /> ;
44+ return < AppInstanceButton key = { applicationInstance . id } app = { applicationInstance } onClick = { ( showValues ) => { this . showAppView ( showValues , applicationInstance ) } } /> ;
4545 } ) }
4646 </ >
4747 ) ;
Original file line number Diff line number Diff line change @@ -93,8 +93,8 @@ class Applications extends React.Component {
9393 return ( application . name && application . name . length ) ;
9494 } ) . map ( ( application ) => {
9595 return < AppButton key = { application . id }
96- app = { application }
97- onClick = { ( ) => { this . handleAppClick ( application ) } } />
96+ app = { application }
97+ onClick = { ( ) => { this . handleAppClick ( application ) } } />
9898 } ) ) ;
9999 } ;
100100
You can’t perform that action at this time.
0 commit comments