mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
ui: add confirm dialog (#226)
This commit is contained in:
1 parent
8b9a3c6410
commit
c696f51789
15 files changed
+46
-32
No files matched your search
+4
-4
@@ -28,10 +28,10 @@
|
|||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
"@types/node": "^16.9.6",
|
"@types/node": "^16.10.2",
|
||||||
"@types/semver": "^7.3.8",
|
"@types/semver": "^7.3.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||||
"@typescript-eslint/parser": "^4.31.2",
|
"@typescript-eslint/parser": "^4.33.0",
|
||||||
"cac": "^6.7.3",
|
"cac": "^6.7.3",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"nmls": "^3.0.1",
|
"nmls": "^3.0.1",
|
||||||
"ora": "5.4.1",
|
"ora": "5.4.1",
|
||||||
"semver": "^7.3.5",
|
"semver": "^7.3.5",
|
||||||
"typedoc": "^0.22.4",
|
"typedoc": "^0.22.5",
|
||||||
"typescript": "4.4.2"
|
"typescript": "4.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,14 +16,14 @@
|
|||||||
"mongodb": "^3.7.1",
|
"mongodb": "^3.7.1",
|
||||||
"p-queue": "^7.1.0",
|
"p-queue": "^7.1.0",
|
||||||
"shell-quote": "^1.7.2",
|
"shell-quote": "^1.7.2",
|
||||||
"ws": "^8.2.2"
|
"ws": "^8.2.3"
|
||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/js-yaml": "^4.0.3",
|
"@types/js-yaml": "^4.0.3",
|
||||||
"@types/lodash": "^4.14.174",
|
"@types/lodash": "^4.14.175",
|
||||||
"@types/shell-quote": "^1.7.1",
|
"@types/shell-quote": "^1.7.1",
|
||||||
"@types/ws": "^7.4.7"
|
"@types/ws": "^7.4.7"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,11 +31,11 @@
|
|||||||
"koa-static-cache": "^5.1.4",
|
"koa-static-cache": "^5.1.4",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lru-cache": "^6.0.0",
|
"lru-cache": "^6.0.0",
|
||||||
"mime-types": "^2.1.32",
|
"mime-types": "^2.1.33",
|
||||||
"minio": "7.0.19",
|
"minio": "7.0.19",
|
||||||
"moment-timezone": "^0.5.33",
|
"moment-timezone": "^0.5.33",
|
||||||
"mongodb": "^3.7.1",
|
"mongodb": "^3.7.1",
|
||||||
"nanoid": "^3.1.25",
|
"nanoid": "^3.1.28",
|
||||||
"nodemailer": "^6.6.5",
|
"nodemailer": "^6.6.5",
|
||||||
"p-queue": "^7.1.0",
|
"p-queue": "^7.1.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
"@types/koa-compress": "^4.0.3",
|
"@types/koa-compress": "^4.0.3",
|
||||||
"@types/koa-router": "^7.4.4",
|
"@types/koa-router": "^7.4.4",
|
||||||
"@types/koa-static-cache": "^5.1.1",
|
"@types/koa-static-cache": "^5.1.1",
|
||||||
"@types/lodash": "^4.14.174",
|
"@types/lodash": "^4.14.175",
|
||||||
"@types/lru-cache": "^5.1.1",
|
"@types/lru-cache": "^5.1.1",
|
||||||
"@types/mime-types": "^2.1.1",
|
"@types/mime-types": "^2.1.1",
|
||||||
"@types/minio": "^7.0.10",
|
"@types/minio": "^7.0.10",
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
"@types/superagent": "^4.1.13",
|
"@types/superagent": "^4.1.13",
|
||||||
"formidable": "^1.2.2",
|
"formidable": "^1.2.2",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"pm2": "^5.1.1"
|
"pm2": "^5.1.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"pm2": "*"
|
"pm2": "*"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ws": "^8.2.2"
|
"ws": "^8.2.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/ws": "^7.4.7"
|
"@types/ws": "^7.4.7"
|
||||||
|
|||||||
@@ -165,10 +165,7 @@ async function onCommentClickDelete(type, ev) {
|
|||||||
? 'Confirm deleting this comment? Its replies will be deleted as well.'
|
? 'Confirm deleting this comment? Its replies will be deleted as well.'
|
||||||
: 'Confirm deleting this reply?';
|
: 'Confirm deleting this reply?';
|
||||||
const action = await new ConfirmDialog({
|
const action = await new ConfirmDialog({
|
||||||
$body: tpl`
|
$body: tpl.typoMsg(i18n(message)),
|
||||||
<div class="typo">
|
|
||||||
<p>${i18n(message)}</p>
|
|
||||||
</div>`,
|
|
||||||
}).open();
|
}).open();
|
||||||
if (action !== 'yes') return;
|
if (action !== 'yes') return;
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ Completed: 已完成
|
|||||||
Confirm deleting the selected roles?: 您确定删除所选角色吗?
|
Confirm deleting the selected roles?: 您确定删除所选角色吗?
|
||||||
Confirm deleting this comment? Its replies will be deleted as well.: 确认删除这个评论吗?回复会被同时删除。
|
Confirm deleting this comment? Its replies will be deleted as well.: 确认删除这个评论吗?回复会被同时删除。
|
||||||
Confirm deleting this reply?: 确认删除这个回复吗?
|
Confirm deleting this reply?: 确认删除这个回复吗?
|
||||||
|
Confirm rejudge this problem?: 确定要重测这道题吗?
|
||||||
Confirm removing the selected users?: 您确定将所选用户移除吗?
|
Confirm removing the selected users?: 您确定将所选用户移除吗?
|
||||||
Confirm to delete the selected files?: 确认删除所选文件吗?
|
Confirm to delete the selected files?: 确认删除所选文件吗?
|
||||||
Confirmation mail has been sent to your new email.: 确认邮件已经发送到您的新电子邮箱。
|
Confirmation mail has been sent to your new email.: 确认邮件已经发送到您的新电子邮箱。
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.22.10",
|
"version": "4.22.11",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
@@ -11,9 +11,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@blockly/block-extension-tooltip": "^1.0.19",
|
"@blockly/block-extension-tooltip": "^1.0.19",
|
||||||
"@blueprintjs/core": "^3.50.2",
|
"@blueprintjs/core": "^3.50.4",
|
||||||
"@blueprintjs/icons": "^3.30.1",
|
"@blueprintjs/icons": "^3.30.2",
|
||||||
"@blueprintjs/select": "^3.18.4",
|
"@blueprintjs/select": "^3.18.6",
|
||||||
"@hydrooj/utils": "workspace:*",
|
"@hydrooj/utils": "workspace:*",
|
||||||
"@types/jquery": "^3.5.6",
|
"@types/jquery": "^3.5.6",
|
||||||
"@types/json-schema": "^7.0.9",
|
"@types/json-schema": "^7.0.9",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"@types/sockjs-client": "^1.5.1",
|
"@types/sockjs-client": "^1.5.1",
|
||||||
"@undefined-moe/monaco-yaml": "^2.5.0",
|
"@undefined-moe/monaco-yaml": "^2.5.0",
|
||||||
"ansi_up": "^5.0.1",
|
"ansi_up": "^5.0.1",
|
||||||
"autoprefixer": "^9.8.6",
|
"autoprefixer": "^9.8.8",
|
||||||
"blockly": "^6.20210701.0",
|
"blockly": "^6.20210701.0",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"eslint-import-resolver-webpack": "^0.13.1",
|
"eslint-import-resolver-webpack": "^0.13.1",
|
||||||
"eslint-plugin-import": "^2.24.2",
|
"eslint-plugin-import": "^2.24.2",
|
||||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||||
"eslint-plugin-react": "^7.26.0",
|
"eslint-plugin-react": "^7.26.1",
|
||||||
"fancy-log": "^1.3.3",
|
"fancy-log": "^1.3.3",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"monaco-editor": "^0.27.0",
|
"monaco-editor": "^0.27.0",
|
||||||
"monaco-editor-webpack-plugin": "^4.1.2",
|
"monaco-editor-webpack-plugin": "^4.1.2",
|
||||||
"nanoid": "^3.1.25",
|
"nanoid": "^3.1.28",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pickadate": "^3.6.4",
|
"pickadate": "^3.6.4",
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ const page = new NamedPage(['contest_edit', 'contest_create', 'homework_create',
|
|||||||
}
|
}
|
||||||
const message = `Confirm deleting this ${pagename.split('_')[0]}? Its status will be deleted as well.`;
|
const message = `Confirm deleting this ${pagename.split('_')[0]}? Its status will be deleted as well.`;
|
||||||
return new ConfirmDialog({
|
return new ConfirmDialog({
|
||||||
$body: tpl`
|
$body: tpl.typoMsg(i18n(message)),
|
||||||
<div class="typo">
|
|
||||||
<p>${i18n(message)}</p>
|
|
||||||
</div>`,
|
|
||||||
}).open().then((action) => {
|
}).open().then((action) => {
|
||||||
if (action !== 'yes') return;
|
if (action !== 'yes') return;
|
||||||
confirmed = true;
|
confirmed = true;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { getScoreColor } from '@hydrooj/utils/lib/status';
|
import { getScoreColor } from '@hydrooj/utils/lib/status';
|
||||||
import { NamedPage } from 'vj/misc/Page';
|
import { NamedPage } from 'vj/misc/Page';
|
||||||
|
import tpl from 'vj/utils/tpl';
|
||||||
|
import i18n from 'vj/utils/i18n';
|
||||||
|
import { ConfirmDialog } from 'vj/components/dialog';
|
||||||
import { downloadProblemSet } from 'vj/components/zipDownloader';
|
import { downloadProblemSet } from 'vj/components/zipDownloader';
|
||||||
import loadReactRedux from 'vj/utils/loadReactRedux';
|
import loadReactRedux from 'vj/utils/loadReactRedux';
|
||||||
import delay from 'vj/utils/delay';
|
import delay from 'vj/utils/delay';
|
||||||
@@ -260,6 +263,15 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
|
|||||||
leaveScratchpadMode();
|
leaveScratchpadMode();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
});
|
});
|
||||||
|
$(document).on('click', '[name="problem-sidebar__rejudge"]', (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
new ConfirmDialog({
|
||||||
|
$body: tpl.typoMsg(i18n('Confirm rejudge this problem?')),
|
||||||
|
}).open().then((action) => {
|
||||||
|
if (action !== 'yes') return;
|
||||||
|
$(ev.currentTarget).closest('form').trigger('submit');
|
||||||
|
});
|
||||||
|
});
|
||||||
$(document).on('click', '[name="show_tags"]', (ev) => {
|
$(document).on('click', '[name="show_tags"]', (ev) => {
|
||||||
$(ev.currentTarget).hide();
|
$(ev.currentTarget).hide();
|
||||||
$('span.tags').css('display', 'inline-block');
|
$('span.tags').css('display', 'inline-block');
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
<form method="post" action="{{ url('problem_detail', pid=pdoc.docId) }}">
|
<form method="post" action="{{ url('problem_detail', pid=pdoc.docId) }}">
|
||||||
<input type="hidden" name="operation" value="rejudge">
|
<input type="hidden" name="operation" value="rejudge">
|
||||||
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
|
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
|
||||||
<button type="submit" class="menu__link">
|
<button type="submit" class="menu__link" name="problem-sidebar__rejudge">
|
||||||
<span class="icon icon-refresh"></span> {{ _('Rejudge all submissions') }}
|
<span class="icon icon-refresh"></span> {{ _('Rejudge all submissions') }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -13,6 +13,14 @@ export default function tpl(pieces, ...substitutions) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tpl.typoMsg = function (msg) {
|
||||||
|
return tpl`
|
||||||
|
<div class="typo">
|
||||||
|
<p>${msg}</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
export function rawHtml(html) {
|
export function rawHtml(html) {
|
||||||
return {
|
return {
|
||||||
templateRaw: true,
|
templateRaw: true,
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ export function bufferToStream(buffer: Buffer): NodeJS.ReadableStream {
|
|||||||
|
|
||||||
export function sleep(timeout: number) {
|
export function sleep(timeout: number) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(resolve, timeout);
|
setTimeout(() => resolve(true), timeout);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"mongodb": "^3.7.1",
|
"mongodb": "^3.7.1",
|
||||||
"systeminformation": "^5.9.3"
|
"systeminformation": "^5.9.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jsdom": "^16.2.13",
|
"@types/jsdom": "^16.2.13",
|
||||||
"@types/lodash": "^4.14.174",
|
"@types/lodash": "^4.14.175",
|
||||||
"@types/superagent": "^4.1.13",
|
"@types/superagent": "^4.1.13",
|
||||||
"@types/superagent-proxy": "^2.0.1"
|
"@types/superagent-proxy": "^2.0.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import * as setting from 'hydrooj/src/model/setting';
|
|||||||
import { IBasicProvider, RemoteAccount } from '../interface';
|
import { IBasicProvider, RemoteAccount } from '../interface';
|
||||||
|
|
||||||
proxy(superagent);
|
proxy(superagent);
|
||||||
const logger = new Logger('codeforces');
|
const logger = new Logger('remote/codeforces');
|
||||||
|
|
||||||
const VERDICT = {
|
const VERDICT = {
|
||||||
RUNTIME_ERROR: STATUS.STATUS_RUNTIME_ERROR,
|
RUNTIME_ERROR: STATUS.STATUS_RUNTIME_ERROR,
|
||||||
@@ -100,7 +100,6 @@ export default class CodeforcesProvider implements IBasicProvider {
|
|||||||
password: this.account.password,
|
password: this.account.password,
|
||||||
remember: 'on',
|
remember: 'on',
|
||||||
});
|
});
|
||||||
console.log(res.header);
|
|
||||||
const cookie = res.header['set-cookie'];
|
const cookie = res.header['set-cookie'];
|
||||||
if (cookie) {
|
if (cookie) {
|
||||||
await this.save({ cookie });
|
await this.save({ cookie });
|
||||||
|
|||||||
Reference in new issue
Block a user