Skip to content

Commit

Permalink
Merge branch 'master' into fix-creating-group-sis
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloop committed Nov 6, 2017
2 parents 54a31dd + 9476622 commit 47ebd4c
Show file tree
Hide file tree
Showing 73 changed files with 1,516 additions and 1,271 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ NODE_ENV=development
API_BASE=http://localhost:4000/v1
PORT=8080
WEBPACK_DEV_SERVER_PORT=8081
TITLE=ReCodEx
ALLOW_NORMAL_REGISTRATION=true
ALLOW_LDAP_REGISTRATION=false
ALLOW_CAS_REGISTRATION=true
```

## Run Dev
Expand All @@ -37,7 +41,7 @@ yarn build
yarn start
```

Consider using [PM2](http://pm2.keymetrics.io/) or similar tool to run the `yarn start` command to prevent crashes of the web service.
Consider using [PM2](http://pm2.keymetrics.io/) or similar tool to run the `yarn start` command to prevent crashes of the web service. It is wise to use watch mode of PM2 in `prod/` subdirectory and deploy the app using `yarn deploy` command.

## License

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { List } from 'immutable';
import { Table } from 'react-bootstrap';
import { FormattedMessage } from 'react-intl';
import { FormattedMessage, injectIntl } from 'react-intl';

import AdminAssignmentsTableRow from './AdminAssignmentsTableRow';
import NoAssignmentsTableRow from './NoAssignmentsTableRow';
import LoadingAssignmentTableRow from './LoadingAssignmentTableRow';
import ResourceRenderer from '../../helpers/ResourceRenderer';

const AdminAssignmentsTable = ({ assignments = List() }) => (
const AdminAssignmentsTable = ({ assignments = List(), intl: { locale } }) =>
<Table hover>
<thead>
<tr>
Expand Down Expand Up @@ -51,25 +51,28 @@ const AdminAssignmentsTable = ({ assignments = List() }) => (
>
{(...assignments) =>
assignments.length === 0
? <tbody><NoAssignmentsTableRow /></tbody>
? <tbody>
<NoAssignmentsTableRow />
</tbody>
: <tbody>
{assignments
.sort((a, b) => a.firstDeadline - b.firstDeadline)
.map(assignment => (
.map(assignment =>
<AdminAssignmentsTableRow
key={assignment.id}
{...assignment}
locale={locale}
/>
))}
)}
</tbody>}
</ResourceRenderer>
</Table>
);
</Table>;

AdminAssignmentsTable.propTypes = {
assignments: ImmutablePropTypes.list.isRequired,
showGroup: PropTypes.bool,
statuses: PropTypes.object
statuses: PropTypes.object,
intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired
};

export default AdminAssignmentsTable;
export default injectIntl(AdminAssignmentsTable);
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { FormattedDate, FormattedTime, FormattedMessage } from 'react-intl';
import { ButtonGroup } from 'react-bootstrap';
import Button from '../../widgets/FlatButton';
import { LinkContainer } from 'react-router-bootstrap';
import DeleteAssignmentButtonContainer
from '../../../containers/DeleteAssignmentButtonContainer';
import DeleteAssignmentButtonContainer from '../../../containers/DeleteAssignmentButtonContainer';

import withLinks from '../../../hoc/withLinks';
import { getLocalizedName } from '../../../helpers/getLocalizedData';
import {
EditIcon,
MaybePublicIcon,
Expand All @@ -20,30 +20,36 @@ const AdminAssignmentTableRow = ({
isPublic,
name,
allowSecondDeadline,
localizedTexts,
firstDeadline,
secondDeadline,
isBonus,
locale,
links: {
ASSIGNMENT_DETAIL_URI_FACTORY: detail,
ASSIGNMENT_EDIT_URI_FACTORY: edit
}
}) => (
}) =>
<tr>
<td className="text-center">
<MaybePublicIcon id={id} isPublic={isPublic} />
</td>
<td>
<MaybeBonusAssignmentIcon id={id} isBonus={isBonus} />
<Link to={detail(id)}>{name}</Link>
<Link to={detail(id)}>
{getLocalizedName({ name, localizedTexts }, locale)}
</Link>
</td>
<td>
<FormattedDate value={new Date(firstDeadline * 1000)} />{', '}
<FormattedDate value={new Date(firstDeadline * 1000)} />
{', '}
<FormattedTime value={new Date(firstDeadline * 1000)} />
</td>
<td>
{allowSecondDeadline
? <span>
<FormattedDate value={new Date(secondDeadline * 1000)} />{', '}
<FormattedDate value={new Date(secondDeadline * 1000)} />
{', '}
<FormattedTime value={new Date(secondDeadline * 1000)} />
</span>
: <span>-</span>}
Expand All @@ -52,8 +58,7 @@ const AdminAssignmentTableRow = ({
<ButtonGroup>
<LinkContainer to={edit(id)}>
<Button bsSize="xs" bsStyle="warning">
<EditIcon />
{' '}
<EditIcon />{' '}
<FormattedMessage
id="app.adminAssignmentsTableRow.edit"
defaultMessage="Edit"
Expand All @@ -63,19 +68,20 @@ const AdminAssignmentTableRow = ({
<DeleteAssignmentButtonContainer id={id} bsSize="xs" />
</ButtonGroup>
</td>
</tr>
);
</tr>;

AdminAssignmentTableRow.propTypes = {
id: PropTypes.any.isRequired,
isPublic: PropTypes.bool.isRequired,
isBonus: PropTypes.bool.isRequired,
name: PropTypes.string.isRequired,
localizedTexts: PropTypes.array.isRequired,
firstDeadline: PropTypes.number.isRequired,
allowSecondDeadline: PropTypes.bool.isRequired,
secondDeadline: PropTypes.number.isRequired,
groupId: PropTypes.string,
links: PropTypes.object
links: PropTypes.object,
locale: PropTypes.string.isRequired
};

export default withLinks(AdminAssignmentTableRow);
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const AssignmentStatusIcon = ({ id, status, accepted = false }) => {
return (
<Status
id={id}
accepted={accepted}
icon={<Icon name="thumbs-o-down" className="text-red" />}
message={
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import AssignmentStatusIcon from '../AssignmentStatusIcon/AssignmentStatusIcon';
import { FormattedDate, FormattedTime } from 'react-intl';

import withLinks from '../../../../hoc/withLinks';
import { getLocalizedName } from '../../../../helpers/getLocalizedData';
import { MaybeBonusAssignmentIcon } from '../../../icons';

const AssignmentTableRow = ({
Expand All @@ -13,6 +14,7 @@ const AssignmentTableRow = ({
id,
name,
group,
localizedTexts,
allowSecondDeadline,
firstDeadline,
secondDeadline,
Expand All @@ -21,11 +23,12 @@ const AssignmentTableRow = ({
},
status,
userId,
locale,
links: {
ASSIGNMENT_DETAIL_URI_FACTORY,
ASSIGNMENT_DETAIL_SPECIFIC_USER_URI_FACTORY
}
}) => (
}) =>
<tr>
<td className="text-center">
<AssignmentStatusIcon id={id} status={status} accepted={accepted} />
Expand All @@ -39,37 +42,43 @@ const AssignmentTableRow = ({
: ASSIGNMENT_DETAIL_URI_FACTORY(id)
}
>
{name}
{getLocalizedName({ name, localizedTexts }, locale)}
</Link>
</td>
{showGroup && <td>{group}</td>}
{showGroup &&
<td>
{group}
</td>}
<td>
<FormattedDate value={new Date(firstDeadline * 1000)} />{', '}
<FormattedDate value={new Date(firstDeadline * 1000)} />
{', '}
<FormattedTime value={new Date(firstDeadline * 1000)} />
</td>
<td>
{allowSecondDeadline
? <span>
<FormattedDate value={new Date(secondDeadline * 1000)} />{', '}
<FormattedDate value={new Date(secondDeadline * 1000)} />
{', '}
<FormattedTime value={new Date(secondDeadline * 1000)} />
</span>
: <span>-</span>}
</td>
</tr>
);
</tr>;

AssignmentTableRow.propTypes = {
showGroup: PropTypes.bool,
item: PropTypes.shape({
id: PropTypes.any.isRequired,
name: PropTypes.string.isRequired,
localizedTexts: PropTypes.array.isRequired,
firstDeadline: PropTypes.number.isRequired,
secondDeadline: PropTypes.number.isRequired,
groupId: PropTypes.string
}),
status: PropTypes.string,
userId: PropTypes.string,
links: PropTypes.object
links: PropTypes.object,
locale: PropTypes.string.isRequired
};

export default withLinks(AssignmentTableRow);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { List } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Table } from 'react-bootstrap';
import { FormattedMessage } from 'react-intl';
import { FormattedMessage, injectIntl } from 'react-intl';

import {
isReady,
Expand Down Expand Up @@ -48,7 +48,8 @@ const AssignmentsTable = ({
assignments = List(),
statuses = [],
showGroup = true,
userId = null
userId = null,
intl: { locale }
}) =>
<Table hover>
<thead>
Expand Down Expand Up @@ -97,6 +98,7 @@ const AssignmentsTable = ({
userId={userId}
showGroup={showGroup}
status={statuses[assignment.id]}
locale={locale}
/>
)}
</tbody>
Expand All @@ -106,7 +108,8 @@ AssignmentsTable.propTypes = {
assignments: ImmutablePropTypes.list.isRequired,
showGroup: PropTypes.bool,
statuses: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
userId: PropTypes.string
userId: PropTypes.string,
intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired
};

export default AssignmentsTable;
export default injectIntl(AssignmentsTable);
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ const FailedSubmissionTableRow = ({
note,
submittedAt,
maxPoints,
evaluation: { score, points, bonusPoints }
}) => (
evaluation: { score, points, bonusPoints },
accepted
}) =>
<tr>
<td><AssignmentStatusIcon id={link} status="failed" /></td>
<td>
<AssignmentStatusIcon id={link} status="failed" accepted={accepted} />
</td>
<td>
<FormattedDate value={submittedAt * 1000} />
&nbsp;
Expand Down Expand Up @@ -49,8 +52,7 @@ const FailedSubmissionTableRow = ({
/>
</Link>
</td>
</tr>
);
</tr>;

FailedSubmissionTableRow.propTypes = {
link: PropTypes.string.isRequired,
Expand All @@ -60,7 +62,8 @@ FailedSubmissionTableRow.propTypes = {
evaluation: PropTypes.shape({
score: PropTypes.number.isRequired,
points: PropTypes.number.isRequired
}).isRequired
}).isRequired,
accepted: PropTypes.bool
};

export default FailedSubmissionTableRow;
Loading

0 comments on commit 47ebd4c

Please sign in to comment.