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

UI: Remove antd package #1117

Merged
merged 8 commits into from
Apr 3, 2020
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
1 change: 0 additions & 1 deletion pkg/ui/v1alpha3/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"@material-ui/styles": "^3.0.0-alpha.10",
"@svgr/webpack": "4.1.0",
"ace-builds": "^1.4.8",
"antd": "^3.13.6",
"axios": "^0.18.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
Expand Down
16 changes: 8 additions & 8 deletions pkg/ui/v1alpha3/frontend/src/components/App.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from 'react';

import Header from './Menu/Header';
import Snack from './Menu/Snack';
import { Route } from 'react-router-dom';

import { makeStyles } from '@material-ui/styles';

import { Route } from 'react-router-dom';
import Main from './Menu/Main';
import HP from './HP/Create/HP';
import HPJobMonitor from './HP/Monitor/HPJobMonitor';
import HPJobInfo from './HP/Monitor/HPJobInfo';
import NAS from './NAS/Create/NAS';
import NASJobMonitor from './NAS/Monitor/NASJobMonitor';
import NASJobInfo from './NAS/Monitor/NASJobInfo';
import Trial from './Templates/Trial';
import Header from './Menu/Header';
import Snack from './Menu/Snack';
import TabPanel from './Common/Create/TabPanel';

import * as constants from '../constants/constants';

const useStyles = makeStyles({
root: {
Expand All @@ -29,10 +29,10 @@ const App = props => {
<div className={classes.root}>
<Header />
<Route exact path="/" component={Main} />
<Route path="/katib/hp" component={HP} />
<Route path={constants.LINK_HP_CREATE} component={TabPanel} />
<Route exact path="/katib/hp_monitor" component={HPJobMonitor} />
<Route path="/katib/hp_monitor/:namespace/:name" component={HPJobInfo} />
<Route path="/katib/nas" component={NAS} />
<Route path={constants.LINK_NAS_CREATE} component={TabPanel} />
<Route exact path="/katib/nas_monitor" component={NASJobMonitor} />
<Route path="/katib/nas_monitor/:namespace/:name" component={NASJobInfo} />
<Route path="/katib/trial" component={Trial} />
Expand Down
81 changes: 81 additions & 0 deletions pkg/ui/v1alpha3/frontend/src/components/Common/Create/TabPanel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React from 'react';

import { withStyles } from '@material-ui/core/styles';
import makeStyles from '@material-ui/styles/makeStyles';
import Tabs from '@material-ui/core/Tabs';
import Tab from '@material-ui/core/Tab';

import HPYAML from '../../HP/Create/YAML';
import HPParameters from '../../HP/Create/HPParameters';
import NASYAML from '../../NAS/Create/YAML';
import NASParameters from '../../NAS/Create/NASParameters';

import * as constants from '../../../constants/constants';

const useStyles = makeStyles({
root: {
marginTop: 40,
},
});

const MyTabs = withStyles({
root: {
borderBottom: '1px solid #e8e8e8',
marginBottom: 15,
},
indicator: {
backgroundColor: '#1890ff',
},
})(Tabs);

const MyTab = withStyles(theme => ({
root: {
textTransform: 'none',
marginRight: 40,
minWidth: 40,
fontWeight: theme.typography.fontWeightRegular,
fontSize: 14,
opacity: 1,
'&:hover': {
color: '#40a9ff',
},
'&$selected': {
color: '#1890ff',
fontWeight: theme.typography.fontWeightMedium,
},
'&:focus': {
color: '#1890ff',
},
},
selected: {},
}))(props => <Tab disableRipple {...props} />);

const TabsPanel = props => {
const [tabIndex, setTabIndex] = React.useState(0);

const onTabChange = (event, newIndex) => {
setTabIndex(newIndex);
};
const classes = useStyles();
return (
<div className={classes.root}>
<MyTabs value={tabIndex} onChange={onTabChange}>
<MyTab label="YAML File" />
<MyTab label="Parameters" />
</MyTabs>
{props.match.path === constants.LINK_HP_CREATE ? (
tabIndex === 0 ? (
<HPYAML />
) : (
<HPParameters />
)
) : tabIndex === 0 ? (
<NASYAML />
) : (
<NASParameters />
)}
</div>
);
};

export default TabsPanel;
35 changes: 0 additions & 35 deletions pkg/ui/v1alpha3/frontend/src/components/HP/Create/HP.jsx

This file was deleted.

3 changes: 2 additions & 1 deletion pkg/ui/v1alpha3/frontend/src/components/HP/Create/YAML.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'ace-builds/src-noconflict/theme-sqlserver';
import 'ace-builds/src-noconflict/mode-yaml';

import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

import { changeYaml } from '../../../actions/hpCreateActions';
import { submitYaml } from '../../../actions/generalActions';
Expand Down Expand Up @@ -39,7 +40,7 @@ const YAML = props => {
const classes = useStyles();
return (
<div>
<h1>Generate</h1>
<Typography variant={'h5'}>{'Generate'}</Typography>
<hr />
<div className={classes.editor}>
<AceEditor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const styles = theme => ({
textAlign: 'center',
marginBottom: 15,
},
link: {
textDecoration: 'none',
},
});

class HPJobInfo extends React.Component {
Expand All @@ -45,7 +48,7 @@ class HPJobInfo extends React.Component {
const { classes } = this.props;
return (
<div className={classes.root}>
<Link to="/katib/hp_monitor">
<Link to="/katib/hp_monitor" className={classes.link}>
<Button variant={'contained'} color={'primary'}>
Back
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import React from 'react';
import { connect } from 'react-redux';

import { withStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';

import FilterPanel from './FilterPanel';
import HPJobList from './HPJobList';

import { fetchHPJobs } from '../../../actions/hpMonitorActions';
import { connect } from 'react-redux';

const styles = theme => ({
root: {
width: '90%',
margin: '0 auto',
marginTop: 10,
},
text: {
marginBottom: 20,
},
});

class HPJobMonitor extends React.Component {
Expand All @@ -25,7 +30,9 @@ class HPJobMonitor extends React.Component {

return (
<div className={classes.root}>
<h1>Experiment Monitor</h1>
<Typography variant={'h5'} className={classes.text}>
{'Experiment Monitor'}
</Typography>
<FilterPanel />
<HPJobList />
</div>
Expand Down
35 changes: 16 additions & 19 deletions pkg/ui/v1alpha3/frontend/src/components/Menu/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';

import makeStyles from '@material-ui/styles/makeStyles';
import { withStyles } from '@material-ui/core/styles';

import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import { Link } from 'react-router-dom';

import Menu from './Menu';

import { connect } from 'react-redux';
import { toggleMenu } from '../../actions/generalActions';

const useStyles = makeStyles({
root: {
flexGrow: 1,
},
grow: {
flexGrow: 1,
},
menuButton: {
marginLeft: -12,
marginRight: 20,
},
link: {
});

const KatibLink = withStyles({
root: {
textDecoration: 'none',
'&:hover': {
color: '#40a9ff',
},
},
});
})(Typography);

const Header = props => {
const classes = useStyles();
Expand All @@ -36,7 +39,7 @@ const Header = props => {
};

return (
<div className={classes.root}>
<div>
<AppBar position={'static'} color={'primary'}>
<Toolbar>
<IconButton
Expand All @@ -47,15 +50,9 @@ const Header = props => {
>
<MenuIcon />
</IconButton>
<Typography
variant={'headline'}
color={'secondary'}
component={Link}
to="/"
classes={classes.link}
>
<KatibLink variant={'headline'} color={'secondary'} component={Link} to="/">
Katib
</Typography>
</KatibLink>
</Toolbar>
<Menu />
</AppBar>
Expand Down
15 changes: 11 additions & 4 deletions pkg/ui/v1alpha3/frontend/src/components/Menu/Main.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import { Link } from 'react-router-dom';

import { makeStyles } from '@material-ui/styles';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
import Button from '@material-ui/core/Button';
import { Link } from 'react-router-dom';

import * as constants from '../../constants/constants';

const useStyles = makeStyles({
root: {
Expand All @@ -17,6 +19,7 @@ const useStyles = makeStyles({
},
item: {
padding: '40px !important',
textDecoration: 'none !important',
},
block: {
backgroundColor: '#4e4e4e',
Expand All @@ -27,6 +30,10 @@ const useStyles = makeStyles({
backgroundColor: 'black',
},
},
link: {
textDecoration: 'none',
color: '#1890ff',
},
});

const Main = props => {
Expand All @@ -38,14 +45,14 @@ const Main = props => {
<Typography variant={'h6'}>Choose type of experiment</Typography>
<br />
<Grid container spacing={40} alignContent={'center'}>
<Grid item xs={6} className={classes.item} component={Link} to="/katib/hp/">
<Grid item xs={6} className={classes.item} component={Link} to={constants.LINK_HP_CREATE}>
<Paper className={classes.block}>
<Typography variant={'h6'} color={'secondary'}>
Hyperparameter Tuning
</Typography>
</Paper>
</Grid>
<Grid item xs={6} className={classes.item} component={Link} to="/katib/nas/">
<Grid item xs={6} className={classes.item} component={Link} to={constants.LINK_NAS_CREATE}>
<Paper className={classes.block}>
<Typography variant={'h6'} color={'secondary'}>
Neural Architecture Search
Expand Down
35 changes: 0 additions & 35 deletions pkg/ui/v1alpha3/frontend/src/components/NAS/Create/NAS.jsx

This file was deleted.

Loading