|
|
@ -12,15 +12,18 @@ import IconButton from 'material-ui/IconButton';
|
|
|
|
|
|
|
|
|
|
|
|
import NavigationMenu from 'material-ui/svg-icons/navigation/menu';
|
|
|
|
import NavigationMenu from 'material-ui/svg-icons/navigation/menu';
|
|
|
|
import NavigationBack from 'material-ui/svg-icons/navigation/arrow-back';
|
|
|
|
import NavigationBack from 'material-ui/svg-icons/navigation/arrow-back';
|
|
|
|
|
|
|
|
import NavigationRefresh from 'material-ui/svg-icons/navigation/refresh';
|
|
|
|
|
|
|
|
|
|
|
|
import './App.css';
|
|
|
|
import './App.css';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import withSpin from './widgets/withSpin';
|
|
|
|
import SideMenu from './SideMenu';
|
|
|
|
import SideMenu from './SideMenu';
|
|
|
|
import LoginGate from './LoginGate';
|
|
|
|
import LoginGate from './LoginGate';
|
|
|
|
import { RouteResolver } from './routes';
|
|
|
|
import { RouteResolver } from './routes';
|
|
|
|
|
|
|
|
|
|
|
|
import * as C from './constants';
|
|
|
|
import * as C from './constants';
|
|
|
|
import * as store from './store';
|
|
|
|
import * as store from './store';
|
|
|
|
|
|
|
|
import * as actions from './store/actions';
|
|
|
|
|
|
|
|
|
|
|
|
import { History } from 'history';
|
|
|
|
import { History } from 'history';
|
|
|
|
|
|
|
|
|
|
|
@ -85,6 +88,7 @@ const AppBarWitHistory = withRouter(
|
|
|
|
toggleDrawerIcon: any,
|
|
|
|
toggleDrawerIcon: any,
|
|
|
|
history?: History;
|
|
|
|
history?: History;
|
|
|
|
staticContext?: any;
|
|
|
|
staticContext?: any;
|
|
|
|
|
|
|
|
iconElementRight: any,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props: any) {
|
|
|
|
constructor(props: any) {
|
|
|
@ -125,6 +129,8 @@ const AppBarWitHistory = withRouter(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const IconRefreshWithSpin = withSpin(NavigationRefresh);
|
|
|
|
|
|
|
|
|
|
|
|
class App extends React.PureComponent {
|
|
|
|
class App extends React.PureComponent {
|
|
|
|
state: {
|
|
|
|
state: {
|
|
|
|
drawerOpen: boolean,
|
|
|
|
drawerOpen: boolean,
|
|
|
@ -132,6 +138,8 @@ class App extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
|
credentials: store.CredentialsType;
|
|
|
|
credentials: store.CredentialsType;
|
|
|
|
|
|
|
|
entries: store.EntriesType;
|
|
|
|
|
|
|
|
fetchCount: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props: any) {
|
|
|
|
constructor(props: any) {
|
|
|
@ -140,6 +148,7 @@ class App extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
this.toggleDrawer = this.toggleDrawer.bind(this);
|
|
|
|
this.toggleDrawer = this.toggleDrawer.bind(this);
|
|
|
|
this.closeDrawer = this.closeDrawer.bind(this);
|
|
|
|
this.closeDrawer = this.closeDrawer.bind(this);
|
|
|
|
|
|
|
|
this.refresh = this.refresh.bind(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
toggleDrawer() {
|
|
|
|
toggleDrawer() {
|
|
|
@ -150,9 +159,15 @@ class App extends React.PureComponent {
|
|
|
|
this.setState({drawerOpen: false});
|
|
|
|
this.setState({drawerOpen: false});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refresh() {
|
|
|
|
|
|
|
|
store.store.dispatch(actions.fetchAll(this.props.credentials.value!, this.props.entries));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const credentials = (this.props.credentials) ? this.props.credentials.value : null;
|
|
|
|
const credentials = (this.props.credentials) ? this.props.credentials.value : null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fetching = this.props.fetchCount > 0;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<MuiThemeProvider muiTheme={muiTheme}>
|
|
|
|
<MuiThemeProvider muiTheme={muiTheme}>
|
|
|
|
<BrowserRouter>
|
|
|
|
<BrowserRouter>
|
|
|
@ -160,6 +175,10 @@ class App extends React.PureComponent {
|
|
|
|
<AppBarWitHistory
|
|
|
|
<AppBarWitHistory
|
|
|
|
title={C.appName}
|
|
|
|
title={C.appName}
|
|
|
|
toggleDrawerIcon={<IconButton onClick={this.toggleDrawer}><NavigationMenu /></IconButton>}
|
|
|
|
toggleDrawerIcon={<IconButton onClick={this.toggleDrawer}><NavigationMenu /></IconButton>}
|
|
|
|
|
|
|
|
iconElementRight={
|
|
|
|
|
|
|
|
<IconButton disabled={!credentials || fetching} onClick={this.refresh}>
|
|
|
|
|
|
|
|
<IconRefreshWithSpin spin={fetching} />
|
|
|
|
|
|
|
|
</IconButton>}
|
|
|
|
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<Drawer
|
|
|
|
<Drawer
|
|
|
@ -203,6 +222,8 @@ const credentialsSelector = createSelector(
|
|
|
|
const mapStateToProps = (state: store.StoreState) => {
|
|
|
|
const mapStateToProps = (state: store.StoreState) => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
credentials: credentialsSelector(state),
|
|
|
|
credentials: credentialsSelector(state),
|
|
|
|
|
|
|
|
entries: state.cache.entries,
|
|
|
|
|
|
|
|
fetchCount: state.fetchCount,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|