File tree Expand file tree Collapse file tree 15 files changed +125
-22
lines changed Expand file tree Collapse file tree 15 files changed +125
-22
lines changed Original file line number Diff line number Diff line change
1
+ import { helper } from '@ember/component/helper' ;
2
+ import convertToTable from '../util/json-to-table' ;
3
+
4
+ export default helper ( function jsonToTable ( [ data ] ) {
5
+ return convertToTable ( data ) ;
6
+ } ) ;
Original file line number Diff line number Diff line change 19
19
{{ /if }}
20
20
<SubmissionResult
21
21
@fullScreen ={{ fullScreen }}
22
+ @allowedLanguages ={{ contest.allowedLanguages }}
23
+
22
24
@judgeResult ={{ if (not submission.codeTaskGroup.isRunning ) lastResult }} />
23
25
</div >
24
26
{{ /if }}
Original file line number Diff line number Diff line change @@ -48,7 +48,12 @@ export default class CodeWindowComponent extends Component {
48
48
code : "csharp" ,
49
49
mode : "csharp" ,
50
50
source : ""
51
- }
51
+ } , {
52
+ name : "MySQL 10" ,
53
+ code : "mysql" ,
54
+ mode : "mysql" ,
55
+ source : ""
56
+ }
52
57
]
53
58
54
59
setSubmission = ( ) => {
Original file line number Diff line number Diff line change 48
48
</div >
49
49
<div class =" w-100" >
50
50
{{ #liquid-if (eq currentTab ' problem' )}}
51
- <ProblemExplanation @problem ={{ problem }} />
51
+ <ProblemExplanation @problem ={{ problem }} @ contest = {{ contest }} />
52
52
{{ else if (eq currentTab 'submissions')}}
53
53
<SubmissionsList
54
54
@contest ={{ contest }}
Original file line number Diff line number Diff line change 1
1
import Component from '@ember/component' ;
2
+ import { inject as service } from '@ember/service' ;
3
+ import jsonToTable from '../../../helpers/json-to-table' ;
2
4
3
5
export default Component . extend ( {
4
- } ) ;
6
+
7
+ languageSelection : service ( 'language-selection' ) ,
8
+ init ( ) {
9
+ this . _super ( ...arguments ) ;
10
+ let contest = this . get ( 'contest' ) . data ;
11
+
12
+ document . addEventListener ( 'contextmenu' , function ( event ) {
13
+ event . preventDefault ( ) ;
14
+ } ) ;
15
+ document . addEventListener ( 'keydown' , function ( event ) {
16
+ if (
17
+ event . key === 'F12' ||
18
+ ( event . ctrlKey && event . shiftKey && event . key === 'I' ) ||
19
+ ( event . ctrlKey && event . shiftKey && event . key === 'C' ) ||
20
+ ( event . ctrlKey && event . shiftKey && event . key === 'J' ) ||
21
+ ( event . ctrlKey && event . key === 'U' )
22
+ ) {
23
+ event . preventDefault ( ) ;
24
+ }
25
+ } ) ;
26
+
27
+ } ,
28
+ jsonToTable ( data ) {
29
+
30
+ const table = jsonToTable ( data ) ;
31
+ return table ;
32
+ }
33
+
34
+ } ) ;
Original file line number Diff line number Diff line change 1
1
<div class =" py-4" >
2
- <p >
3
- {{ markdown-to-html problem.details.description }}
4
- </p >
2
+ <p class =" no-select" >{{ markdown-to-html problem.details.description }} </p >
3
+
5
4
<div class =" extra-bold" >Input Format</div >
6
- <p >
7
- {{ markdown-to-html problem.details.input_format }}
8
- </p >
5
+
6
+ <pre >{{ problem.details.input_format }} </pre >
7
+
8
+
9
9
<div class =" extra-bold" >Constraints</div >
10
10
<div class =" bg-grey br-5 w-60 px-4 py-2 my-2" >
11
- <p >
12
- {{ markdown-to-html problem.details.constraints }}
13
- </p >
11
+ <p >{{ markdown-to-html problem.details.constraints }} </p >
14
12
</div >
13
+
15
14
<div class =" extra-bold" >Output Format</div >
16
- <p >
17
- {{ markdown-to-html problem.details.output_format }}
18
- </p >
15
+ <pre >{{ problem.details.output_format }} </pre >
19
16
<div class =" extra-bold" >Sample Input</div >
20
17
<div class =" bg-grey br-5 w-60 px-4 py-2 my-2" >
21
- <pre >{{ problem.details.sample_input }} </pre >
18
+ <pre >{{ problem.details.sample_input }} </pre >
22
19
</div >
20
+
23
21
<div class =" extra-bold" >Sample Output</div >
24
22
<div class =" bg-grey br-5 w-60 px-4 py-2 my-2" >
23
+ {{ #if (includes contest.allowedLanguages " mysql" )}}
24
+ <pre >{{ json-to-table problem.details.sample_output }} </pre >
25
+ {{ else }}
25
26
<pre >{{ problem.details.sample_output }} </pre >
27
+ {{ /if }}
28
+
26
29
</div >
30
+
27
31
{{ #if problem.details.explanation }}
28
32
<div class =" extra-bold" >Explanation</div >
29
33
<div class =" bg-grey br-5 w-60 px-4 py-2 my-2" >
Original file line number Diff line number Diff line change 33
33
34
34
{{ #liquid-if (eq selectedTab " problem" )}}
35
35
<ProblemExplanation
36
- @problem ={{ problem }} />
36
+ @problem ={{ problem }}
37
+ @contest =" {{ this.contest }} " />
37
38
{{ else if (eq selectedTab "submissions")}}
38
39
<SubmissionsList
39
40
@contest ={{ contest }}
Original file line number Diff line number Diff line change 60
60
{{ #if (or submitProjectTask.isRunning lastResult )}}
61
61
<div class =" mt-4" >
62
62
<SubmissionResult
63
+ @allowedLanguages ={{ contest.allowedLanguages }}
64
+
63
65
@contentType ={{ content.type }}
64
66
@judgeResult ={{ if (not submitProjectTask.isRunning ) lastResult }}
65
67
/>
Original file line number Diff line number Diff line change 1
1
import Component from '@ember/component' ;
2
2
import { computed } from '@ember/object' ;
3
-
3
+ import { jsonToTable } from '../../../util/json-to-table' ;
4
4
export default class SubmissionResult extends Component {
5
5
didRender ( ) {
6
6
this . element . scrollIntoView ( { behavior : "smooth" , block : "end" } )
@@ -41,4 +41,8 @@ export default class SubmissionResult extends Component {
41
41
return this . judgeResult . testcases
42
42
}
43
43
}
44
+ jsonToTable ( data ) {
45
+ const table = jsonToTable ( data ) ;
46
+ return table ;
47
+ }
44
48
}
Original file line number Diff line number Diff line change 2
2
<span class =" font-sm bold" >
3
3
Compilation Successful
4
4
</span >
5
+
5
6
{{ #if output }}
6
- <pre class =" mt-3 bg-grey p-4" >{{ output }} </pre >
7
+ {{ #if (includes allowedLanguages " mysql" )}}
8
+ <pre class =" mt-3 bg-grey p-4" >{{ json-to-table output }} </pre >
9
+ {{ else }}
10
+ <pre class =" mt-3 bg-grey p-4" >{{ output }} </pre >
11
+ {{ /if }}
7
12
{{ /if }}
8
13
</div >
You can’t perform that action at this time.
0 commit comments