mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
problem pretest
This commit is contained in:
1 parent
dd5a212422
commit
554698189c
17 files changed
+127
-57
No files matched your search
@@ -4,6 +4,7 @@ config.json
|
|||||||
.build/
|
.build/
|
||||||
*.build
|
*.build
|
||||||
.uibuild/
|
.uibuild/
|
||||||
|
dist/
|
||||||
.cache/
|
.cache/
|
||||||
*.cache
|
*.cache
|
||||||
__*
|
__*
|
||||||
|
|||||||
+35
-1
@@ -1,4 +1,6 @@
|
|||||||
|
const yaml = require('js-yaml');
|
||||||
const { PERM_JUDGE } = require('../permission');
|
const { PERM_JUDGE } = require('../permission');
|
||||||
|
const { parseTimeMS, parseMemoryMB } = require('../utils');
|
||||||
const record = require('../model/record');
|
const record = require('../model/record');
|
||||||
const problem = require('../model/problem');
|
const problem = require('../model/problem');
|
||||||
const builtin = require('../model/builtin');
|
const builtin = require('../model/builtin');
|
||||||
@@ -13,6 +15,7 @@ const {
|
|||||||
async function _postJudge(rdoc) {
|
async function _postJudge(rdoc) {
|
||||||
const accept = rdoc.status === builtin.STATUS_ACCEPTED;
|
const accept = rdoc.status === builtin.STATUS_ACCEPTED;
|
||||||
bus.publish('record_change', rdoc);
|
bus.publish('record_change', rdoc);
|
||||||
|
if (rdoc.type === 'run') return;
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
if (rdoc.tid) {
|
if (rdoc.tid) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
@@ -26,7 +29,7 @@ async function _postJudge(rdoc) {
|
|||||||
if (accept && !rdoc.rejudged) {
|
if (accept && !rdoc.rejudged) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
problem.inc(rdoc.domainId, rdoc.pid, 'nAccept', 1),
|
problem.inc(rdoc.domainId, rdoc.pid, 'nAccept', 1),
|
||||||
user.inc(rdoc.domainId, rdoc.uid, 'nAccept', 1),
|
user.incDomain(rdoc.domainId, rdoc.uid, 'nAccept', 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +81,8 @@ async function end(body) {
|
|||||||
}
|
}
|
||||||
if (body.status) $set.status = body.status;
|
if (body.status) $set.status = body.status;
|
||||||
if (body.score) $set.score = body.score;
|
if (body.score) $set.score = body.score;
|
||||||
|
if (body.stdout) $set.stdout = body.stdout;
|
||||||
|
if (body.stderr) $set.stderr = body.stderr;
|
||||||
if (body.time_ms) $set.time = body.time_ms;
|
if (body.time_ms) $set.time = body.time_ms;
|
||||||
if (body.memory_kb) $set.memory = body.memory_kb;
|
if (body.memory_kb) $set.memory = body.memory_kb;
|
||||||
$set.judgeAt = new Date();
|
$set.judgeAt = new Date();
|
||||||
@@ -87,6 +92,34 @@ async function end(body) {
|
|||||||
rdoc = await record.update(body.domainId, body.rid, $set, $push);
|
rdoc = await record.update(body.domainId, body.rid, $set, $push);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PretestHandler extends Handler {
|
||||||
|
async post({
|
||||||
|
domainId, pid, code, lang, time = '1s', memory = '256m', input = '',
|
||||||
|
}) {
|
||||||
|
if (pid) {
|
||||||
|
const pdoc = await problem.get(domainId, pid);
|
||||||
|
if (pdoc.config) {
|
||||||
|
const config = yaml.safeLoad(pdoc.config);
|
||||||
|
if (config.time) time = config.time;
|
||||||
|
if (config.memory) memory = config.memory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const rid = await record.add(domainId, {
|
||||||
|
pid: pid || String.random(16),
|
||||||
|
uid: this.user._id,
|
||||||
|
type: 'run',
|
||||||
|
time: parseTimeMS(time),
|
||||||
|
memory: parseMemoryMB(memory),
|
||||||
|
input,
|
||||||
|
lang,
|
||||||
|
code,
|
||||||
|
hidden: true,
|
||||||
|
});
|
||||||
|
this.response.body = { rid };
|
||||||
|
this.response.redirect = this.url('record_detail', { rid });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class JudgeHandler extends Handler {
|
class JudgeHandler extends Handler {
|
||||||
async get({ check = false }) {
|
async get({ check = false }) {
|
||||||
if (check) return;
|
if (check) return;
|
||||||
@@ -130,6 +163,7 @@ class JudgeConnectionHandler extends ConnectionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function apply() {
|
async function apply() {
|
||||||
|
Route('pretest', '/pretest', PretestHandler);
|
||||||
Route('judge', '/judge', JudgeHandler, PERM_JUDGE);
|
Route('judge', '/judge', JudgeHandler, PERM_JUDGE);
|
||||||
Connection('judge_conn', '/judge/conn', JudgeConnectionHandler, PERM_JUDGE);
|
Connection('judge_conn', '/judge/conn', JudgeConnectionHandler, PERM_JUDGE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ class SystemScriptHandler extends SystemHandler {
|
|||||||
|
|
||||||
async post({ domainId, id, args = '{}' }) {
|
async post({ domainId, id, args = '{}' }) {
|
||||||
args = JSON.parse(args);
|
args = JSON.parse(args);
|
||||||
// TODO Do not use console.log
|
|
||||||
const rid = await record.add(domainId, {
|
const rid = await record.add(domainId, {
|
||||||
pid: id,
|
pid: id,
|
||||||
uid: this.user._id,
|
uid: this.user._id,
|
||||||
lang: null,
|
lang: null,
|
||||||
code: null,
|
code: null,
|
||||||
status: STATUS.STATUS_JUDGING,
|
status: STATUS.STATUS_JUDGING,
|
||||||
|
hidden: true,
|
||||||
}, false);
|
}, false);
|
||||||
async function report(data) {
|
async function report(data) {
|
||||||
judge.next({ domainId, rid, ...data });
|
judge.next({ domainId, rid, ...data });
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ class ProblemPretestConnectionHandler extends ConnectionHandler {
|
|||||||
async prepare({ domainId, pid }) {
|
async prepare({ domainId, pid }) {
|
||||||
this.pid = pid.toString();
|
this.pid = pid.toString();
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
bus.subscribe(['record_change'], this.onRecordChange);
|
bus.subscribe(['record_change'], this, 'onRecordChange');
|
||||||
}
|
}
|
||||||
|
|
||||||
async onRecordChange(data) {
|
async onRecordChange(data) {
|
||||||
@@ -239,7 +239,7 @@ class ProblemPretestConnectionHandler extends ConnectionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async cleanup() {
|
async cleanup() {
|
||||||
bus.unsubscribe(['record_change'], this.onRecordChange);
|
bus.unsubscribe(['record_change'], this, 'onRecordChange');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class RecordListHandler extends RecordHandler {
|
|||||||
domainId, page = 1, pid, tid, uidOrName,
|
domainId, page = 1, pid, tid, uidOrName,
|
||||||
}) {
|
}) {
|
||||||
this.response.template = 'record_main.html';
|
this.response.template = 'record_main.html';
|
||||||
const q = { tid };
|
const q = { tid, hidden: false };
|
||||||
if (uidOrName) {
|
if (uidOrName) {
|
||||||
q.$or = [
|
q.$or = [
|
||||||
{ unameLower: uidOrName.toLowerCase() },
|
{ unameLower: uidOrName.toLowerCase() },
|
||||||
@@ -64,6 +64,7 @@ class RecordDetailHandler extends RecordHandler {
|
|||||||
if (rdoc.uid !== this.user.uid && !this.user.hasPerm(PERM_READ_RECORD_CODE)) {
|
if (rdoc.uid !== this.user.uid && !this.user.hasPerm(PERM_READ_RECORD_CODE)) {
|
||||||
rdoc.code = null;
|
rdoc.code = null;
|
||||||
}
|
}
|
||||||
|
if (rdoc.type !== 'run') rdoc.stdout = rdoc.stderr = '';
|
||||||
const [pdoc, udoc] = await Promise.all([
|
const [pdoc, udoc] = await Promise.all([
|
||||||
problem.get(domainId, rdoc.pid, null, false),
|
problem.get(domainId, rdoc.pid, null, false),
|
||||||
user.getById(domainId, rdoc.uid),
|
user.getById(domainId, rdoc.uid),
|
||||||
@@ -76,7 +77,8 @@ class RecordDetailHandler extends RecordHandler {
|
|||||||
udoc,
|
udoc,
|
||||||
rdoc,
|
rdoc,
|
||||||
pdoc,
|
pdoc,
|
||||||
show_status: true,
|
// TODO protect
|
||||||
|
showStatus: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,14 +146,14 @@ class RecordDetailConnectionHandler extends contest.ContestHandlerMixin(Connecti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.rid = rid;
|
this.rid = rid.toString();
|
||||||
bus.subscribe(['record_change'], this, 'onRecordChange');
|
bus.subscribe(['record_change'], this, 'onRecordChange');
|
||||||
this.onRecordChange({ value: rdoc });
|
this.onRecordChange({ value: rdoc });
|
||||||
}
|
}
|
||||||
|
|
||||||
async onRecordChange(data) {
|
async onRecordChange(data) {
|
||||||
const rdoc = data.value;
|
const rdoc = data.value;
|
||||||
if (!rdoc._id.equals(this.rid)) return;
|
if (rdoc._id.toString() !== this.rid) return;
|
||||||
this.send({
|
this.send({
|
||||||
status_html: await this.renderHTML('record_detail_status.html', { rdoc }),
|
status_html: await this.renderHTML('record_detail_status.html', { rdoc }),
|
||||||
summary_html: await this.renderHTML('record_detail_summary.html', { rdoc }),
|
summary_html: await this.renderHTML('record_detail_summary.html', { rdoc }),
|
||||||
|
|||||||
+9
-1
@@ -59,7 +59,15 @@ async function executeCommand(input) {
|
|||||||
async function messageHandler(worker, msg) {
|
async function messageHandler(worker, msg) {
|
||||||
if (!msg) msg = worker;
|
if (!msg) msg = worker;
|
||||||
if (msg.event) {
|
if (msg.event) {
|
||||||
if (msg.event === 'stat') {
|
if (msg.event === 'bus') {
|
||||||
|
if (cluster.isMaster) {
|
||||||
|
for (const i in cluster.workers) {
|
||||||
|
if (i !== worker.id) cluster.workers[i].send(msg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
global.Hydro.service.bus.publish(msg.eventName, msg.payload, false);
|
||||||
|
}
|
||||||
|
} else if (msg.event === 'stat') {
|
||||||
global.Hydro.stat.reqCount += msg.count;
|
global.Hydro.stat.reqCount += msg.count;
|
||||||
} else if (msg.event === 'restart') {
|
} else if (msg.event === 'restart') {
|
||||||
console.log('Restarting');
|
console.log('Restarting');
|
||||||
|
|||||||
+17
-6
@@ -19,6 +19,7 @@ async function add(domainId, data, addTask = true) {
|
|||||||
score: 0,
|
score: 0,
|
||||||
time: 0,
|
time: 0,
|
||||||
memory: 0,
|
memory: 0,
|
||||||
|
hidden: false,
|
||||||
rejudged: false,
|
rejudged: false,
|
||||||
judgeTexts: [],
|
judgeTexts: [],
|
||||||
compilerTexts: [],
|
compilerTexts: [],
|
||||||
@@ -31,15 +32,26 @@ async function add(domainId, data, addTask = true) {
|
|||||||
coll.insertOne(data),
|
coll.insertOne(data),
|
||||||
]);
|
]);
|
||||||
if (addTask) {
|
if (addTask) {
|
||||||
await task.add({
|
const t = {
|
||||||
type: 'judge',
|
type: data.type || 'judge',
|
||||||
|
event: data.type || 'judge',
|
||||||
rid: res.insertedId,
|
rid: res.insertedId,
|
||||||
domainId,
|
domainId,
|
||||||
pid: data.pid,
|
pid: data.pid,
|
||||||
data: (pdoc || {}).data,
|
|
||||||
lang: data.lang,
|
lang: data.lang,
|
||||||
code: data.code,
|
code: data.code,
|
||||||
});
|
};
|
||||||
|
if (t.type === 'judge') {
|
||||||
|
t.data = pdoc.data;
|
||||||
|
t.config = pdoc.config;
|
||||||
|
} else {
|
||||||
|
t.config = {
|
||||||
|
time: data.time,
|
||||||
|
memory: data.memory,
|
||||||
|
input: data.input,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
await task.add(t);
|
||||||
}
|
}
|
||||||
return res.insertedId;
|
return res.insertedId;
|
||||||
}
|
}
|
||||||
@@ -66,8 +78,7 @@ async function update(domainId, rid, $set, $push, $unset) {
|
|||||||
if ($set && Object.keys($set).length) upd.$set = $set;
|
if ($set && Object.keys($set).length) upd.$set = $set;
|
||||||
if ($push && Object.keys($push).length) upd.$push = $push;
|
if ($push && Object.keys($push).length) upd.$push = $push;
|
||||||
if ($unset && Object.keys($unset).length) upd.$unset = $unset;
|
if ($unset && Object.keys($unset).length) upd.$unset = $unset;
|
||||||
await coll.findOneAndUpdate({ domainId, _id }, upd);
|
const rdoc = await coll.findOneAndUpdate({ domainId, _id }, upd, { returnOriginal: false });
|
||||||
const rdoc = await coll.findOne({ _id });
|
|
||||||
if (!rdoc) throw new RecordNotFoundError(rid);
|
if (!rdoc) throw new RecordNotFoundError(rid);
|
||||||
return rdoc;
|
return rdoc;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-10
@@ -1,4 +1,3 @@
|
|||||||
const cluster = require('cluster');
|
|
||||||
const moment = require('moment-timezone');
|
const moment = require('moment-timezone');
|
||||||
const db = require('../service/db');
|
const db = require('../service/db');
|
||||||
|
|
||||||
@@ -8,7 +7,6 @@ async function add(task) {
|
|||||||
const t = { ...task };
|
const t = { ...task };
|
||||||
if (typeof t.executeAfter === 'object') t.executeAfter = t.executeAfter.getTime();
|
if (typeof t.executeAfter === 'object') t.executeAfter = t.executeAfter.getTime();
|
||||||
t.count = t.count || 1;
|
t.count = t.count || 1;
|
||||||
t.wait = t.wait || Object.keys(cluster.workers);
|
|
||||||
t.executeAfter = t.executeAfter || new Date().getTime();
|
t.executeAfter = t.executeAfter || new Date().getTime();
|
||||||
const res = await coll.insertOne(t);
|
const res = await coll.insertOne(t);
|
||||||
return res.insertedId;
|
return res.insertedId;
|
||||||
@@ -29,16 +27,9 @@ function del(_id) {
|
|||||||
async function getFirst(query) {
|
async function getFirst(query) {
|
||||||
const q = { ...query };
|
const q = { ...query };
|
||||||
q.executeAfter = q.executeAfter || { $lt: new Date().getTime() };
|
q.executeAfter = q.executeAfter || { $lt: new Date().getTime() };
|
||||||
q.wait = { $elemMatch: { $eq: cluster.worker.id } };
|
|
||||||
const res = await coll.find(q).sort('_id', 1).limit(1).toArray();
|
const res = await coll.find(q).sort('_id', 1).limit(1).toArray();
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
if (res[0].count === 1) await coll.deleteOne({ _id: res[0]._id });
|
await coll.deleteOne({ _id: res[0]._id });
|
||||||
else {
|
|
||||||
await coll.updateOne(
|
|
||||||
{ _id: res[0]._id },
|
|
||||||
{ $inc: { count: -1 }, $pull: { wait: cluster.worker.id } },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (res[0].interval) {
|
if (res[0].interval) {
|
||||||
await coll.insertOne({
|
await coll.insertOne({
|
||||||
...res[0], executeAfter: moment().add(...res[0].interval).toDate(),
|
...res[0], executeAfter: moment().add(...res[0].interval).toDate(),
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ async function changePassword(uid, currentPassword, newPassword) {
|
|||||||
|
|
||||||
async function inc(_id, field, n = 1) {
|
async function inc(_id, field, n = 1) {
|
||||||
const udoc = await coll.findOne({ _id });
|
const udoc = await coll.findOne({ _id });
|
||||||
|
if (!udoc) throw new UserNotFoundError(_id);
|
||||||
udoc[field] = udoc[field] + n || n;
|
udoc[field] = udoc[field] + n || n;
|
||||||
await coll.updateOne({ _id }, { $set: { [field]: udoc[field] } });
|
await coll.updateOne({ _id }, { $set: { [field]: udoc[field] } });
|
||||||
return udoc;
|
return udoc;
|
||||||
|
|||||||
+9
-19
@@ -1,5 +1,4 @@
|
|||||||
const { EventEmitter } = require('events');
|
const { EventEmitter } = require('events');
|
||||||
const cluster = require('cluster');
|
|
||||||
|
|
||||||
const bus = new EventEmitter();
|
const bus = new EventEmitter();
|
||||||
|
|
||||||
@@ -26,27 +25,18 @@ function unsubscribe(events, handler, funcName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function publish(event, data, isMaster = true) {
|
function publish(event, payload, isMaster = true) {
|
||||||
bus.emit(event, { value: data, event });
|
if (isMaster && process.send) {
|
||||||
if (isMaster && global.Hydro.model.task) {
|
process.send({
|
||||||
global.Hydro.model.task.add({
|
event: 'bus',
|
||||||
type: 'bus',
|
eventName: event,
|
||||||
count: Object.keys(cluster.workers).length,
|
payload,
|
||||||
sender: cluster.worker.id,
|
|
||||||
event,
|
|
||||||
data,
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
bus.emit(event, { value: payload, event });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function postInit() {
|
|
||||||
const { task } = global.Hydro.model;
|
|
||||||
task.consume({ type: 'bus' }, (data) => {
|
|
||||||
if (data.sender === cluster.worker.id) return;
|
|
||||||
publish(data.event, data.value, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
global.Hydro.service.bus = module.exports = {
|
global.Hydro.service.bus = module.exports = {
|
||||||
subscribe, unsubscribe, publish, postInit,
|
subscribe, unsubscribe, publish,
|
||||||
};
|
};
|
||||||
@@ -297,7 +297,7 @@ class Handler {
|
|||||||
this.ctx.response.status = 302;
|
this.ctx.response.status = 302;
|
||||||
this.ctx.redirect(this.response.redirect);
|
this.ctx.redirect(this.response.redirect);
|
||||||
} else {
|
} else {
|
||||||
if (this.response.body.redirect) {
|
if (this.response.redirect) {
|
||||||
this.response.body = this.response.body || {};
|
this.response.body = this.response.body || {};
|
||||||
this.response.body.url = this.response.redirect;
|
this.response.body.url = this.response.redirect;
|
||||||
}
|
}
|
||||||
@@ -438,6 +438,7 @@ class ConnectionHandler {
|
|||||||
if (anchor) return `${res}#${anchor}`;
|
if (anchor) return `${res}#${anchor}`;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message);
|
console.error(e.message);
|
||||||
|
console.error(name, kwargs);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,3 +109,24 @@ function folderSize(folderPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.folderSize = folderSize;
|
exports.folderSize = folderSize;
|
||||||
|
|
||||||
|
const TIME_RE = /^([0-9]+(?:\.[0-9]*)?)([mu]?)s?$/i;
|
||||||
|
const TIME_UNITS = { '': 1000, m: 1, u: 0.001 };
|
||||||
|
const MEMORY_RE = /^([0-9]+(?:\.[0-9]*)?)([kmg])b?$/i;
|
||||||
|
const MEMORY_UNITS = { k: 0.1, m: 1, g: 1024 };
|
||||||
|
|
||||||
|
function parseTimeMS(str) {
|
||||||
|
const match = TIME_RE.exec(str);
|
||||||
|
if (!match) throw new Error(str, 'error parsing time');
|
||||||
|
return parseInt(parseFloat(match[1], 10) * TIME_UNITS[match[2]], 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.parseTimeMS = parseTimeMS;
|
||||||
|
|
||||||
|
function parseMemoryMB(str) {
|
||||||
|
const match = MEMORY_RE.exec(str);
|
||||||
|
if (!match) throw new Error(str, 'error parsing memory');
|
||||||
|
return parseInt(parseFloat(match[1], 10) * MEMORY_UNITS[match[2]], 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.parseMemoryMB = parseMemoryMB;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"id": "migrate-vijos",
|
"id": "migrate-vijos",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "Migrate From Vijos"
|
"description": "Migrate From Vijos"
|
||||||
}
|
}
|
||||||
@@ -188,6 +188,7 @@ const tasks = {
|
|||||||
compilerTexts: doc.compiler_texts,
|
compilerTexts: doc.compiler_texts,
|
||||||
rejudged: doc.rejudged,
|
rejudged: doc.rejudged,
|
||||||
testCases,
|
testCases,
|
||||||
|
hidden: doc.hidden,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
domain: {
|
domain: {
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.4.2",
|
"version": "2.4.3",
|
||||||
"main": "hydro/loader.js",
|
"main": "hydro/loader.js",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
"author": "masnn",
|
"author": "masnn",
|
||||||
@@ -64,4 +64,4 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"snyk": true
|
"snyk": true
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="medium-9 columns">
|
<div class="medium-9 columns">
|
||||||
{% if show_status %}
|
{% if showStatus %}
|
||||||
{% include 'record_detail_status.html' %}
|
{% include 'record_detail_status.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rdoc['code'] %}
|
{% if rdoc['code'] %}
|
||||||
@@ -21,6 +21,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if rdoc['stdout'] or rdoc['stderr'] %}
|
||||||
|
<div class="section">
|
||||||
|
<div class="section__header">
|
||||||
|
<h1 class="section__title">{{ _('Stdout') }}</h1>
|
||||||
|
</div>
|
||||||
|
{% if rdoc['stdout'] %}
|
||||||
|
<div class="section__body" data-syntax-hl-show-line-number>
|
||||||
|
<pre><code>{{ rdoc['stdout']|ansi|safe }}</code></pre>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if rdoc['stderr'] %}
|
||||||
|
<div class="section__body" data-syntax-hl-show-line-number>
|
||||||
|
<pre><code>{{ rdoc['stderr']|ansi|safe }}</code></pre>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="medium-3 columns">
|
<div class="medium-3 columns">
|
||||||
<div class="section side">
|
<div class="section side">
|
||||||
|
|||||||
@@ -7,14 +7,6 @@ import request from 'vj/utils/request';
|
|||||||
const page = new NamedPage('manage_script', () => {
|
const page = new NamedPage('manage_script', () => {
|
||||||
const runScriptDialog = new ActionDialog({
|
const runScriptDialog = new ActionDialog({
|
||||||
$body: $('.dialog__body--run-script > div'),
|
$body: $('.dialog__body--run-script > div'),
|
||||||
onDispatch(action) {
|
|
||||||
const $args = runScriptDialog.$dom.find('[name="args"]');
|
|
||||||
if (action === 'ok' && $args.val() === '') {
|
|
||||||
$args.focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
runScriptDialog.clear = function () {
|
runScriptDialog.clear = function () {
|
||||||
this.$dom.find('[name="args"]').val('');
|
this.$dom.find('[name="args"]').val('');
|
||||||
|
|||||||
Reference in new issue
Block a user