Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW-UI] Add dashboard component #521

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "cvat-ui",
"version": "0.1.0",
"license": "MIT",
"private": true,
"dependencies": {
"@types/jest": "24.0.13",
"@types/node": "12.0.3",
"@types/node": "^12.0.3",
"@types/react": "16.8.19",
"@types/react-dom": "16.8.4",
"@types/react-router-dom": "^4.3.4",
"antd": "^3.19.1",
"babel-plugin-import": "^1.11.2",
"customize-cra": "^0.2.12",
Expand All @@ -15,6 +17,7 @@
"react": "^16.8.6",
"react-app-rewired": "^2.1.3",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1",
"source-map-explorer": "^1.8.0",
"typescript": "3.4.5"
Expand Down
22 changes: 22 additions & 0 deletions cvat-ui/public/cvat.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cvat-ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>

<script src="./cvat.min.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
6 changes: 0 additions & 6 deletions cvat-ui/src/App.css

This file was deleted.

15 changes: 0 additions & 15 deletions cvat-ui/src/App.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions cvat-ui/src/components/app/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.App {

}
File renamed without changes.
21 changes: 21 additions & 0 deletions cvat-ui/src/components/app/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Redirect } from 'react-router-dom';

import Dashboard from '../dashboard/Dashboard';

import './App.css';

class App extends Component {
render() {
return(
<Router>
<div>
<Redirect from="/" to="dashboard" />
<Route path="/dashboard" component={Dashboard} />
</div>
</Router>
);
}
}

export default App;
3 changes: 3 additions & 0 deletions cvat-ui/src/components/dashboard/Dashboard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Dashboard {

}
9 changes: 9 additions & 0 deletions cvat-ui/src/components/dashboard/Dashboard.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Dashboard from './Dashboard';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<Dashboard />, div);
ReactDOM.unmountComponentAtNode(div);
});
40 changes: 40 additions & 0 deletions cvat-ui/src/components/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { Component } from 'react';

import './Dashboard.css';

declare const window: any;

class Dashboard extends Component {
constructor(props: any) {
super(props);
}
componentWillMount() {
window.cvat.server.login('admin', 'admin').then(
(response: any) => {
console.log(response);
},
(error: any) => {
console.log(error);
}
);

window.cvat.tasks.get().then(
(response: any) => {
console.log(response);
},
(error: any) => {
console.log(error);
}
);
}

render() {
return(
<div className="Dashboard">

</div>
);
}
}

export default Dashboard;
11 changes: 8 additions & 3 deletions cvat-ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';

import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
import './index.css';
import App from './components/app/App';

ReactDOM.render(
<App />,
document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
Expand Down
Empty file added cvat-ui/src/utils/.gitkeep
Empty file.
Loading