Skip to content

Commit 39cc430

Browse files
committed
add manage_rejudge
1 parent d1098b0 commit 39cc430

2 files changed

Lines changed: 111 additions & 23 deletions

File tree

packages/ui-default/pages/manage_rejudge.page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { STATUS_TEXTS } from '@hydrooj/common';
12
import $ from 'jquery';
23
import CustomSelectAutoComplete from 'vj/components/autocomplete/CustomSelectAutoComplete';
34
import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectAutoComplete';
@@ -15,7 +16,9 @@ const page = new NamedPage('manage_rejudge', async () => {
1516
const langs = Object.keys(window.LANGS).filter((i) => !prefixes.has(i)).map((i) => (
1617
{ name: `${i.includes('.') ? `${window.LANGS[i.split('.')[0]].display}/` : ''}${window.LANGS[i].display}`, _id: i }
1718
));
18-
CustomSelectAutoComplete.getOrConstruct($('[name=lang]'), { multi: false, data: langs });
19+
CustomSelectAutoComplete.getOrConstruct($('[name=lang]'), { multi: true, data: langs });
20+
const statuses = Object.values(STATUS_TEXTS).map((i) => ({ name: i, _id: i }));
21+
CustomSelectAutoComplete.getOrConstruct($('[name=status]'), { multi: true, data: statuses });
1922
});
2023

2124
export default page;

packages/ui-default/templates/manage_rejudge.html

Lines changed: 107 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,146 @@
33
{% block manage_content %}
44
<div class="section">
55
<div class="section__header">
6-
<h1 class="section__title" data-heading>{{ _('Bulk Rejudge') }}</h1>
6+
<h1 class="section__title">{{ _('Bulk Rejudge') }}</h1>
77
</div>
88
<div class="section__body">
9+
{% if error %}
10+
<p class="typo text-red">{{ error.split('\n')|join('<br>') }}</p>
11+
{% endif %}
912
<form>
1013
<div class="row">
11-
<div class="medium-6 columns">
14+
<div class="medium-3 columns">
1215
<label class="filter-user">
1316
{{ _('By Username / UID') }}
14-
<input name="uidOrName" type="text" class="textbox" value="" autocomplete="off" data-autofocus>
17+
<input name="uidOrName" type="text" class="textbox" value="{{ uidOrName|default('') }}" autocomplete="off" data-autofocus>
1518
</label>
1619
</div>
17-
<div class="medium-6 columns">
20+
<div class="medium-3 columns">
1821
<label>
1922
{{ _('By Problem') }}
20-
<input name="pid" type="text" class="textbox" value="">
23+
<input name="pid" type="text" class="textbox" value="{{ pid|default('') }}">
2124
</label>
2225
</div>
23-
</div>
24-
<div class="row">
25-
<div class="medium-6 columns">
26+
<div class="medium-3 columns">
2627
<label>
2728
{{ _('By Contest') }}
28-
<input name="tid" type="text" class="textbox" value="">
29+
<input name="tid" type="text" class="textbox" value="{{ tid|default('') }}">
2930
</label>
3031
</div>
31-
<div class="medium-6 columns">
32+
<div class="medium-3 columns">
3233
<label>
3334
{{ _('By Language') }}
34-
<input name="lang" type="text" class="textbox" value="">
35+
<input name="lang" type="text" class="textbox" value="{{ lang|default('') }}">
3536
</label>
3637
</div>
3738
</div>
3839
<div class="row">
39-
<div class="medium-6 columns">
40+
{{ form.form_text({
41+
columns:3,
42+
label:'Begin Date',
43+
name:'beginAtDate',
44+
placeholder:'YYYY-mm-dd',
45+
value:dateBeginText,
46+
date:true,
47+
row:false
48+
}) }}
49+
{{ form.form_text({
50+
columns:2,
51+
label:'Begin Time',
52+
name:'beginAtTime',
53+
placeholder:'HH:MM',
54+
value:timeBeginText,
55+
time:true,
56+
row:false
57+
}) }}
58+
{{ form.form_text({
59+
columns:3,
60+
label:'End Date',
61+
name:'endAtDate',
62+
placeholder:'YYYY-mm-dd',
63+
value:dateEndText,
64+
date:true,
65+
row:false
66+
}) }}
67+
{{ form.form_text({
68+
columns:2,
69+
label:'End Time',
70+
name:'endAtTime',
71+
placeholder:'HH:MM',
72+
value:timeEndText,
73+
time:true,
74+
row:false
75+
}) }}
76+
</div>
77+
<div class="row">
78+
<div class="medium-7 columns">
4079
<label>
4180
{{ _('By Status') }}
81+
<input name="status" type="text" class="textbox" value="{{ status|default('') }}">
4282
</label>
43-
<select class="select" name="status">
44-
<option value="" selected>{{ _('All Submissions') }}</option>
45-
{%- for k,v in utils.status.STATUS_TEXTS -%}
46-
<option value="{{k}}">{{v}}</option>
47-
{%- endfor -%}
48-
</select>
4983
</div>
50-
<div class="medium-6 columns">
84+
<div class="medium-5 columns">
5185
<label>
52-
{{ _('Apply') }}
53-
<input name="apply" type="checkbox" class="checkbox" value="1">
86+
<label class="checkbox">
87+
{{ _('High priority') }}
88+
<input name="high_priority" type="checkbox" class="checkbox" {% if high_priority %}checked{% endif %}>
89+
</label>
90+
<br>
91+
<label class="checkbox">
92+
{{ _('Apply result after rejudge') }}
93+
<input name="apply" type="checkbox" class="checkbox" {% if apply %}checked{% endif %}>
94+
</label>
5495
</label>
5596
</div>
5697
</div>
98+
<div class="row">
99+
<div class="medium-3 columns">
100+
<button name="operation" value="preview" class="rounded button">{{ _('Preview') }}</button>
101+
<button name="operation" value="rejudge" class="rounded primary button">{{ _('Rejudge') }}</button>
102+
</div>
103+
</div>
57104
<div class="row"><div class="columns">
58-
<button name="submit" class="rounded primary button">{{ _('Rejudge') }}</button>
59105
</div></div>
60106
</form>
61107
</div>
62108
</div>
109+
<div class="section">
110+
<div class="section__header">
111+
<h1 class="section__title">{{ _('Bulk Rejudge Result') }}</h1>
112+
</div>
113+
<div class="section__body no-padding">
114+
<table class="data-table">
115+
<colgroup>
116+
<col class="col--count">
117+
<col class="col--beginAt">
118+
<col class="col--status">
119+
<col class="col--action">
120+
</colgroup>
121+
<thead>
122+
<tr>
123+
<th>#</th>
124+
<th>{{ _('Operator') }}</th>
125+
<th>{{ _('Count') }}</th>
126+
<th>{{ _('Begin At') }}</th>
127+
<th>{{ _('Status') }}</th>
128+
<th>{{ _('Action') }}</th>
129+
</tr>
130+
</thead>
131+
<tbody>
132+
{%- for item in tasks -%}
133+
<tr>
134+
<td>{{ item._id.toHexString()|truncate(8,True,'') }}</td>
135+
<td>{{ user.render_inline(item.operator, badge=false) }}</td>
136+
<td>{{ item.count }}</td>
137+
<td>{{ item.beginAt }}</td>
138+
<td>{{ item.status }}</td>
139+
<td>
140+
<a class="typo-a" href="{{ url('manage_rejudge_detail', query={id: item._id.toHexString()}) }}">{{ _('View') }}</a>
141+
</td>
142+
</tr>
143+
{%- endfor -%}
144+
</tbody>
145+
</table>
146+
</div>
147+
</div>
63148
{% endblock %}

0 commit comments

Comments
 (0)