Skip to content

Commit

Permalink
Merge pull request #148 from ReCodEx/simple_exercise_form
Browse files Browse the repository at this point in the history
Create exercises with new simple form
  • Loading branch information
SemaiCZE committed Dec 14, 2017
2 parents 1fa274f + a8a5d48 commit efce550
Show file tree
Hide file tree
Showing 96 changed files with 4,634 additions and 1,814 deletions.
8 changes: 8 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ ALLOW_NORMAL_REGISTRATION=true
ALLOW_LDAP_REGISTRATION=false
ALLOW_CAS_REGISTRATION=true


# LOGGER_MIDDLEWARE is active only if NODE_ENV=development

# verbose debug action logging
LOGGER_MIDDLEWARE_VERBOSE=false

# log complete dump of exceptions
LOGGER_MIDDLEWARE_EXCEPTIONS=true
4 changes: 3 additions & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ module.exports = {
"'" + process.env.ALLOW_NORMAL_REGISTRATION + "'",
ALLOW_LDAP_REGISTRATION:
"'" + process.env.ALLOW_LDAP_REGISTRATION + "'",
ALLOW_CAS_REGISTRATION: "'" + process.env.ALLOW_CAS_REGISTRATION + "'"
ALLOW_CAS_REGISTRATION: "'" + process.env.ALLOW_CAS_REGISTRATION + "'",
LOGGER_MIDDLEWARE_VERBOSE: "'" + process.env.LOGGER_MIDDLEWARE_VERBOSE + "'",
LOGGER_MIDDLEWARE_EXCEPTIONS: "'" + process.env.LOGGER_MIDDLEWARE_EXCEPTIONS + "'",
},
gitRevision: {
VERSION: JSON.stringify(gitRevisionPlugin.version()),
Expand Down
34 changes: 16 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
},
"dependencies": {
"admin-lte": "2.3.11",
"ajv": "5.5.1",
"ajv-keywords": "2.1.1",
"babel-plugin-react-intl": "^2.1.3",
"bluebird": "^3.3.5",
"browser-cookies": "^1.0.8",
Expand All @@ -48,39 +50,35 @@
"global": "^4.3.1",
"immutable": "^3.8.1",
"isomorphic-fetch": "^2.2.1",
"js-yaml": "^3.10.0",
"jwt-decode": "^2.0.1",
"moment": "^2.18.1",
"pretty-bytes": "^3.0.1",
"pretty-ms": "^2.1.0",
"prop-types": "^15.5.8",
"react": "^15.5.4",
"react-ace": "^4.2.1",
"react-bootstrap": "^0.31.2",
"react-codemirror": "^0.3.0",
"react": "^16.2.0",
"react-ace": "5.8.0",
"react-bootstrap": "0.31.5",
"react-collapse": "^4.0.2",
"react-copy-to-clipboard": "^5.0.1",
"react-datetime": "^2.8.10",
"react-dom": "^15.5.4",
"react-dom": "^16.2.0",
"react-dropzone": "^3.5.3",
"react-fontawesome": "^1.1.0",
"react-fontawesome": "1.6.1",
"react-height": "^3.0.0",
"react-helmet": "^5.0.3",
"react-immutable-proptypes": "^2.1.0",
"react-intl": "^2.1.3",
"react-motion": "^0.5.0",
"react-intl": "2.4.0",
"react-motion": "^0.5.2",
"react-redux": "^5.0.4",
"react-remarkable": "^1.1.2",
"react-responsive": "^1.1.3",
"react-router": "^3.0.0",
"react-router": "3.2.0",
"react-router-bootstrap": "^0.23.3",
"react-router-redux": "^4.0.8",
"react-rte": "^0.11.0",
"react-table": "^6.0.0",
"react-throttle": "^0.3.0",
"react-toggle": "^3.0.1",
"react-toggle": "4.0.2",
"redux": "^3.5.1",
"redux-actions": "^2.0.3",
"redux-form": "^6.2.1",
"redux-form": "7.2.0",
"redux-promise-middleware": "^4.2.0",
"redux-storage": "^4.1.2",
"redux-storage-decorator-filter": "^1.1.8",
Expand Down Expand Up @@ -118,7 +116,7 @@
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.0.0",
"eslint-plugin-standard": "^3.0.1",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"extract-text-webpack-plugin": "3.0.2",
"fetch-mock": "^5.10.0",
"file-loader": "^0.11.1",
"git-revision-webpack-plugin": "^2.5.1",
Expand All @@ -143,9 +141,9 @@
"scroll-behavior": "^0.4.0",
"strip-loader": "^0.1.2",
"style-loader": "^0.17.0",
"webpack": "^2.5.1",
"webpack": "3.10.0",
"webpack-dev-middleware": "^1.10.2",
"webpack-dev-server": "^2.4.5",
"webpack-dev-server": "2.9.7",
"webpack-isomorphic-tools": "^3.0.2"
}
}
116 changes: 116 additions & 0 deletions src/components/Assignments/Assignment/AssignmentSync/AssignmentSync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { Row, Col, Alert } from 'react-bootstrap';

import Button from '../../../widgets/FlatButton';

const AssignmentSync = ({ syncInfo, exerciseSync }) =>
!syncInfo.exerciseConfig.upToDate ||
!syncInfo.configurationType.upToDate ||
!syncInfo.exerciseEnvironmentConfigs.upToDate ||
!syncInfo.hardwareGroups.upToDate ||
!syncInfo.localizedTexts.upToDate ||
!syncInfo.limits.upToDate ||
!syncInfo.scoreConfig.upToDate ||
!syncInfo.scoreCalculator.upToDate ||
!syncInfo.exerciseTests.upToDate
? <Row>
<Col sm={12}>
<Alert bsStyle="warning">
<h4>
<FormattedMessage
id="app.assignment.syncRequired"
defaultMessage="The exercise was updated!"
/>
</h4>
<div>
<FormattedMessage
id="app.assignment.syncDescription"
defaultMessage="The exercise for this assignment was updated in following categories:"
/>
<ul>
{!syncInfo.exerciseConfig.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncExerciseConfig"
defaultMessage="Exercise configuration"
/>
</li>}
{!syncInfo.configurationType.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncConfigType"
defaultMessage="Type of exercise configuration"
/>
</li>}
{!syncInfo.exerciseEnvironmentConfigs.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncExerciseEnvironmentConfigs"
defaultMessage="Environment configuration"
/>
</li>}
{!syncInfo.hardwareGroups.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncHardwareGroups"
defaultMessage="Hardware groups"
/>
</li>}
{!syncInfo.localizedTexts.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncLocalizedTexts"
defaultMessage="Localized texts"
/>
</li>}
{!syncInfo.limits.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncLimits"
defaultMessage="Limits"
/>
</li>}
{!syncInfo.scoreConfig.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncScoreConfig"
defaultMessage="Score configuration"
/>
</li>}
{!syncInfo.scoreCalculator.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncScoreCalculator"
defaultMessage="Score calculator"
/>
</li>}
{!syncInfo.exerciseTests.upToDate &&
<li>
<FormattedMessage
id="app.assignment.syncExerciseTests"
defaultMessage="Exercise tests"
/>
</li>}
</ul>
</div>
<p>
<Button bsStyle="primary" onClick={exerciseSync}>
<FormattedMessage
id="app.assignment.syncButton"
defaultMessage="Update this assignment"
/>
</Button>
</p>
</Alert>
</Col>
</Row>
: <div />;

AssignmentSync.propTypes = {
syncInfo: PropTypes.object.isRequired,
exerciseSync: PropTypes.func.isRequired
};

export default AssignmentSync;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default from './AssignmentSync';

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Exercises/EditSimpleLimitsBox/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import prettyBytes from 'pretty-bytes';
import { prettyPrintBytes } from '../../helpers/stringFormatters';
import { FormattedDate, FormattedTime, FormattedMessage } from 'react-intl';
import withLinks from '../../../hoc/withLinks';
import { Button } from 'react-bootstrap';
Expand All @@ -25,7 +25,7 @@ const AttachmentFilesTableRow = ({
</a>
</td>
<td>
{prettyBytes(size)}
{prettyPrintBytes(size)}
</td>
<td>
<FormattedDate value={uploadedAt * 1000} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Exercises/FilesTable/FilesTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const FilesTable = ({
RowComponent,
intl
}) =>
<Box title={title} collapsable isOpen>
<Box title={title} collapsable isOpen unlimitedHeight>
<div>
{description &&
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import prettyBytes from 'pretty-bytes';
import { prettyPrintBytes } from '../../helpers/stringFormatters';
import { FormattedDate, FormattedTime, FormattedMessage } from 'react-intl';
import { Button } from 'react-bootstrap';
import Confirm from '../../../components/forms/Confirm';
Expand All @@ -26,7 +26,7 @@ const SupplementaryFilesTableRow = ({
</span>}
</td>
<td>
{prettyBytes(size)}
{prettyPrintBytes(size)}
</td>
<td>
<FormattedDate value={uploadedAt * 1000} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Groups/SupervisorsView/SupervisorsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SupervisorsView = ({
deleteExercise,
users,
publicAssignments,
links: { EXERCISE_EDIT_URI_FACTORY, EXERCISE_EDIT_CONFIG_URI_FACTORY },
links: { EXERCISE_EDIT_URI_FACTORY, EXERCISE_EDIT_SIMPLE_CONFIG_URI_FACTORY },
intl: { locale }
}) =>
<div>
Expand Down Expand Up @@ -157,7 +157,7 @@ const SupervisorsView = ({
</Button>
</LinkContainer>
<LinkContainer
to={EXERCISE_EDIT_CONFIG_URI_FACTORY(exerciseId)}
to={EXERCISE_EDIT_SIMPLE_CONFIG_URI_FACTORY(exerciseId)}
>
<Button
bsSize="xs"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, FormattedDate } from 'react-intl';
import prettyBytes from 'pretty-bytes';
import { prettyPrintBytes } from '../../helpers/stringFormatters';
import prettyMs from 'pretty-ms';
import { Table } from 'react-bootstrap';
import Box from '../../widgets/Box';

const ReferenceSolutionsEvaluationsResults = ({ results, testId, taskId }) => (
const ReferenceSolutionsEvaluationsResults = ({ results, testId, taskId }) =>
<Box
isOpen={false}
collapsable
Expand Down Expand Up @@ -71,19 +71,24 @@ const ReferenceSolutionsEvaluationsResults = ({ results, testId, taskId }) => (

return (
<tr key={i}>
<td>{result.referenceSolution.description}</td>
<td>
{result.referenceSolution.description}
</td>
<td>
<FormattedDate value={result.evaluation.evaluatedAt * 1000} />
</td>
<td>{prettyBytes(taskStats.usedMemory)}</td>
<td>{prettyMs(taskStats.usedTime * 1000)}</td>
<td>
{prettyPrintBytes(taskStats.usedMemory)}
</td>
<td>
{prettyMs(taskStats.usedTime * 1000)}
</td>
</tr>
);
})}
</tbody>
</Table>
</Box>
);
</Box>;

ReferenceSolutionsEvaluationsResults.propTypes = {
results: PropTypes.array.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class SubmissionDetail extends Component {
});
}

componentWillReceiveProps(newProps) {
if (this.props.evaluations.size !== newProps.evaluations.size) {
this.setState({
activeSubmissionId: newProps.submission.lastSubmission.id
});
}
}

render() {
const {
submission: {
Expand Down
Loading

0 comments on commit efce550

Please sign in to comment.