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

Issue 241 #245

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
472d038
user_get backend
linazh Dec 30, 2017
5cf1464
User component
linazh Dec 30, 2017
5800c44
fixed conflicts
linazh Dec 30, 2017
3a08202
fixed conflicts User component
linazh Dec 30, 2017
6d15e35
merge changes
linazh Dec 30, 2017
26b96f8
fixed merging
linazh Dec 30, 2017
0b01980
unit tests for user_get
linazh Jan 24, 2018
c466e03
unit and functional tests for user_get
linazh Jan 24, 2018
cb593ae
fixed user groups_dict & added functional test for groups
linazh Jan 27, 2018
88e26fb
changed userdata->user & fixed user component
linazh Jan 27, 2018
ec5c63e
changed userdata->user & fixed user component
linazh Jan 27, 2018
2576ba1
user_get backend
linazh Dec 30, 2017
5016432
User component
linazh Dec 30, 2017
23d68d7
fixed conflicts
linazh Dec 30, 2017
bdc2c11
fixed conflicts User component
linazh Dec 30, 2017
9ef8678
fixed merging
linazh Dec 30, 2017
145a32a
unit tests for user_get
linazh Jan 24, 2018
84b7da7
unit and functional tests for user_get
linazh Jan 24, 2018
0d897f0
fixed user groups_dict & added functional test for groups
linazh Jan 27, 2018
aaac3c5
changed userdata->user & fixed user component
linazh Jan 27, 2018
331ade1
changed userdata->user & fixed user component
linazh Jan 27, 2018
5eff18a
merging fixes
linazh Jan 27, 2018
b19c044
TeamTask page
linazh Feb 6, 2018
901eb31
fixing TeamTask page
linazh Feb 9, 2018
26a6a51
fixing TeamTask centering mobile
linazh Feb 9, 2018
9135bd4
fixing TeamTask header2
linazh Feb 9, 2018
47ab051
fixing TeamTask page - desktop
linazh Feb 24, 2018
7bedb6d
Merge branch 'dev' of https://github.com/InformaticsMskRu/informatics…
linazh Feb 28, 2018
b77c16c
fixing TeamTask page - mobile (header)
linazh Feb 28, 2018
0fb1dbe
fixing TeamTask page - mobile (centering)
linazh Feb 28, 2018
29f9a54
TeamTask page - PopConfirm design
linazh Mar 15, 2018
bf41cdd
TeamTask page - PopConfirm button functions
linazh Mar 15, 2018
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
21 changes: 11 additions & 10 deletions pynformatics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def main(global_config, **settings):
config.add_route('user_settings.get', '/user/settings/main/get/{user_id}')
config.add_route('user.set_oauth_id', '/user/set_oauth_id')
config.add_route('user.reset_password', '/user/reset_password')

config.add_route('user_data.get', '/user/{user_id}')

config.add_route('comment.add', '/comment/add')
config.add_route('comment.get', '/comment/get/{contest_id}/{run_id}')
config.add_route('comment.get_count', '/comment/count')
Expand All @@ -57,19 +58,19 @@ def main(global_config, **settings):
config.add_route('comment.get_unread_limit', '/comment/unread/{start}/{stop}')
config.add_route('comment.get_unread_limit_html', '/comment/unread/{start}/{stop}/html')
config.add_route('comment.get_count_unread', '/comment/unread/count')

config.add_route('protocol.get', '/protocol/get/{contest_id}/{run_id}')
config.add_route('protocol.get_v2', '/protocol/get_v2/{contest_id}/{run_id}')
config.add_route('protocol.get_full', '/protocol/get-full/{contest_id}/{run_id}')
config.add_route('protocol.get_test', '/protocol/get_test/{contest_id}/{run_id}/{test_num}')
config.add_route('protocol.get_corr', '/protocol/get_corr/{contest_id}/{run_id}/{test_num}')
config.add_route('protocol.get_outp', '/protocol/get_output/{contest_id}/{run_id}/{test_num}')
config.add_route('protocol.get_submit_archive', '/protocol/get_submit_archive/{contest_id}/{run_id}')

config.add_route('run.rejudge', '/run/rejudge/{contest_id}/{run_id}/{status_id}')

config.add_route('team_monitor.get', '/team_monitor/get/{statement_id}')

config.add_route('contest.ejudge.reload.problem', '/contest/ejudge/reload/{contest_id}/{problem_id}')

config.add_route('problem.generate_samples', '/problem/{problem_id}/generate_samples')
Expand All @@ -85,23 +86,23 @@ def main(global_config, **settings):
config.add_route('problem.tests.get_test', '/problem/{problem_id}/tests/test/{test_num}')
config.add_route('problem.tests.set_preliminary', '/problem/{problem_id}/tests/set_preliminary')
config.add_route('problem.ant.submit', '/problem-ant/{problem_id}/submit')

config.add_route('contest.ejudge.reload', '/contest/ejudge/reload/{contest_id}')
config.add_route('contest.ejudge.get_table', '/contest/ejudge/get_table')
config.add_route('contest.ejudge.statistic', '/contest/ejudge/statistic')
config.add_route('contest.ejudge.clone', '/contest/ejudge/clone/{contest_id}')

config.add_route('region.submit', '/region/res')
config.add_route('region.submit_test', '/region/res_test')

config.add_route('rating.get', '/rating/get')

config.add_route('user.query', '/myuser')

config.add_route('search.user', '/search/user')

config.add_route('home', '/')

config.add_route('hint.get', '/hint/get')
config.add_route('hint.get_html', '/hint/get_html')
config.add_route('hint.get_by_problem', '/hint/get_by_problem')
Expand Down
22 changes: 22 additions & 0 deletions pynformatics/frontend/src/js/actions/userActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,25 @@ export function oauthConnect(provider, code) {
});
};
}

export function fetchUser(userId) {
const url = `/user/${userId}`;

console.log("action", url);

axios.get(url)
.then(function (response) {
console.log("axios", response);
})
.catch(function (error) {
console.log("axios", error);
});

return {
type: 'GET_USER',
payload: axios.get(url),
meta: {
userId,
},
};
}
4 changes: 4 additions & 0 deletions pynformatics/frontend/src/js/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import Sidebar from './Sidebar/Sidebar';

import StatementPage from '../pages/Statement/Statement';
import MainPage from '../pages/Main/Main';
import TeamTask from '../pages/Team/TeamTask';
import Auth from '../pages/Auth/Auth';
import ProblemPage from '../pages/Problem/Problem';
import TempGotoProblemPage from '../pages/TempGotoProblem';

import User from './User';
import StatementAdmin from '../pages/StatementAdmin';
import StatementSettingsForm from './StatementSettingsForm';

Expand Down Expand Up @@ -74,6 +76,7 @@ export default class App extends React.Component {
<Route exact path="/goto" component={TempGotoProblemPage} />
<Route exact path="/login" component={Login} />
<Route exact path="/problem/:problemId" component={ProblemPage} />
<Route exact path="/team-task" component={TeamTask} />
</Switch>
</Content>
</Layout>
Expand Down Expand Up @@ -127,6 +130,7 @@ export default class App extends React.Component {
// )
// }
// />
// <Route exact path="/user/:userId" component={User} />
// </Switch>
// </div>
// </div>
Expand Down
46 changes: 46 additions & 0 deletions pynformatics/frontend/src/js/components/User.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import { connect } from 'react-redux';

import * as userActions from '../actions/userActions';


@connect(state => ({
user: state.user,
}))
export default class User extends React.Component {
constructor(props) {
super(props);
this.userId = parseInt(this.props.match.params.userId, 10);
console.log("constr", this.userId);
this.fetchUser(this.userId);
}

fetchUser(userId) {
this.props.dispatch(userActions.fetchUser(userId));
}

render() {
const data = this.props.user[this.userId];

console.log("!! componenta ", data);

if (!data) {
return <div> user data not found </div>
}

return (
<div>
<h1>Name: {data.firstname} {data.lastname}</h1>
<h3>Email:</h3> {data.email}
<h3>Groups:</h3>
<ul>
{Object.keys(data.groups).map(id =>
<li key={id}>
id: {id}, name: {data.groups[id]}
</li>
)}
</ul>
</div>
);
}
}
75 changes: 75 additions & 0 deletions pynformatics/frontend/src/js/components/utility/PopConfirm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react';
import styled, { injectGlobal } from 'styled-components';

import {
rowStyle,
Row,
} from '../../components/utility/Grid';

import Button from './Button'
import Tooltip from './Tooltip';


injectGlobal`
.PopConfirmWrapper {
.ant-tooltip-arrow { display: none; }
.ant-tooltip-inner {
background: #FFFFFF;
padding: 20px;
max-width: 300px;
border-radius: 6px;
box-shadow: 0 0 24px 0 rgba(182, 189, 197, 0.42);
}
}
`;

const PopConfirmTitleWrapper = styled.div`
font-size: 14px;
color: #343a40;
`;

const PopConfirmTitle = ({title}) => (
<PopConfirmTitleWrapper>{title}</PopConfirmTitleWrapper>
);

export default class PopConfirm extends React.Component {
constructor(props) {
super(props);
this.state = {visible: false};
this.closeFunction = this.closeFunction.bind(this);
}
closeFunction = (func) => {
this.setState({...this.state, visible: false});
func();
};
render() {
return (
<Tooltip
trigger="onclick"
placement={this.props.placement}
overlayClassName="PopConfirmWrapper"
visible={this.state.visible}
onVisibleChange = {() => this.setState({...this.state, visible: !this.state.visible})}
title={
<div>
<Row style={{...rowStyle, marginBottom: '20px'}}>
<PopConfirmTitle title={this.props.title}/>
</Row>
<Row style={rowStyle}>
<Button type="primary" size="small"
onClick={() => {this.closeFunction(this.props.onConfirm)}} style={{marginRight: '15px'}}>
{this.props.okText}
</Button>
<Button type="primary" size="small"
onClick={() => {this.closeFunction(this.props.onCancel)}}>
{this.props.cancelText}
</Button>
</Row>
</div>
}
>
{this.props.children}
</Tooltip>
);
}
}
119 changes: 119 additions & 0 deletions pynformatics/frontend/src/js/components/utility/TeamTaskWrapper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import MainContentWrapper from './MainContentWrapper';

const TeamTaskWrapper = MainContentWrapper.extend`
padding-top: 86px;

.title_contest {
width: 222px;
height: 26px;
margin-top: 41.5px;

font-size: 20px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: 0.6px;
text-align: left;
color: #393a39;
}

.title_team {
width: 222px;
height: 21px;
margin-top: 46.5px;

font-size: 16px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: 0.6px;
text-align: left;
color: #2d3446;
}

.text_block {
width: 365px;
height: 140px;
margin-top: 28.5px;

font-size: 14px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.5;
letter-spacing: normal;
text-align: left;
color: #343a40;
}

@media (max-width: 767px) {
width: 100%;
height: 100%;
margin: 0 auto;

.title_contest {
width: 100%;
height: 40px;
line-height: 40px;
margin-top: 17px;

font-size: 18px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
letter-spacing: 0.6px;
text-align: left;
color: #788195;

display: flex;
align-items: center;
white-space: nowrap;

&:before {
content: '';
width: 5px;
height: 40px;
margin-right: 15px;

background: #e1e6ec;
display: flex;
}

&:after {
content: '';
width: 100%;
height: 1px;
line-height: 40px;
margin-left: 15px;

background: #e1e6ec;
display: flex;
}
}

.title_team {
width: 214px;
height: 21px;
margin-top: 27px;
}

.text_block {
max-width: 344px;
width: auto;
margin-top: 28.5px;

font-size: 13px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.62;
letter-spacing: normal;
text-align: left;
color: #343a40;
}
}
`;

export default TeamTaskWrapper;
Loading