|
|
@ -17,7 +17,8 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
import React from "react";
|
|
|
|
import {Layout, Menu, Icon, Drawer, Button} from 'antd';
|
|
|
|
import {Layout, Menu, Icon, Drawer, Button, Alert} from 'antd';
|
|
|
|
|
|
|
|
|
|
|
|
const {Header, Content, Footer} = Layout;
|
|
|
|
const {Header, Content, Footer} = Layout;
|
|
|
|
import {Link} from "react-router-dom";
|
|
|
|
import {Link} from "react-router-dom";
|
|
|
|
import RouteWithSubRoutes from "../../components/RouteWithSubRoutes";
|
|
|
|
import RouteWithSubRoutes from "../../components/RouteWithSubRoutes";
|
|
|
@ -38,7 +39,10 @@ class Dashboard extends React.Component {
|
|
|
|
selectedKeys: [],
|
|
|
|
selectedKeys: [],
|
|
|
|
deviceTypes: [],
|
|
|
|
deviceTypes: [],
|
|
|
|
visible: false,
|
|
|
|
visible: false,
|
|
|
|
collapsed: false
|
|
|
|
collapsed: false,
|
|
|
|
|
|
|
|
forbiddenErrors: {
|
|
|
|
|
|
|
|
deviceTypes: false
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.logo = this.props.context.theme.logo;
|
|
|
|
this.logo = this.props.context.theme.logo;
|
|
|
|
this.config = this.props.context;
|
|
|
|
this.config = this.props.context;
|
|
|
@ -62,10 +66,19 @@ class Dashboard extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
handleApiError(error,"Error occurred while trying to load device types.");
|
|
|
|
handleApiError(error, "Error occurred while trying to load device types.", true);
|
|
|
|
this.setState({
|
|
|
|
if (error.hasOwnProperty("response") && error.response.status === 403) {
|
|
|
|
loading: false
|
|
|
|
const {forbiddenErrors} = this.state;
|
|
|
|
});
|
|
|
|
forbiddenErrors.deviceTypes = true;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
forbiddenErrors,
|
|
|
|
|
|
|
|
loading: false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
loading: false
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -90,7 +103,7 @@ class Dashboard extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const config = this.props.context;
|
|
|
|
const config = this.props.context;
|
|
|
|
const {selectedKeys, deviceTypes} = this.state;
|
|
|
|
const {selectedKeys, deviceTypes, forbiddenErrors} = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
const DeviceTypesData = deviceTypes.map((deviceType) => {
|
|
|
|
const DeviceTypesData = deviceTypes.map((deviceType) => {
|
|
|
|
const platform = deviceType.name;
|
|
|
|
const platform = deviceType.name;
|
|
|
@ -116,7 +129,7 @@ class Dashboard extends React.Component {
|
|
|
|
<Layout>
|
|
|
|
<Layout>
|
|
|
|
<Header style={{paddingLeft: 0, paddingRight: 0, backgroundColor: "white"}}>
|
|
|
|
<Header style={{paddingLeft: 0, paddingRight: 0, backgroundColor: "white"}}>
|
|
|
|
<div className="logo-image">
|
|
|
|
<div className="logo-image">
|
|
|
|
<Link to="/store/android"><img alt="logo" src={this.logo}/></Link>
|
|
|
|
<Link to="/store"><img alt="logo" src={this.logo}/></Link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="web-layout">
|
|
|
|
<div className="web-layout">
|
|
|
@ -131,7 +144,7 @@ class Dashboard extends React.Component {
|
|
|
|
<Menu.Item key="web-clip">
|
|
|
|
<Menu.Item key="web-clip">
|
|
|
|
<Link to="/store/web-clip">
|
|
|
|
<Link to="/store/web-clip">
|
|
|
|
<Icon type="upload"/>
|
|
|
|
<Icon type="upload"/>
|
|
|
|
Web Clips
|
|
|
|
Web Clips
|
|
|
|
</Link>
|
|
|
|
</Link>
|
|
|
|
</Menu.Item>
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
|
|
|
@ -140,7 +153,7 @@ class Dashboard extends React.Component {
|
|
|
|
<span className="submenu-title-wrapper">
|
|
|
|
<span className="submenu-title-wrapper">
|
|
|
|
<Icon type="user"/>
|
|
|
|
<Icon type="user"/>
|
|
|
|
{this.config.user}
|
|
|
|
{this.config.user}
|
|
|
|
</span> }>
|
|
|
|
</span>}>
|
|
|
|
<Logout/>
|
|
|
|
<Logout/>
|
|
|
|
</SubMenu>
|
|
|
|
</SubMenu>
|
|
|
|
</Menu>
|
|
|
|
</Menu>
|
|
|
@ -156,32 +169,32 @@ class Dashboard extends React.Component {
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|
<Drawer
|
|
|
|
<Drawer
|
|
|
|
title={<Link to="/store/android" onClick={this.onCloseMobileNavigationBar}>
|
|
|
|
title={<Link to="/store" onClick={this.onCloseMobileNavigationBar}>
|
|
|
|
<img alt="logo" src={this.logo} style={{marginLeft: 30}} width={"60%"}/>
|
|
|
|
<img alt="logo" src={this.logo} style={{marginLeft: 30}} width={"60%"}/>
|
|
|
|
</Link>}
|
|
|
|
</Link>}
|
|
|
|
placement="left"
|
|
|
|
placement="left"
|
|
|
|
closable={false}
|
|
|
|
closable={false}
|
|
|
|
onClose={this.onCloseMobileNavigationBar}
|
|
|
|
onClose={this.onCloseMobileNavigationBar}
|
|
|
|
visible={this.state.visible}
|
|
|
|
visible={this.state.visible}
|
|
|
|
getContainer={false}
|
|
|
|
getContainer={false}
|
|
|
|
style={{position: 'absolute'}}>
|
|
|
|
style={{position: 'absolute'}}>
|
|
|
|
<Menu
|
|
|
|
<Menu
|
|
|
|
theme="light"
|
|
|
|
theme="light"
|
|
|
|
mode="inline"
|
|
|
|
mode="inline"
|
|
|
|
defaultSelectedKeys={selectedKeys}
|
|
|
|
defaultSelectedKeys={selectedKeys}
|
|
|
|
style={{lineHeight: '64px', width: 231}}
|
|
|
|
style={{lineHeight: '64px', width: 231}}
|
|
|
|
onClick={this.onCloseMobileNavigationBar}>
|
|
|
|
onClick={this.onCloseMobileNavigationBar}>
|
|
|
|
|
|
|
|
|
|
|
|
{DeviceTypesData}
|
|
|
|
{DeviceTypesData}
|
|
|
|
|
|
|
|
|
|
|
|
<Menu.Item key="web-clip">
|
|
|
|
<Menu.Item key="web-clip">
|
|
|
|
<Link to="/store/web-clip">
|
|
|
|
<Link to="/store/web-clip">
|
|
|
|
<Icon type="upload"/>Web Clips
|
|
|
|
<Icon type="upload"/>Web Clips
|
|
|
|
</Link>
|
|
|
|
</Link>
|
|
|
|
</Menu.Item>
|
|
|
|
</Menu.Item>
|
|
|
|
</Menu>
|
|
|
|
</Menu>
|
|
|
|
</Drawer>
|
|
|
|
</Drawer>
|
|
|
|
<Layout className="mobile-layout">
|
|
|
|
<Layout className="mobile-layout">
|
|
|
|
<Menu
|
|
|
|
<Menu
|
|
|
|
mode="horizontal"
|
|
|
|
mode="horizontal"
|
|
|
@ -198,6 +211,13 @@ class Dashboard extends React.Component {
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|
|
|
|
|
|
|
|
|
<Layout className="dashboard-body">
|
|
|
|
<Layout className="dashboard-body">
|
|
|
|
|
|
|
|
{(forbiddenErrors.deviceTypes) && (
|
|
|
|
|
|
|
|
<Alert
|
|
|
|
|
|
|
|
message="You don't have permission to view device types."
|
|
|
|
|
|
|
|
type="warning"
|
|
|
|
|
|
|
|
banner
|
|
|
|
|
|
|
|
closable/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
<Content style={{padding: '0 0'}}>
|
|
|
|
<Content style={{padding: '0 0'}}>
|
|
|
|
<Switch>
|
|
|
|
<Switch>
|
|
|
|
{this.state.routes.map((route) => (
|
|
|
|
{this.state.routes.map((route) => (
|
|
|
|