blob: ad20e2e6eef3c3e955b8fbb3a0cc5b9d336ba055 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import clsx from 'clsx';
import {withStyles} from '@material-ui/core/styles';
import CssBaseline from '@material-ui/core/CssBaseline';
import Drawer from '@material-ui/core/Drawer';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import List from '@material-ui/core/List';
import Typography from '@material-ui/core/Typography';
import Divider from '@material-ui/core/Divider';
import IconButton from '@material-ui/core/IconButton';
import Container from '@material-ui/core/Container';
import MenuIcon from '@material-ui/icons/Menu';
import {fmMenuListItems,wmMenuListItems} from './listItems';
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import {Link} from "react-router-dom";
import ListItem from "@material-ui/core/ListItem";
import ListItemIcon from "@material-ui/core/ListItemIcon";
import DashboardIcon from "@material-ui/icons/Dashboard";
import ListItemText from "@material-ui/core/ListItemText";
import PropTypes from "prop-types";
const drawerWidth = 240;
const styles = (theme => ({
root: {
display: 'flex',
},
toolbar: {
paddingRight: 24
},
toolbarIcon: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: '0 8px',
...theme.mixins.toolbar,
},
appBar: {
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
backgroundColor: "#1a1a59"
},
appBarShift: {
marginLeft: drawerWidth,
width: `calc(100% - ${drawerWidth}px)`,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
menuButton: {
marginRight: 36,
},
menuButtonHidden: {
display: 'none',
},
title: {
flexGrow: 1,
},
drawerPaper: {
position: 'relative',
whiteSpace: 'nowrap',
width: drawerWidth,
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
drawerPaperClose: {
overflowX: 'hidden',
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
width: theme.spacing(7),
[theme.breakpoints.up('sm')]: {
width: theme.spacing(9),
},
},
appBarSpacer: theme.mixins.toolbar,
content: {
flexGrow: 1,
height: '100vh',
overflow: 'auto',
},
container: {
paddingTop: theme.spacing(4),
paddingBottom: theme.spacing(4),
},
paper: {
padding: theme.spacing(2),
display: 'flex',
overflow: 'auto',
flexDirection: 'column',
},
fixedHeight: {
height: 'auto',
},
logo: {
color: 'blue',
textAlign: 'center'
},
button: {
color: 'yellow',
},
}));
class OPSUIHome extends React.Component {
constructor(props) {
super(props);
this.state = {
open: true,
};
}
handleDrawerOpen = () => {
this.setState({open: true});
};
handleDrawerClose = () => {
this.setState({open: false});
};
render() {
const {classes} = this.props;
return (
<div className={classes.root}>
<CssBaseline/>
<AppBar position="absolute" className={clsx(classes.appBar, this.state.open && classes.appBarShift)}>
<Toolbar className={classes.toolbar}>
<IconButton
edge="start"
color="inherit"
aria-label="Open drawer"
onClick={this.handleDrawerOpen}
className={clsx(classes.menuButton, this.state.open && classes.menuButtonHidden)}
>
<MenuIcon/>
</IconButton>
<Typography component="h1" variant="h6" color="inherit" noWrap className={classes.title}>
Apache OODT - OPSUI
</Typography>
</Toolbar>
</AppBar>
<Drawer variant="permanent" className={classes.logo}
classes={{paper: clsx(classes.drawerPaper, !this.state.open && classes.drawerPaperClose),}}
open={this.state.open}>
<div>
<IconButton onClick={this.handleDrawerClose}>
<div>
<img src="/images/oodt_logo.png" alt="Apache OODT Logo" width="110px"/>
</div>
<ChevronLeftIcon/>
</IconButton>
</div>
<List>
<div>
<ListItem button component={Link} to={"/"} >
<ListItemIcon>
<DashboardIcon/>
</ListItemIcon>
<ListItemText primary="Dashboard"/>
</ListItem>
</div>
</List>
<Divider/>
{/*FileManager Menu List*/}
<List>{fmMenuListItems}</List>
<Divider/>
{/*Workflow Manager Menu List*/}
<List>{wmMenuListItems}</List>
</Drawer>
<main className={classes.content}>
<div className={classes.appBarSpacer}/>
<Container maxWidth="lg" className={classes.container}>
{this.props.children}
</Container>
</main>
</div>
);
}
}
OPSUIHome.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(OPSUIHome);