|
|
@ -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);
|
|
|
|
|
|
|
|
if (error.hasOwnProperty("response") && error.response.status === 403) {
|
|
|
|
|
|
|
|
const {forbiddenErrors} = this.state;
|
|
|
|
|
|
|
|
forbiddenErrors.deviceTypes = true;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
forbiddenErrors,
|
|
|
|
|
|
|
|
loading: false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
loading: false
|
|
|
|
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">
|
|
|
@ -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>
|
|
|
@ -157,7 +170,7 @@ class Dashboard extends React.Component {
|
|
|
|
</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"
|
|
|
@ -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) => (
|
|
|
|