diff --git a/.yarn/versions/61c36991.yml b/.yarn/versions/61c36991.yml
new file mode 100644
index 00000000..294016bd
--- /dev/null
+++ b/.yarn/versions/61c36991.yml
@@ -0,0 +1,4 @@
+releases:
+ "@aoi-js/common": minor
+ "@aoi-js/frontend": patch
+ "@aoi-js/server": patch
diff --git a/apps/frontend/src/components/solution/SolutionDetailsRenderer.vue b/apps/frontend/src/components/solution/SolutionDetailsRenderer.vue
index a3c834b3..684480d8 100644
--- a/apps/frontend/src/components/solution/SolutionDetailsRenderer.vue
+++ b/apps/frontend/src/components/solution/SolutionDetailsRenderer.vue
@@ -2,7 +2,7 @@
{{ t('term.jobs') }}
-
+
@@ -21,7 +21,7 @@
{{ t('term.tests') }}
-
+
@@ -40,20 +40,24 @@
-
+
-
- {{ t('term.summary') }}
-
+
+
+ {{ t('term.summary') }}
+
+
- {{ t('term.summary') }}
-
+
+ {{ t('term.summary') }}
+
+
diff --git a/apps/frontend/src/locales/en.yaml b/apps/frontend/src/locales/en.yaml
index e76bf3d8..f1f526c9 100644
--- a/apps/frontend/src/locales/en.yaml
+++ b/apps/frontend/src/locales/en.yaml
@@ -125,6 +125,7 @@ term:
filter: Filter
access-level: Access Level
rules: Rules
+ ip: IP
common:
created-at: Created at
diff --git a/apps/frontend/src/locales/zh-Hans.yml b/apps/frontend/src/locales/zh-Hans.yml
index 7a1a99cd..8efb4864 100644
--- a/apps/frontend/src/locales/zh-Hans.yml
+++ b/apps/frontend/src/locales/zh-Hans.yml
@@ -125,6 +125,7 @@ term:
filter: 过滤
access-level: 访问等级
rules: 规则
+ ip: IP 地址
common:
created-at: 创建于
diff --git a/apps/frontend/src/pages/org/[orgId]/admin/runner.vue b/apps/frontend/src/pages/org/[orgId]/admin/runner.vue
index f71f5459..af1224fe 100644
--- a/apps/frontend/src/pages/org/[orgId]/admin/runner.vue
+++ b/apps/frontend/src/pages/org/[orgId]/admin/runner.vue
@@ -38,7 +38,7 @@
{{ item._id }}
-
+
@@ -67,6 +67,7 @@
@@ -90,6 +91,7 @@ import type { IRunner } from '@/types'
import { useAsyncTask } from '@/utils/async'
import { http } from '@/utils/http'
import { runnerLastAccessAttrs } from '@/utils/org/runner'
+import { denseDateString } from '@/utils/time'
const props = defineProps<{
orgId: string
@@ -116,6 +118,7 @@ const headers = [
{ title: t('term.name'), key: 'name' },
{ title: t('term.version'), key: 'version' },
{ title: t('term.message'), key: 'message' },
+ { title: t('term.ip'), key: 'ip' },
{ title: t('common.created-at'), key: 'createdAt' },
{ title: t('common.accessed-at'), key: 'accessedAt' },
{ title: t('term.labels'), key: '_labels' },
diff --git a/apps/frontend/src/utils/org/runner.ts b/apps/frontend/src/utils/org/runner.ts
index 3ca5c7a0..08f3cb28 100644
--- a/apps/frontend/src/utils/org/runner.ts
+++ b/apps/frontend/src/utils/org/runner.ts
@@ -1,9 +1,9 @@
-import { prettyMs } from '../time'
+import { denseDateString, prettyMs } from '../time'
export function runnerLastAccessAttrs(accessedAt: number) {
const now = Date.now()
const offline = now - accessedAt > 1000 * 60 * 5
const color = offline ? 'red' : 'green'
- const text = offline ? new Date(accessedAt).toLocaleString() : prettyMs(now - accessedAt)
+ const text = offline ? denseDateString(accessedAt) : prettyMs(now - accessedAt)
return { text, color }
}
diff --git a/apps/server/src/db/runner.ts b/apps/server/src/db/runner.ts
index 5b699d6f..67165713 100644
--- a/apps/server/src/db/runner.ts
+++ b/apps/server/src/db/runner.ts
@@ -9,6 +9,7 @@ export interface IRunner {
key: string
version: string
message: string
+ ip: string
createdAt: number
accessedAt: number
diff --git a/apps/server/src/routes/org/admin/runner.ts b/apps/server/src/routes/org/admin/runner.ts
index 199a11cb..a430b949 100644
--- a/apps/server/src/routes/org/admin/runner.ts
+++ b/apps/server/src/routes/org/admin/runner.ts
@@ -41,6 +41,7 @@ export const orgAdminRunnerRoutes = defineRoutes(async (s) => {
name: T.String(),
version: T.String(),
message: T.String(),
+ ip: T.String(),
createdAt: T.Number(),
accessedAt: T.Number()
})
@@ -68,6 +69,7 @@ export const orgAdminRunnerRoutes = defineRoutes(async (s) => {
name: T.String(),
version: T.String(),
message: T.String(),
+ ip: T.String(),
createdAt: T.Number(),
accessedAt: T.Number()
})
diff --git a/apps/server/src/routes/runner/index.ts b/apps/server/src/routes/runner/index.ts
index f2c534a6..e45783c9 100644
--- a/apps/server/src/routes/runner/index.ts
+++ b/apps/server/src/routes/runner/index.ts
@@ -31,7 +31,8 @@ function updateAccessedAt(req: FastifyRequest, runner: IRunner) {
{
$set: {
accessedAt: now,
- version: req.headers['user-agent']
+ version: req.headers['user-agent'],
+ ip: req.ip
}
},
{ ignoreUndefined: true }
@@ -98,6 +99,7 @@ export const runnerRoutes = defineRoutes(async (s) => {
labels: req.body.labels,
version: req.body.version,
message: '',
+ ip: req.ip,
key: runnerKey,
createdAt: Date.now(),
accessedAt: Date.now()
@@ -112,14 +114,22 @@ export const runnerRoutes = defineRoutes(async (s) => {
schema: {
body: T.Partial(
T.StrictObject({
- version: T.String(),
message: T.String()
})
)
}
},
async (req) => {
- await runners.updateOne({ _id: req.inject(kRunnerContext)._runner._id }, { $set: req.body })
+ await runners.updateOne(
+ { _id: req.inject(kRunnerContext)._runner._id },
+ {
+ $set: {
+ version: req.headers['user-agent'],
+ message: req.body.message,
+ ip: req.ip
+ }
+ }
+ )
return {}
}
)
diff --git a/libs/common/src/schemas/solution.ts b/libs/common/src/schemas/solution.ts
index 06669cef..2fc6b069 100644
--- a/libs/common/src/schemas/solution.ts
+++ b/libs/common/src/schemas/solution.ts
@@ -5,7 +5,7 @@ export const SSolutionDetailsTestSchema = Type.Object({
score: Type.Number(),
scoreScale: Type.Optional(Type.Number()),
status: Type.String(),
- summary: Type.String()
+ summary: Type.Optional(Type.String())
})
export type SolutionDetailsTest = Static
@@ -15,16 +15,16 @@ export const SSolutionDetailsJobSchema = Type.Object({
score: Type.Number(),
scoreScale: Type.Optional(Type.Number()),
status: Type.String(),
- tests: Type.Array(SSolutionDetailsTestSchema),
- summary: Type.String()
+ tests: Type.Optional(Type.Array(SSolutionDetailsTestSchema)),
+ summary: Type.Optional(Type.String())
})
export type SolutionDetailsJob = Static
export const SSolutionDetailsSchema = Type.Object({
version: Type.Integer({ minimum: 1 }),
- jobs: Type.Array(SSolutionDetailsJobSchema),
- summary: Type.String()
+ jobs: Type.Optional(Type.Array(SSolutionDetailsJobSchema)),
+ summary: Type.Optional(Type.String())
})
export type SolutionDetails = Static