Skip to content

Commit 6c42073

Browse files
authored
Merge pull request #6325 from yoution/feature/download-submission
fix: issue #5582
2 parents 141121b + 132dc31 commit 6c42073

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

config/default.js

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ module.exports = {
116116
FORUMS_VANILLA: 'https://vanilla.topcoder-dev.com',
117117
HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles',
118118
SUBMISSION_REVIEW: 'https://submission-review.topcoder-dev.com',
119+
SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder-dev.com',
119120

120121
THRIVE: 'https://community-app.topcoder-dev.com/thrive',
121122

config/production.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
FORUMS_VANILLA: 'https://discussions.topcoder.com',
3636
HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles',
3737
SUBMISSION_REVIEW: 'https://submission-review.topcoder.com',
38+
SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder.com',
3839
MEMBER: 'https://member.topcoder.com',
3940
ONLINE_REVIEW: 'https://software.topcoder.com',
4041
PAYMENT_TOOL: 'https://payment.topcoder.com',

src/shared/containers/SubmissionManagement/index.jsx

+11-14
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ import PT from 'prop-types';
1515
import { connect } from 'react-redux';
1616
import { Modal } from 'topcoder-react-ui-kit';
1717
import { config } from 'topcoder-react-utils';
18-
import { actions, services } from 'topcoder-react-lib';
18+
import { actions } from 'topcoder-react-lib';
1919

2020
import './styles.scss';
2121
import smpActions from '../../actions/page/submission_management';
2222

23-
const { getService } = services.submissions;
24-
2523
// The container component
2624
class SubmissionManagementPageContainer extends React.Component {
2725
componentDidMount() {
@@ -70,17 +68,16 @@ class SubmissionManagementPageContainer extends React.Component {
7068
onShowDetails,
7169
onDelete: onSubmissionDelete,
7270
onDownload: (challengeType, submissionId) => {
73-
const submissionsService = getService(authTokens.tokenV3);
74-
submissionsService.downloadSubmission(submissionId)
75-
.then((blob) => {
76-
const url = window.URL.createObjectURL(new Blob([blob]));
77-
const link = document.createElement('a');
78-
link.href = url;
79-
link.setAttribute('download', `submission-${challengeType}-${submissionId}.zip`);
80-
document.body.appendChild(link);
81-
link.click();
82-
link.parentNode.removeChild(link);
83-
});
71+
// download large file using stream method
72+
const downloadSubmissionURL = `${config.URL.SUBMISSION_REVIEW_API_URL}/challengeSubmissions/${submissionId}/download?token=${authTokens.tokenV3}`;
73+
74+
const link = document.createElement('a');
75+
link.href = downloadSubmissionURL;
76+
link.setAttribute('download', `submission-${challengeType}-${submissionId}.zip`);
77+
78+
document.body.appendChild(link);
79+
link.click();
80+
link.parentNode.removeChild(link);
8481
},
8582
onlineReviewUrl: `${config.URL.ONLINE_REVIEW}/review/actions/ViewProjectDetails?pid=${challengeId}`,
8683
challengeUrl: `${challengesUrl}/${challengeId}`,

0 commit comments

Comments
 (0)