mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
core&ui: fix sidebar preview (#491)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
feb3b5cecb
commit
feb5180476
19 files changed
+152
-244
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { normalizeSubtasks, readSubtasksFromFiles, size } from '@hydrooj/utils/lib/common';
|
||||
import { normalizeSubtasks, readSubtasksFromFiles } from '@hydrooj/utils/lib/common';
|
||||
import type { SubtaskType } from 'hydrooj/src/interface';
|
||||
import $ from 'jquery';
|
||||
import yaml from 'js-yaml';
|
||||
@@ -11,7 +11,7 @@ import uploadFiles from 'vj/components/upload';
|
||||
import download from 'vj/components/zipDownloader';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import {
|
||||
i18n, loadReactRedux, request, tpl,
|
||||
i18n, loadReactRedux, pjax, request, tpl,
|
||||
} from 'vj/utils';
|
||||
|
||||
const page = new NamedPage('problem_config', () => {
|
||||
@@ -25,6 +25,8 @@ const page = new NamedPage('problem_config', () => {
|
||||
await new Promise((resolve) => { input.onchange = resolve; });
|
||||
await uploadFiles('./files', input.files, {
|
||||
type: 'testdata',
|
||||
sidebar: true,
|
||||
pjax: true,
|
||||
singleFileUploadCallback: (file) => {
|
||||
reduxStore.dispatch({
|
||||
type: 'CONFIG_ADD_TESTDATA',
|
||||
@@ -34,13 +36,6 @@ const page = new NamedPage('problem_config', () => {
|
||||
size: file.size,
|
||||
},
|
||||
});
|
||||
$('.testdata-table tbody').append(
|
||||
$(tpl`<tr data-filename="${file.name}" data-size="${file.size.toString()}">
|
||||
<td class="col--name" title="${file.name}"><a href="./file/${file.name}?type=testdata">${file.name}</a></td>
|
||||
<td class="col--size">${size(file.size)}</td>
|
||||
<td class="col--operation"><a href="javascript:;" name="testdata__delete"><span class="icon icon-delete"></span></a></td>
|
||||
</tr>`),
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -62,7 +57,7 @@ const page = new NamedPage('problem_config', () => {
|
||||
type: 'CONFIG_DELETE_TESTDATA',
|
||||
value: file,
|
||||
});
|
||||
$(ev.currentTarget).parent().parent().remove();
|
||||
await pjax.request({ url: './files?testdata=false&sidebar=true', push: false });
|
||||
} catch (error) {
|
||||
Notification.error(error.message);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user