Skip to content

Commit

Permalink
feat: judge queue stats
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamerblue committed Feb 19, 2024
1 parent a0db779 commit 37375db
Show file tree
Hide file tree
Showing 13 changed files with 557 additions and 81 deletions.
2 changes: 1 addition & 1 deletion src/common
11 changes: 6 additions & 5 deletions src/components/ResultBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ class ResultBar extends React.Component<Props, State> {
}
const resultInfo = resultsMap[result] || {};
const isRejected = isRejectedResult(result);
const canShowJudgeDetail = judgeInfo?.detail?.cases?.length > 0;
const title =
isRejected && judgeInfo
isRejected && judgeInfo?.totalCase > 0
? `${resultInfo.fullName} on test ${judgeInfo.lastCase}/${judgeInfo.totalCase}`
: resultInfo.fullName;
return (
Expand All @@ -142,14 +143,14 @@ class ResultBar extends React.Component<Props, State> {
colorSettings === 'colorful' ? resultInfo.colorfulColor : resultInfo.normalColor
}`,
{
'cursor-pointer': judgeInfo,
'cursor-pointer': canShowJudgeDetail,
},
)}
onClick={judgeInfo ? this.handleShowDetailModal : () => {}}
onClick={canShowJudgeDetail ? this.handleShowDetailModal : () => {}}
>
<span>{resultInfo.shortName}</span>
</div>
{judgeInfo ? (
{canShowJudgeDetail ? (
<Modal
title="Judgement Info"
visible={this.state.showDetail}
Expand All @@ -160,7 +161,7 @@ class ResultBar extends React.Component<Props, State> {
>
<div>
<Row gutter={16}>
{judgeInfo.detail?.cases.map((j, index) => {
{judgeInfo.detail.cases.map((j, index) => {
return (
<Col xs={12} md={4} key={index} style={{ padding: '6px' }}>
{j.errMsg || j.outMsg ? (
Expand Down
3 changes: 3 additions & 0 deletions src/configs/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ export default {
fields: '/admin/fields',
fieldSettings: '/admin/fields/:id/settings',
},
stats: {
judge: '/stats/judge',
},
beta: '/beta',
OJBK: '/OJBK',
};
52 changes: 52 additions & 0 deletions src/dark.less
Original file line number Diff line number Diff line change
Expand Up @@ -836,4 +836,56 @@ a {
color: #f6ac06 !important;
}

// stats
.judge-queue-stats-process {
&.ant-progress-status-success .ant-progress-bg {
background-color: @primary-6;
}
}

.judge-queue-stats-board {
.judge-queue-stats-board-row {
.judge-queue-stats-board-item-judging {
border-color: #ffc107;
background: darken(#ffc107, 45%);
}

.judge-queue-stats-board-item-in-queue {
color: @primary-6;
}
}
}

.judge-queue-stats-node-graph {
.judge-queue-stats-node-graph-header {
border-right: 4px solid @border-color-split;
}

.judge-queue-stats-node-graph-item {
border: @border-width-base @border-style-base @input-border-color;
background-color: @component-background;

&.type-judging {
background-color: darken(#ffc107, 23%);
border-color: #ffc107;
}
}
}

.judge-queue-stats-bg-success {
background-color: @color-green;
}

.judge-queue-stats-bg-warn {
background-color: @color-yellow;
}

.judge-queue-stats-bg-danger {
background-color: @color-red;
}

.judge-queue-stats-bg-super-danger {
background-color: @color-purple;
}

// }
52 changes: 52 additions & 0 deletions src/dark_duplicated4auto.less
Original file line number Diff line number Diff line change
Expand Up @@ -836,4 +836,56 @@ a {
color: #f6ac06 !important;
}

// stats
.judge-queue-stats-process {
&.ant-progress-status-success .ant-progress-bg {
background-color: @primary-6;
}
}

.judge-queue-stats-board {
.judge-queue-stats-board-row {
.judge-queue-stats-board-item-judging {
border-color: #ffc107;
background: darken(#ffc107, 45%);
}

.judge-queue-stats-board-item-in-queue {
color: @primary-6;
}
}
}

.judge-queue-stats-node-graph {
.judge-queue-stats-node-graph-header {
border-right: 4px solid @border-color-split;
}

.judge-queue-stats-node-graph-item {
border: @border-width-base @border-style-base @input-border-color;
background-color: @component-background;

&.type-judging {
background-color: darken(#ffc107, 23%);
border-color: #ffc107;
}
}
}

.judge-queue-stats-bg-success {
background-color: @color-green;
}

.judge-queue-stats-bg-warn {
background-color: @color-yellow;
}

.judge-queue-stats-bg-danger {
background-color: @color-red;
}

.judge-queue-stats-bg-super-danger {
background-color: @color-purple;
}

// }
Loading

0 comments on commit 37375db

Please sign in to comment.