Skip to content

Commit 787dad8

Browse files
committed
Merge branch 'develop' into f2f-misc-fixes
2 parents f3f09bd + ef5748f commit 787dad8

File tree

40 files changed

+879
-205
lines changed

40 files changed

+879
-205
lines changed

.exchange-rates.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1510660800,"base":"USD","rates":{"AED":3.673035,"AFN":68.597,"ALL":113.85,"AMD":486.63,"ANG":1.781857,"AOA":165.9225,"ARS":17.4983,"AUD":1.310161,"AWG":1.786752,"AZN":1.6985,"BAM":1.675741,"BBD":2,"BDT":83.182854,"BGN":1.668204,"BHD":0.3771,"BIF":1749.6,"BMD":1,"BND":1.361332,"BOB":6.897686,"BRL":3.275566,"BSD":1,"BTC":0.000153485025,"BTN":65.285278,"BWP":10.652864,"BYN":1.991423,"BZD":2.00644,"CAD":1.272935,"CDF":1562.881563,"CHF":0.994715,"CLF":0.02337,"CLP":628.8,"CNH":6.642966,"CNY":6.6377,"COP":3016.02,"CRC":568.605,"CUC":1,"CUP":25.5,"CVE":94.875,"CZK":21.80415,"DJF":178.935,"DKK":6.34693,"DOP":47.937867,"DZD":114.839,"EGP":17.6438,"ERN":15.191062,"ETB":27.169609,"EUR":0.852965,"FJD":2.074747,"FKP":0.762659,"GBP":0.762659,"GEL":2.537872,"GGP":0.762659,"GHS":4.4458,"GIP":0.762659,"GMD":47.29,"GNF":9013.95,"GTQ":7.326984,"GYD":207.46247,"HKD":7.80295,"HNL":23.606507,"HRK":6.441595,"HTG":63.603697,"HUF":265.94,"IDR":13534.080047,"ILS":3.547927,"IMP":0.762659,"INR":65.505,"IQD":1164.9,"IRR":34716.946723,"ISK":103.37,"JEP":0.762659,"JMD":126.505,"JOD":0.709001,"JPY":113.65166667,"KES":103.575,"KGS":69.131479,"KHR":4032.45,"KMF":422,"KPW":900,"KRW":1114.6325,"KWD":0.302158,"KYD":0.831775,"KZT":332.5,"LAK":8311.2,"LBP":1513.25,"LKR":153.61,"LRD":123.1,"LSL":14.476277,"LYD":1.365546,"MAD":9.458954,"MDL":17.649228,"MGA":3154.35,"MKD":52.554726,"MMK":1352.75,"MNT":2450.285781,"MOP":8.018738,"MRO":354.53,"MUR":34.22,"MVR":15.390384,"MWK":725.575,"MXN":19.07835,"MYR":4.189799,"MZN":60.664443,"NAD":14.3872,"NGN":359.36,"NIO":30.693726,"NOK":8.183736,"NPR":104.452204,"NZD":1.455646,"OMR":0.384948,"PAB":1,"PEN":3.24124,"PGK":3.199082,"PHP":51.1545,"PKR":105.22,"PLN":3.612257,"PYG":5645.8,"QAR":3.641458,"RON":3.962907,"RSD":101.01,"RUB":59.7679,"RWF":853.025,"SAR":3.750377,"SBD":7.792911,"SCR":13.404244,"SDG":6.664846,"SEK":8.428474,"SGD":1.360954,"SHP":0.762659,"SLL":7643.328121,"SOS":577.475,"SRD":7.448,"SSP":130.2634,"STD":20847.000286,"SVC":8.734183,"SYP":514.98999,"SZL":14.483364,"THB":33.075,"TJS":8.794373,"TMT":3.499972,"TND":2.503786,"TOP":2.268632,"TRY":3.86834,"TTD":6.750494,"TWD":30.173,"TZS":2247.4,"UAH":26.453,"UGX":3631.5,"USD":1,"UYU":29.244046,"UZS":8053.2,"VEF":10.069908,"VND":22717.219974,"VUV":106.743333,"WST":2.54764,"XAF":559.508266,"XAG":0.05904939,"XAU":0.00078548,"XCD":2.70255,"XDR":0.712471,"XOF":559.508266,"XPD":0.00100912,"XPF":101.785782,"XPT":0.00107586,"YER":250.294142,"ZAR":14.377882,"ZMW":9.907,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1510660800,"base":"USD","rates":{"AED":3.673035,"AFN":68.597,"ALL":113.85,"AMD":486.63,"ANG":1.781857,"AOA":165.9225,"ARS":17.4983,"AUD":1.310161,"AWG":1.786752,"AZN":1.6985,"BAM":1.675741,"BBD":2,"BDT":83.182854,"BGN":1.668204,"BHD":0.3771,"BIF":1749.6,"BMD":1,"BND":1.361332,"BOB":6.897686,"BRL":3.275566,"BSD":1,"BTC":0.000153485025,"BTN":65.285278,"BWP":10.652864,"BYN":1.991423,"BZD":2.00644,"CAD":1.272935,"CDF":1562.881563,"CHF":0.994715,"CLF":0.02337,"CLP":628.8,"CNH":6.642966,"CNY":6.6377,"COP":3016.02,"CRC":568.605,"CUC":1,"CUP":25.5,"CVE":94.875,"CZK":21.80415,"DJF":178.935,"DKK":6.34693,"DOP":47.937867,"DZD":114.839,"EGP":17.6438,"ERN":15.191062,"ETB":27.169609,"EUR":0.852965,"FJD":2.074747,"FKP":0.762659,"GBP":0.762659,"GEL":2.537872,"GGP":0.762659,"GHS":4.4458,"GIP":0.762659,"GMD":47.29,"GNF":9013.95,"GTQ":7.326984,"GYD":207.46247,"HKD":7.80295,"HNL":23.606507,"HRK":6.441595,"HTG":63.603697,"HUF":265.94,"IDR":13534.080047,"ILS":3.547927,"IMP":0.762659,"INR":65.505,"IQD":1164.9,"IRR":34716.946723,"ISK":103.37,"JEP":0.762659,"JMD":126.505,"JOD":0.709001,"JPY":113.65166667,"KES":103.575,"KGS":69.131479,"KHR":4032.45,"KMF":422,"KPW":900,"KRW":1114.6325,"KWD":0.302158,"KYD":0.831775,"KZT":332.5,"LAK":8311.2,"LBP":1513.25,"LKR":153.61,"LRD":123.1,"LSL":14.476277,"LYD":1.365546,"MAD":9.458954,"MDL":17.649228,"MGA":3154.35,"MKD":52.554726,"MMK":1352.75,"MNT":2450.285781,"MOP":8.018738,"MRO":354.53,"MUR":34.22,"MVR":15.390384,"MWK":725.575,"MXN":19.07835,"MYR":4.189799,"MZN":60.664443,"NAD":14.3872,"NGN":359.36,"NIO":30.693726,"NOK":8.183736,"NPR":104.452204,"NZD":1.455646,"OMR":0.384948,"PAB":1,"PEN":3.24124,"PGK":3.199082,"PHP":51.1545,"PKR":105.22,"PLN":3.612257,"PYG":5645.8,"QAR":3.641458,"RON":3.962907,"RSD":101.01,"RUB":59.7679,"RWF":853.025,"SAR":3.750377,"SBD":7.792911,"SCR":13.404244,"SDG":6.664846,"SEK":8.428474,"SGD":1.360954,"SHP":0.762659,"SLL":7643.328121,"SOS":577.475,"SRD":7.448,"SSP":130.2634,"STD":20847.000286,"SVC":8.734183,"SYP":514.98999,"SZL":14.483364,"THB":33.075,"TJS":8.794373,"TMT":3.499972,"TND":2.503786,"TOP":2.268632,"TRY":3.86834,"TTD":6.750494,"TWD":30.173,"TZS":2247.4,"UAH":26.453,"UGX":3631.5,"USD":1,"UYU":29.244046,"UZS":8053.2,"VEF":10.069908,"VND":22717.219974,"VUV":106.743333,"WST":2.54764,"XAF":559.508266,"XAG":0.05904939,"XAU":0.00078548,"XCD":2.70255,"XDR":0.712471,"XOF":559.508266,"XPD":0.00100912,"XPF":101.785782,"XPT":0.00107586,"YER":250.294142,"ZAR":14.377882,"ZMW":9.907,"ZWL":322.355011}}

__tests__/shared/components/SubmissionManagement/Submission.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const page = TU.renderIntoDocument((
5454
describe('User input', () => {
5555
beforeEach(() => jest.clearAllMocks());
5656

57-
test('onDelete', () => {
57+
test.skip('onDelete', () => {
5858
const icon = TU.findAllInRenderedTree(page, item =>
5959
item && item.className && item.className.match(/delete-icon/));
6060
expect(icon.length).toBe(1);

__tests__/shared/components/SubmissionManagement/__snapshots__/Submission.jsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ exports[`Snapshot match 1`] = `
3333
</a>
3434
<button
3535
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
36+
disabled={true}
3637
onClick={[Function]}
3738
>
3839
<DeleteIcon />
@@ -83,6 +84,7 @@ exports[`Snapshot match 2`] = `
8384
</a>
8485
<button
8586
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
87+
disabled={true}
8688
onClick={[Function]}
8789
>
8890
<DeleteIcon />

__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionManagement.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ exports[`Matches shallow shapshot 1`] = `
6565
showDetails={Array []}
6666
status={undefined}
6767
submissionObjects={Array []}
68+
submissionPhaseStartDate={undefined}
6869
type="Challenge Track"
6970
/>
7071
</div>

__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionsTable.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ exports[`Matches shallow shapshot 1`] = `
3333
</thead>
3434
<tbody>
3535
<Submission
36+
allowDelete={undefined}
3637
onDelete={[Function]}
3738
onDownload={[Function]}
3839
onShowDetails={[Function]}

__tests__/shared/components/__snapshots__/Content.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ exports[`Matches shallow shapshot 1`] = `
405405
<li>
406406
<Link
407407
replace={false}
408-
to="examples/error-message"
408+
to="/examples/error-message"
409409
>
410410
Error Message
411411
</Link>

config/production.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,5 @@
2525
"COGNITIVE": "https://cognitive.topcoder.com",
2626
"TCO17": "https://tco17.topcoder.com/",
2727
"COMMUNITY_API": "http://localhost:8000"
28-
},
29-
"FILESTACK": {
30-
"API_KEY": "",
31-
"SUBMISSION_CONTAINER": "",
32-
},
28+
}
3329
}

package-lock.json

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server/server.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import atob from 'atob';
33
import bodyParser from 'body-parser';
44
import cookieParser from 'cookie-parser';
55
import express from 'express';
6+
import fetch from 'isomorphic-fetch';
67
import helmet from 'helmet';
78
import logger from 'utils/logger';
89
import loggerMiddleware from 'morgan';
@@ -103,6 +104,14 @@ app.use('/community-app-assets/api/xml2json', (req, res) => {
103104
xmlToJson(req.body.xml).then(json => res.json(json));
104105
});
105106

107+
/* Proxy endpoint for GET requests (to fetch data from resources prohibiting
108+
* cross-origin requests). */
109+
app.use('/community-app-assets/api/proxy-get', (req, res) => {
110+
fetch(req.query.url)
111+
.then(x => x.text())
112+
.then(x => res.send(x));
113+
});
114+
106115
/* Returns currency exchange rates, cached at the server-side (thus drastically
107116
* reducing amount of calls to openexchangerates.com). */
108117
app.use('/community-app-assets/api/exchange-rates', (req, res) => {

src/shared/actions/rss.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* Actions for management of data loaded from RSS feeds.
3+
*/
4+
5+
import fetch from 'isomorphic-fetch';
6+
import { toJson } from 'utils/xml2json';
7+
import { createActions } from 'redux-actions';
8+
9+
/**
10+
* Payload creator for the action that drops data loaded from the specified
11+
* RSS feed. Also cancels any pending loading of data for that feed.
12+
* @param {String} feed Internal name of the feed.
13+
* @return {String}
14+
*/
15+
function drop(feed) {
16+
return feed;
17+
}
18+
19+
/**
20+
* Payload creator for the actions that drops all data loaded from RSS feeds.
21+
*/
22+
function dropAll() {}
23+
24+
/**
25+
* Payload creator for the action that initializes data loading for the
26+
* specified feed.
27+
* @param {String} feed Internal name of the feed.
28+
* @param {String} uuid UUID of the loading operations.
29+
* @return {Object} Action payload.
30+
*/
31+
function getInit(feed, uuid) {
32+
return { feed, uuid };
33+
}
34+
35+
/**
36+
* Payload creator for the action that actually loads data for the specified
37+
* RSS feed.
38+
* @param {String} feed Internal name of the feed.
39+
* @param {String} uuid UUID of the loading operation.
40+
* @param {String} url URL of the RSS feed.
41+
* @return {Object} Action payload.
42+
*/
43+
async function getDone(feed, uuid, url) {
44+
let res = await fetch(url);
45+
if (!res.ok) throw new Error(res.statusText);
46+
res = await res.text();
47+
res = await toJson(res);
48+
return { feed, uuid, data: res.rss.channel };
49+
}
50+
51+
export default createActions({
52+
RSS: {
53+
DROP: drop,
54+
DROP_ALL: dropAll,
55+
GET_INIT: getInit,
56+
GET_DONE: getDone,
57+
},
58+
});

src/shared/components/Content/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export default function Content() {
169169
promise;
170170
</li>
171171
<li>
172-
<Link to="examples/error-message">Error Message</Link> - Demonstrates
172+
<Link to="/examples/error-message">Error Message</Link> - Demonstrates
173173
UI component for errors messaging;
174174
</li>
175175
<li>

src/shared/components/ErrorMessage/index.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ class ErrorMessage extends React.Component {
5050
}
5151
}
5252

53-
/**
54-
* Prop Validation
55-
*/
53+
ErrorMessage.defaultProps = {
54+
details: '',
55+
};
56+
5657
ErrorMessage.propTypes = {
5758
title: PT.string.isRequired,
58-
details: PT.string.isRequired,
59+
details: PT.string,
5960
onOk: PT.func.isRequired,
6061
};
6162

src/shared/components/SubmissionManagement/Submission/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default function Submission(props) {
3232
onDelete,
3333
onShowDetails,
3434
status,
35+
allowDelete,
3536
} = props;
3637
const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A');
3738

@@ -81,6 +82,7 @@ export default function Submission(props) {
8182
<button
8283
styleName="delete-icon"
8384
onClick={() => onDelete(submissionObject.submissionId)}
85+
disabled={!allowDelete}
8486
><DeleteIcon /></button>
8587
}
8688
<button
@@ -116,4 +118,5 @@ Submission.propTypes = {
116118
onDelete: PT.func.isRequired,
117119
onShowDetails: PT.func,
118120
status: PT.string.isRequired,
121+
allowDelete: PT.bool.isRequired,
119122
};

src/shared/components/SubmissionManagement/Submission/styles.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ $submission-space-50: $base-unit * 10;
139139
&:focus {
140140
outline: none;
141141
}
142+
143+
&:disabled {
144+
opacity: 0.5;
145+
}
142146
}
143147

144148
.expand-icon {

src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default function SubmissionManagement(props) {
3333
onShowDetails,
3434
challengeUrl,
3535
onlineReviewUrl,
36+
submissionPhaseStartDate,
3637
} = props;
3738

3839
const challengeType = challenge.track.toLowerCase();
@@ -108,6 +109,7 @@ export default function SubmissionManagement(props) {
108109
showDetails={showDetails}
109110
type={challenge.track}
110111
status={challenge.status}
112+
submissionPhaseStartDate={submissionPhaseStartDate}
111113
{...componentConfig}
112114
/>
113115
}
@@ -150,4 +152,5 @@ SubmissionManagement.propTypes = {
150152
submissions: PT.arrayOf(PT.shape()).isRequired,
151153
loadingSubmissions: PT.bool,
152154
challengeUrl: PT.string,
155+
submissionPhaseStartDate: PT.string.isRequired,
153156
};

src/shared/components/SubmissionManagement/SubmissionsTable/index.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import _ from 'lodash';
1818
import React from 'react';
1919
import PT from 'prop-types';
2020
import shortid from 'shortid';
21+
import moment from 'moment';
2122
import Submission from '../Submission';
2223
import ScreeningDetails from '../ScreeningDetails';
2324
import './styles.scss';
@@ -33,6 +34,7 @@ export default function SubmissionsTable(props) {
3334
onDownload,
3435
onShowDetails,
3536
status,
37+
submissionPhaseStartDate,
3638
} = props;
3739

3840
const submissionsWithDetails = [];
@@ -46,6 +48,11 @@ export default function SubmissionsTable(props) {
4648
);
4749
} else {
4850
submissionObjects.forEach((subObject) => {
51+
// submissionPhaseStartDate will be the start date of
52+
// the current submission/checkpoint or empty string if any other phase
53+
const allowDelete = submissionPhaseStartDate &&
54+
moment(subObject.submissionDate).isAfter(submissionPhaseStartDate);
55+
4956
const submission = (
5057
<Submission
5158
submissionObject={subObject}
@@ -56,6 +63,7 @@ export default function SubmissionsTable(props) {
5663
onDownload={onDownload}
5764
status={status}
5865
key={shortid.generate()}
66+
allowDelete={allowDelete}
5967
/>
6068
);
6169
submissionsWithDetails.push(submission);
@@ -128,4 +136,5 @@ SubmissionsTable.propTypes = {
128136
onDownload: PT.func,
129137
onShowDetails: PT.func,
130138
status: PT.string.isRequired,
139+
submissionPhaseStartDate: PT.string.isRequired,
131140
};

0 commit comments

Comments
 (0)