Basic dashboard components (#548)
* Update `cvat.js` * Update metadata * Minor refactoring * Using sass * Dashboard components structure * Add paginationmain
parent
021b77ccee
commit
59cd9260c3
File diff suppressed because one or more lines are too long
@ -1,3 +0,0 @@
|
||||
.Dashboard {
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import DashboardContent from './dashboard-content';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<DashboardContent />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
||||
@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import DashboardFooter from './dashboard-footer';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<DashboardFooter />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
||||
@ -0,0 +1,25 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { Layout, Pagination } from 'antd';
|
||||
|
||||
import './dashboard-footer.scss';
|
||||
|
||||
const { Footer } = Layout;
|
||||
|
||||
class DashboardFooter extends Component<any, any> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
render() {
|
||||
return(
|
||||
<Footer>
|
||||
<Pagination onChange={ this.props.onPageChange } total={ this.props.tasksCount } />
|
||||
</Footer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default DashboardFooter;
|
||||
@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import DashboardHeader from './dashboard-header';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<DashboardHeader />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
||||
@ -0,0 +1,72 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { Layout, Row, Col, Button, Input } from 'antd';
|
||||
|
||||
import './dashboard-header.scss';
|
||||
|
||||
const { Header } = Layout;
|
||||
const { Search } = Input;
|
||||
|
||||
interface DashboardHeaderAction {
|
||||
id: number,
|
||||
name: string,
|
||||
trigger: any,
|
||||
}
|
||||
|
||||
class DashboardHeader extends Component<any, any> {
|
||||
actions: DashboardHeaderAction[];
|
||||
hostUrl: string;
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
this.state = {};
|
||||
|
||||
this.hostUrl = 'http://localhost:7000';
|
||||
|
||||
this.actions = [
|
||||
// {
|
||||
// id: 1,
|
||||
// name: 'Create task',
|
||||
// trigger: this.props.onSearch,
|
||||
// },
|
||||
{
|
||||
id: 2,
|
||||
name: 'User guide',
|
||||
trigger: this.openUserGuide,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
render() {
|
||||
return(
|
||||
<Header>
|
||||
<Row type="flex">
|
||||
<Col span={8}>
|
||||
Tasks
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Search placeholder="Search for tasks" onSearch={ query => this.props.onSearch(query) } enterButton />
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
{
|
||||
this.actions.map(
|
||||
(action: DashboardHeaderAction) => (
|
||||
<Button type="primary" key={ action.id } onClick={ () => action.trigger() }>
|
||||
{ action.name }
|
||||
</Button>
|
||||
)
|
||||
)
|
||||
}
|
||||
</Col>
|
||||
</Row>
|
||||
</Header>
|
||||
);
|
||||
}
|
||||
|
||||
private openUserGuide = () => {
|
||||
window.open(`${this.hostUrl}/documentation/user_guide.html`, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
export default DashboardHeader;
|
||||
Loading…
Reference in New Issue