Skip to content

Commit c9cfcca

Browse files
committed
https://topcoder.atlassian.net/browse/PROD-4266
1 parent 3789e79 commit c9cfcca

File tree

3 files changed

+88
-16
lines changed

3 files changed

+88
-16
lines changed
Lines changed: 3 additions & 0 deletions
Loading

src/components/ChallengeEditor/Submissions/Submissions.module.scss

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ $base-unit: 5px;
287287
display: flex;
288288
border-bottom: 1px solid $tc-gray-10;
289289
background: transparent;
290+
gap: 20px;
290291

291292
@include xs-to-sm {
292293
display: none;
@@ -298,6 +299,7 @@ $base-unit: 5px;
298299
display: flex;
299300
border-bottom: 1px solid $tc-gray-10;
300301
font-size: 15px;
302+
gap: 20px;
301303
}
302304

303305
.col-1 {
@@ -317,28 +319,54 @@ $base-unit: 5px;
317319
.col-2 {
318320
// width: 10%;
319321
display: flex;
320-
width: 150px;
322+
width: 50px;
321323
margin-left: 20px;
322324
justify-content: flex-start;
323325
display: flex;
326+
flex-shrink: 0;
324327
}
325328

326329
.col-3 {
327-
width: 298px;
328330
display: flex;
329-
// width: 26.6%;
331+
width: 100px;
332+
flex-shrink: 0;
330333
}
331334

332335
.col-4 {
333336
display: flex;
334-
// width: 26.6%;
335-
width: 317px;
337+
width: 150px;
338+
flex-shrink: 0;
336339
}
337340

338341
.col-5 {
339342
display: flex;
340-
width: 351px;
341-
// width: 26.6%;
343+
width: 150px;
344+
flex-shrink: 0;
345+
}
346+
347+
.col-6 {
348+
display: flex;
349+
width: 280px;
350+
flex-shrink: 0;
351+
}
352+
353+
.col-7 {
354+
display: flex;
355+
width: 150px;
356+
flex-shrink: 0;
357+
}
358+
359+
.col-8 {
360+
display: flex;
361+
width: 50px;
362+
flex-shrink: 0;
363+
364+
button {
365+
padding: 0;
366+
border: none;
367+
background-color: transparent;
368+
outline: none;
369+
}
342370
}
343371

344372
.handle {
@@ -350,7 +378,9 @@ $base-unit: 5px;
350378
.submissionsContainer {
351379
display: flex;
352380
flex-direction: column;
353-
max-width: 966px;
381+
max-width: 1100px;
382+
width: 100%;
383+
overflow: auto;
354384
}
355385

356386
.tooltip {

src/components/ChallengeEditor/Submissions/index.js

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import styles from './Submissions.module.scss'
2727
const assets = require.context('../../../assets/images', false, /svg/)
2828
const ArrowDown = './arrow-down.svg'
2929
const Lock = './lock.svg'
30+
const Download = './IconSquareDownload.svg'
3031

3132
class SubmissionsComponent extends React.Component {
3233
constructor (props) {
@@ -211,6 +212,7 @@ class SubmissionsComponent extends React.Component {
211212
const revertSort = sort === 'desc' ? 'asc' : 'desc'
212213

213214
const { sortedSubmissions, downloadingAll } = this.state
215+
console.log('totest sortedSubmissions', sortedSubmissions)
214216

215217
const renderSubmission = s => (
216218
<div className={styles.submission} key={s.id}>
@@ -393,6 +395,21 @@ class SubmissionsComponent extends React.Component {
393395
<ReactSVG path={assets(`${ArrowDown}`)} />
394396
</div>
395397
</button>
398+
<div
399+
className={cn(styles['col-6'])}
400+
>
401+
<span>Submission ID (UUID)</span>
402+
</div>
403+
<div
404+
className={cn(styles['col-7'])}
405+
>
406+
<span>Legacy submission ID</span>
407+
</div>
408+
<div
409+
className={cn(styles['col-8'])}
410+
>
411+
<span>Actions</span>
412+
</div>
396413
</div>
397414
{sortedSubmissions.map(s => (
398415
<div
@@ -441,19 +458,41 @@ class SubmissionsComponent extends React.Component {
441458
: 'N/A'}
442459
</a>
443460
</div>
461+
<div className={styles['col-6']}>
462+
{s.id}
463+
</div>
464+
<div className={styles['col-7']}>
465+
{s.legacySubmissionId}
466+
</div>
467+
<div className={styles['col-8']}>
468+
<button
469+
onClick={() => {
470+
// download submission
471+
console.log('totest download submission')
472+
const reactLib = getTopcoderReactLib()
473+
const { getService } = reactLib.services.submissions
474+
const submissionsService = getService(token)
475+
submissionsService.downloadSubmission(s.id)
476+
.then((blob) => {
477+
// eslint-disable-next-line no-undef
478+
const url = window.URL.createObjectURL(new Blob([blob]))
479+
const link = document.createElement('a')
480+
link.href = url
481+
link.setAttribute('download', `submission-${s.id}.zip`)
482+
document.body.appendChild(link)
483+
link.click()
484+
link.parentNode.removeChild(link)
485+
})
486+
}}
487+
>
488+
<ReactSVG path={assets(`${Download}`)} />
489+
</button>
490+
</div>
444491
</div>
445492
))}
446493
</div>
447494

448495
<div className={styles['top-title']} >
449-
<div className={styles.btnManageSubmissions} >
450-
<PrimaryButton
451-
text='Manage Submissions'
452-
type='info'
453-
href={`${SUBMISSION_REVIEW_APP_URL}/${challenge.legacyId}`}
454-
/>
455-
</div>
456-
457496
<div className={styles.btnManageSubmissions} >
458497
<PrimaryButton
459498
text='Download All'

0 commit comments

Comments
 (0)