mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: move limits display to sidebar
This commit is contained in:
1 parent
90443546c8
commit
5bd851028c
4 files changed
+20
-19
No files matched your search
@@ -6,7 +6,7 @@ import {
|
|||||||
SolutionNotFoundError, ProblemNotFoundError, BadRequestError,
|
SolutionNotFoundError, ProblemNotFoundError, BadRequestError,
|
||||||
} from '../error';
|
} from '../error';
|
||||||
import {
|
import {
|
||||||
Pdoc, User, Rdoc, PathComponent,
|
Pdoc, User, Rdoc, PathComponent, ProblemStatusDoc,
|
||||||
} from '../interface';
|
} from '../interface';
|
||||||
import paginate from '../lib/paginate';
|
import paginate from '../lib/paginate';
|
||||||
import { isPid } from '../lib/validator';
|
import { isPid } from '../lib/validator';
|
||||||
@@ -157,8 +157,12 @@ export class ProblemRandomHandler extends ProblemHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PdocWithPsdoc extends Pdoc {
|
||||||
|
psdoc?: ProblemStatusDoc
|
||||||
|
}
|
||||||
|
|
||||||
export class ProblemDetailHandler extends ProblemHandler {
|
export class ProblemDetailHandler extends ProblemHandler {
|
||||||
pdoc: Pdoc;
|
pdoc: PdocWithPsdoc;
|
||||||
udoc: User;
|
udoc: User;
|
||||||
|
|
||||||
@route('pid', Types.Name, true, null, parsePid)
|
@route('pid', Types.Name, true, null, parsePid)
|
||||||
@@ -196,6 +200,9 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.response.body.pdoc.config = `Cannot parse: ${e.message}`;
|
this.response.body.pdoc.config = `Cannot parse: ${e.message}`;
|
||||||
}
|
}
|
||||||
|
if (this.pdoc.psdoc) {
|
||||||
|
this.response.body.rdoc = await record.get(this.domainId, this.pdoc.psdoc.rid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('pid', Types.UnsignedInt)
|
@param('pid', Types.UnsignedInt)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class Loader extends nunjucks.Loader {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
let fullpath = null;
|
let fullpath = null;
|
||||||
if (typeof argv.template !== 'string') argv.template = path.resolve(__dirname, '..', 'template');
|
if (typeof argv.template !== 'string') argv.template = path.resolve(__dirname, '..', 'templates');
|
||||||
const p = path.resolve(process.cwd(), argv.template, name);
|
const p = path.resolve(process.cwd(), argv.template, name);
|
||||||
if (fs.existsSync(p)) fullpath = p;
|
if (fs.existsSync(p)) fullpath = p;
|
||||||
if (!fullpath) {
|
if (!fullpath) {
|
||||||
|
|||||||
@@ -114,6 +114,10 @@
|
|||||||
<dl class="large horizontal">
|
<dl class="large horizontal">
|
||||||
<dt>{{ _('ID') }}</dt>
|
<dt>{{ _('ID') }}</dt>
|
||||||
<dd>{{ pdoc.docId }}</dd>
|
<dd>{{ pdoc.docId }}</dd>
|
||||||
|
<dt>{{ _('Time') }}</dt>
|
||||||
|
<dd>{{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms</dd>
|
||||||
|
<dt>{{ _('Memory') }}</dt>
|
||||||
|
<dd>{{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB</dd>
|
||||||
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
|
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
|
||||||
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
|
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
|
||||||
<dt>{{ _('Submission') }}</dt>
|
<dt>{{ _('Submission') }}</dt>
|
||||||
|
|||||||
@@ -24,28 +24,18 @@
|
|||||||
<div class="medium-9 columns">
|
<div class="medium-9 columns">
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<div class="problem-content-container"><div class="problem-content" data-marker-enabled>
|
<div class="problem-content-container"><div class="problem-content" data-marker-enabled>
|
||||||
<div class="section__header non-scratchpad--hide">
|
<div class="section__header">
|
||||||
<h1 class="section__title">
|
|
||||||
{%- if rdoc -%}
|
|
||||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc['status']] }}"></span>
|
|
||||||
<span class="record-status--text {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
|
|
||||||
{{ rdoc.score }}
|
|
||||||
</span>
|
|
||||||
{%- endif %}
|
|
||||||
{{ pdoc.title }}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<div class="section__header scratchpad--hide">
|
|
||||||
{% if rdoc %}
|
{% if rdoc %}
|
||||||
<h1 class="section__title">
|
<h1 class="section__title scratchpad--hide">
|
||||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc['status']] }}"></span>
|
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc['status']] }}"></span>
|
||||||
<span class="record-status--text {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
|
<span class="record-status--text {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
|
||||||
{{ rdoc.score }}
|
{{ 'Accepted' if rdoc.status == model.builtin.STATUS.STATUS_ACCEPTED else rdoc.score }}
|
||||||
</span>
|
</span>
|
||||||
</h1>
|
</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="record-status--text">{{ _('Time Limit') }}: {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms</span>
|
<h1 class="section__title non-scratchpad--hide">
|
||||||
<span class="record-status--text">{{ _('Memory Limit') }}: {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB</span>
|
{{ pdoc.title }}
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="section__body typo">
|
<div class="section__body typo">
|
||||||
{% if tdoc %}
|
{% if tdoc %}
|
||||||
|
|||||||
Reference in new issue
Block a user