blob: 44038426bec647560c5a0da6883d68bfedecf542 [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 { Link, Redirect, Switch, Route } from 'dva/router';
import DocumentTitle from 'react-document-title';
import { Icon } from 'antd';
import GlobalFooter from '../components/GlobalFooter';
import styles from './UserLayout.less';
import logo from '../assets/sw-2.png';
import { getRoutes } from '../utils/utils';
const copyright = <div>Copyright <Icon type="copyright" /> 2017 - 2019 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.</div>;
class UserLayout extends React.PureComponent {
getPageTitle() {
const { routerData, location } = this.props;
const { pathname } = location;
let title = 'SkyWalking';
if (routerData[pathname] && routerData[pathname].name) {
title = `${routerData[pathname].name} - SkyWalking`;
}
return title;
}
render() {
const { routerData, match } = this.props;
return (
<DocumentTitle title={this.getPageTitle()}>
<div className={styles.container}>
<div className={styles.content}>
<div className={styles.top}>
<div className={styles.header}>
<Link to="/">
<img alt="logo" className={styles.logo} src={logo} />
<span className={styles.title}>Apache SkyWalking</span>
</Link>
</div>
<div className={styles.desc}>Apache SkyWalking APM System</div>
</div>
<Switch>
{getRoutes(match.path, routerData).map(item =>
(
<Route
key={item.key}
path={item.path}
component={item.component}
exact={item.exact}
/>
)
)}
<Redirect exact from="/user" to="/user/login" />
</Switch>
</div>
<GlobalFooter copyright={copyright} />
</div>
</DocumentTitle>
);
}
}
export default UserLayout;