Skip to content

Commit 9606802

Browse files
committed
Minor changes in Submission Management Page
- Online Review links removed on request from TonyJ. - Downloading of submissions is enabled with use of legacy (Studio) API, as the new APIs don't support it yet (https://github.com/topcoder- platform/community-app/issues/9). - Submission previews are shown using legacy (Studio) API (#8) - Delete submission icon is temporarly removed, as we don't have any API to remove them yet (https://github.com/topcoder-platform/community- app/issues/10).
1 parent 5afa9e5 commit 9606802

File tree

4 files changed

+33
-22
lines changed

4 files changed

+33
-22
lines changed

src/shared/actions/smp.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
* My submissions management page specific actions.
33
*/
44

5-
/* global fetch */
6-
75
import _ from 'lodash';
86
import 'isomorphic-fetch';
97
import { createActions } from 'redux-actions';
108
import { getApiV2, getApiV3 } from 'services/api';
119
import config from 'utils/config';
10+
import { isClientSide } from 'utils/isomorphy';
1211
import logger from 'utils/logger';
1312

1413
const apiV2 = (auth) => getApiV2(auth.tokenV2);
@@ -21,24 +20,14 @@ function deleteSubmission(challengeId, submissionId) {
2120
return Promise.resolve(submissionId);
2221
}
2322

23+
/* TODO: At this moment we don't need any special JS code to download
24+
submissions: we get them from legacy Topcoder Studio API, which is
25+
authenticated by cookies, and can be done with a simple <a> link in
26+
the component. Soon we'll migrate to use the new TC API instead, and
27+
then we'll decide, whether we need operate downloads in JS, or can we
28+
just remove this action. */
2429
function downloadSubmission(tokens, type, submissionId) {
25-
/*
26-
TODO: This will work with legacy API once we pass the tcsso cookie
27-
along with the request.
28-
const url = `${config.STUDIO_URL}?module=DownloadSubmission&sbmid=${submissionId}&sbt=original`;
29-
fetch(url, {
30-
mode: 'no-cors',
31-
});
32-
*/
33-
const endpoint = `/${type}/download/${submissionId}?submissionType=original`;
34-
return apiV2(tokens).get(endpoint).then(res =>
35-
new Promise(resolve =>
36-
res.json().then((json) => {
37-
if (res.status !== 200) logger.error(json);
38-
resolve(json);
39-
}),
40-
),
41-
);
30+
_.noop(tokens, type, submissionId);
4231
}
4332

4433
export default createActions({
@@ -48,5 +37,5 @@ export default createActions({
4837
CONFIRM_DELETE: _.identity,
4938
DELETE_SUBMISSION_DONE: deleteSubmission,
5039
DOWNLOAD_SUBMISSION: downloadSubmission,
51-
}
40+
},
5241
});

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,14 @@ export default function ScreeningDetails(props) {
8484
<div styleName="screening-details" >
8585
<div styleName="screening-details-head">
8686
<p styleName={`status-title ${setStatusInfo().classname}`}>{setStatusInfo().title}</p>
87+
{/*
88+
NOTE: TonyJ asked to remove the OR links from the page to keep
89+
users within the new Topcoder site as much as we can. Not wiping
90+
out the code just in case we decide to bring it back later.
8791
<a href={onlineReviewUrl} styleName="online-review-link">
8892
Online Review
8993
</a>
94+
*/}
9095
</div>
9196
<p>{setStatusInfo().message}</p>
9297
<div styleName="screening-warning">

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
import _ from 'lodash';
15+
import config from 'utils/config';
1516
import moment from 'moment';
1617
import React, { PropTypes as PT } from 'react';
1718

@@ -39,7 +40,10 @@ export default function Submission(props) {
3940
<img
4041
alt="preview"
4142
styleName={type === 'design' ? 'design-img' : 'dev-img'}
42-
src={submissionObject.preview||'http://placehold.it/90/a01230'}
43+
src={
44+
submissionObject.preview||
45+
`${config.STUDIO_URL}?module=DownloadSubmission&sbmid=${submissionObject.submissionId}&sbt=tiny`
46+
}
4347
/>
4448
</td>
4549
<td styleName="id-col">{submissionObject.submissionId}</td>
@@ -55,13 +59,25 @@ export default function Submission(props) {
5559
</td>}
5660
<td>
5761
<div styleName="action-col">
62+
<a href={`${config.STUDIO_URL}?module=DownloadSubmission&sbmid=${submissionObject.submissionId}&sbt=original`}>
63+
<DownloadIcon />
64+
</a>
65+
{ /*
66+
TODO: At the moment we just fetch downloads from the legacy
67+
Topcoder Studio API, and we don't need any JS code to this.
68+
It may change soon, as we move to the new TC API for
69+
downloads. Then we'll use this commented out code or
70+
remove it for good.
5871
<button
5972
onClick={() => onDownload(submissionObject.submissionId)}
6073
><DownloadIcon /></button>
74+
*/ }
75+
{/* TODO: At the moment APIs don't support removal of
76+
submissions, thus the icon is temporarly removed.
6177
<button
6278
styleName="delete-icon"
6379
onClick={() => onDelete(submissionObject.submissionId)}
64-
><DeleteIcon /></button>
80+
><DeleteIcon /></button> */}
6581
<button
6682
styleName={`expand-icon ${(showScreeningDetails ? 'expanded' : '')}`}
6783
onClick={() => onShowDetails(submissionObject.submissionId)}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ $submission-space-50: $base-unit * 10;
9797

9898
.expand-icon {
9999
transition: all 1.5s;
100+
margin-left: 12px;
100101

101102
&.expanded {
102103
transform: rotate(180deg);

0 commit comments

Comments
 (0)