Skip to content

Commit a79e506

Browse files
author
Martin Krulis
committed
Adding a configurable link to wiki page with runtime environments info.
1 parent d925b42 commit a79e506

File tree

6 files changed

+52
-14
lines changed

6 files changed

+52
-14
lines changed

etc/env.json.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"ALLOW_CAS_REGISTRATION": false,
99
"URL_PATH_PREFIX": "",
1010
"PERSISTENT_TOKENS_KEY_PREFIX": "recodex",
11-
"CAS_HELPDESK_URL": "mailto:[email protected]"
11+
"CAS_HELPDESK_URL": "mailto:[email protected]",
12+
"ENVIRONMENTS_INFO_URL": "https://github.com/ReCodEx/wiki/wiki/Runtime-Environments"
1213
}

src/components/Solutions/SubmitSolution/SubmitSolution.js

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
4-
import { injectIntl, intlShape, defineMessages } from 'react-intl';
4+
import { injectIntl, intlShape, defineMessages, FormattedHTMLMessage } from 'react-intl';
55
import { Modal, Button, FormGroup, ControlLabel, FormControl, HelpBlock, Well, Row, Col } from 'react-bootstrap';
66

77
import { LoadingIcon, WarningIcon, SendIcon, DeleteIcon, CloseIcon } from '../../icons';
@@ -11,6 +11,9 @@ import Confirm from '../../forms/Confirm';
1111

1212
import { createGetUploadedFiles } from '../../../redux/selectors/upload';
1313
import { hasEntryPoint } from '../../../redux/selectors/submission';
14+
import { getConfigVar } from '../../../helpers/config';
15+
16+
const environmentsHelpUrl = getConfigVar('ENVIRONMENTS_INFO_URL');
1417

1518
const commonMessages = defineMessages({
1619
runtimeEnvironment: {
@@ -186,16 +189,27 @@ class SubmitSolution extends Component {
186189
) : !presubmitEnvironments ? (
187190
<p className="text-left callout callout-info">{formatMessage(commonMessages.uploadFilesFirst)}</p>
188191
) : presubmitEnvironments.length > 0 ? (
189-
<FormControl
190-
onChange={e => changeRuntimeEnvironment(e.target.value)}
191-
componentClass="select"
192-
defaultValue={selectedEnvironment}>
193-
{presubmitEnvironments.map(rte => (
194-
<option key={rte.id} value={rte.id}>
195-
{rte.name}
196-
</option>
197-
))}
198-
</FormControl>
192+
<React.Fragment>
193+
<FormControl
194+
onChange={e => changeRuntimeEnvironment(e.target.value)}
195+
componentClass="select"
196+
defaultValue={selectedEnvironment}>
197+
{presubmitEnvironments.map(rte => (
198+
<option key={rte.id} value={rte.id}>
199+
{rte.name}
200+
</option>
201+
))}
202+
</FormControl>
203+
{environmentsHelpUrl && (
204+
<p className="small text-muted em-margin-top">
205+
<FormattedHTMLMessage
206+
id="app.submitSolution.linkToWiki"
207+
defaultMessage="Select the right environment, under which you wish to submit your solution. You may find more information about the environments at our <a href='{url}' target='_blank'>wiki page</a>."
208+
values={{ url: environmentsHelpUrl }}
209+
/>
210+
</p>
211+
)}
212+
</React.Fragment>
199213
) : (
200214
<p className="text-left callout callout-danger">{formatMessage(commonMessages.noEnvironments)}</p>
201215
)}

src/components/forms/EditEnvironmentSimpleForm/EditEnvironmentSimpleForm.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import { reduxForm, Field } from 'redux-form';
4-
import { FormattedMessage, intlShape, injectIntl } from 'react-intl';
5-
import { Alert, Grid, Row, Col, OverlayTrigger, Tooltip } from 'react-bootstrap';
4+
import { FormattedMessage, FormattedHTMLMessage, intlShape, injectIntl } from 'react-intl';
5+
import { Alert, Grid, Row, Col, OverlayTrigger, Tooltip, Well } from 'react-bootstrap';
66

77
import { CheckboxField } from '../Fields';
88
import SubmitButton from '../SubmitButton';
99
import Button from '../../widgets/FlatButton';
1010
import Icon, { RefreshIcon, InfoIcon } from '../../icons';
1111
import { STANDALONE_ENVIRONMENTS } from '../../../helpers/exercise/environments';
12+
import { getConfigVar } from '../../../helpers/config';
13+
14+
const environmentsHelpUrl = getConfigVar('ENVIRONMENTS_INFO_URL');
1215

1316
class EditEnvironmentSimpleForm extends Component {
1417
render() {
@@ -27,6 +30,18 @@ class EditEnvironmentSimpleForm extends Component {
2730

2831
return (
2932
<div>
33+
{environmentsHelpUrl && (
34+
<Well bsSize="sm">
35+
<div className="small text-muted">
36+
<FormattedHTMLMessage
37+
id="app.editEnvironmentSimpleForm.linkToWiki"
38+
defaultMessage="Select all runtime environments the exercise should support. You may find more information about the environments at our <a href='{url}' target='_blank'>wiki page</a>."
39+
values={{ url: environmentsHelpUrl }}
40+
/>
41+
</div>
42+
</Well>
43+
)}
44+
3045
<Grid fluid>
3146
<Row>
3247
{runtimeEnvironments
@@ -73,6 +88,8 @@ class EditEnvironmentSimpleForm extends Component {
7388
</Row>
7489
</Grid>
7590

91+
<hr />
92+
7693
{submitFailed && (
7794
<Alert bsStyle="danger">
7895
<FormattedMessage id="generic.savingFailed" defaultMessage="Saving failed. Please try again later." />

src/locales/cs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
"app.editEnvironmentConfig.warnings.ambiguousVariable": "Tato proměnná je definovaná ve více pipelines. Nastavená hodnota bude použita ve všech.",
233233
"app.editEnvironmentConfig.warnings.noPipelinesVariables": "Zatím nejsou vybrané žádné pipelines. Jména proměnných proto není možné verifikovat.",
234234
"app.editEnvironmentConfig.warnings.unknownVariable": "Tato proměnná není definována v žádné pipeline.",
235+
"app.editEnvironmentSimpleForm.linkToWiki": "Vyberte všechna běhová prostředí, která má tato úloha podporovat. Více informací o běhových prostředích naleznete na naší <a href='{url}' target='_blank'>wiki stránce</a>.",
235236
"app.editEnvironmentSimpleForm.standaloneEnvironment": "Separované běhové prostředí",
236237
"app.editEnvironmentSimpleForm.submit": "Uložit prostředí",
237238
"app.editEnvironmentSimpleForm.submitting": "Ukládám...",
@@ -1218,6 +1219,7 @@
12181219
"app.submitSolution.emptyNoteSubmitConfirm": "Popis referenčního řešení je prázdný. Je nanejvýš vhodné, aby referenční řešení byla opatřena relevantním popiskem. Opravdu si přejete pokračovat v odevzdání?",
12191220
"app.submitSolution.emptyNoteWarning": "Popis referenčního řešení je prázdný. Je nanejvýš vhodné, aby referenční řešení byla opatřena relevantním popiskem.",
12201221
"app.submitSolution.entryPoint": "Vyberte vstupní bod (zaváděcí soubor vaší aplikace):",
1222+
"app.submitSolution.linkToWiki": "Vyberte běhové prostředí, pro které je určeno vaše řešení. Více informací o běhových prostředích naleznete na naší <a href='{url}' target='_blank'>wiki stránce</a>.",
12211223
"app.submitSolution.noEnvironments": "Nahrané soubory neodpovídají žádnému povolenému běhovému prostředí.",
12221224
"app.submitSolution.noteLabel": "Poznámka pro vás a vašeho vyučujícího:",
12231225
"app.submitSolution.runtimeEnvironment": "Vyberte běhové prostředí (programovací jazyk):",

src/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
"app.editEnvironmentConfig.warnings.ambiguousVariable": "This variable is defined in multiple pipelines. The value will be used in all of them.",
233233
"app.editEnvironmentConfig.warnings.noPipelinesVariables": "There are no pipelines set. Name of the variables may not be verified.",
234234
"app.editEnvironmentConfig.warnings.unknownVariable": "This variable is not defined in any pipeline.",
235+
"app.editEnvironmentSimpleForm.linkToWiki": "Select all runtime environments the exercise should support. You may find more information about the environments at our <a href='{url}' target='_blank'>wiki page</a>.",
235236
"app.editEnvironmentSimpleForm.standaloneEnvironment": "Separated runtime environment",
236237
"app.editEnvironmentSimpleForm.submit": "Save Environments",
237238
"app.editEnvironmentSimpleForm.submitting": "Saving Environments...",
@@ -1218,6 +1219,7 @@
12181219
"app.submitSolution.emptyNoteSubmitConfirm": "The description is empty. Reference solutions are strongly encouraged to be labeled with relevant descriptions. Do you rellay wish to proceed with submit?",
12191220
"app.submitSolution.emptyNoteWarning": "The description is empty. Reference solutions are strongly encouraged to be labeled with relevant descriptions.",
12201221
"app.submitSolution.entryPoint": "Select the point of entry (bootstrap file of your application):",
1222+
"app.submitSolution.linkToWiki": "Select the right environment, under which you wish to submit your solution. You may find more information about the environments at our <a href='{url}' target='_blank'>wiki page</a>.",
12211223
"app.submitSolution.noEnvironments": "Uploaded files do not meet criteria of any allowed runtime environment.",
12221224
"app.submitSolution.noteLabel": "Note for you and your supervisor(s):",
12231225
"app.submitSolution.runtimeEnvironment": "Select runtime environment (programming language):",

src/locales/whitelist_en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
"app.editEnvironmentConfig.warnings.ambiguousVariable",
233233
"app.editEnvironmentConfig.warnings.noPipelinesVariables",
234234
"app.editEnvironmentConfig.warnings.unknownVariable",
235+
"app.editEnvironmentSimpleForm.linkToWiki",
235236
"app.editEnvironmentSimpleForm.standaloneEnvironment",
236237
"app.editEnvironmentSimpleForm.submit",
237238
"app.editEnvironmentSimpleForm.submitting",
@@ -1218,6 +1219,7 @@
12181219
"app.submitSolution.emptyNoteSubmitConfirm",
12191220
"app.submitSolution.emptyNoteWarning",
12201221
"app.submitSolution.entryPoint",
1222+
"app.submitSolution.linkToWiki",
12211223
"app.submitSolution.noEnvironments",
12221224
"app.submitSolution.noteLabel",
12231225
"app.submitSolution.runtimeEnvironment",

0 commit comments

Comments
 (0)