mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 14:06:28 +00:00
fix(frontend): show credential expiry status
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc -b && vite build",
|
"build": "vue-tsc -b && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "node --test --experimental-strip-types src/app/theme.test.ts src/components/templates/template-config.test.ts src/views/dashboard-license.test.ts",
|
"test": "node --test --experimental-strip-types src/app/theme.test.ts src/components/templates/template-config.test.ts src/utils/format.test.ts src/views/dashboard-license.test.ts",
|
||||||
"typecheck": "vue-tsc -b",
|
"typecheck": "vue-tsc -b",
|
||||||
"lint": "eslint . --fix",
|
"lint": "eslint . --fix",
|
||||||
"lint:check": "eslint .",
|
"lint:check": "eslint .",
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import test from 'node:test'
|
||||||
|
import { statusLabel, statusTone } from './format.ts'
|
||||||
|
|
||||||
|
test('formats token_expired status for check-in records', () => {
|
||||||
|
assert.equal(statusLabel('token_expired'), '凭证过期')
|
||||||
|
assert.equal(statusTone('token_expired'), 'danger')
|
||||||
|
assert.equal(statusLabel('token-expired'), 'token-expired')
|
||||||
|
})
|
||||||
@@ -35,6 +35,7 @@ export function statusLabel(status?: string | null) {
|
|||||||
running: '进行中',
|
running: '进行中',
|
||||||
already_submitted: '已提交',
|
already_submitted: '已提交',
|
||||||
out_of_time: '超出时间',
|
out_of_time: '超出时间',
|
||||||
|
token_expired: '凭证过期',
|
||||||
unknown: '未知',
|
unknown: '未知',
|
||||||
manual: '手动',
|
manual: '手动',
|
||||||
scheduler: '定时',
|
scheduler: '定时',
|
||||||
@@ -47,7 +48,14 @@ export function statusLabel(status?: string | null) {
|
|||||||
export function statusTone(status?: string | null) {
|
export function statusTone(status?: string | null) {
|
||||||
if (status === 'success' || status === 'already_submitted') return 'success'
|
if (status === 'success' || status === 'already_submitted') return 'success'
|
||||||
if (status === 'pending' || status === 'running') return 'warning'
|
if (status === 'pending' || status === 'running') return 'warning'
|
||||||
if (status === 'failure' || status === 'failed' || status === 'out_of_time') return 'danger'
|
if (
|
||||||
|
status === 'failure' ||
|
||||||
|
status === 'failed' ||
|
||||||
|
status === 'out_of_time' ||
|
||||||
|
status === 'token_expired'
|
||||||
|
) {
|
||||||
|
return 'danger'
|
||||||
|
}
|
||||||
return 'neutral'
|
return 'neutral'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ onMounted(load)
|
|||||||
<option value="success">成功</option>
|
<option value="success">成功</option>
|
||||||
<option value="failure">失败</option>
|
<option value="failure">失败</option>
|
||||||
<option value="out_of_time">超出时间</option>
|
<option value="out_of_time">超出时间</option>
|
||||||
|
<option value="token_expired">凭证过期</option>
|
||||||
</select>
|
</select>
|
||||||
<select v-model="filters.trigger_type" :class="inputClass">
|
<select v-model="filters.trigger_type" :class="inputClass">
|
||||||
<option value="">全部触发</option>
|
<option value="">全部触发</option>
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ onMounted(load)
|
|||||||
<option value="">全部状态</option>
|
<option value="">全部状态</option>
|
||||||
<option value="success">成功</option>
|
<option value="success">成功</option>
|
||||||
<option value="failure">失败</option>
|
<option value="failure">失败</option>
|
||||||
|
<option value="token_expired">凭证过期</option>
|
||||||
</select>
|
</select>
|
||||||
<select v-model="filters.trigger_type" :class="inputClass">
|
<select v-model="filters.trigger_type" :class="inputClass">
|
||||||
<option value="">全部触发</option>
|
<option value="">全部触发</option>
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ onMounted(load)
|
|||||||
<option value="success">成功</option>
|
<option value="success">成功</option>
|
||||||
<option value="failure">失败</option>
|
<option value="failure">失败</option>
|
||||||
<option value="out_of_time">超出时间</option>
|
<option value="out_of_time">超出时间</option>
|
||||||
|
<option value="token_expired">凭证过期</option>
|
||||||
</select>
|
</select>
|
||||||
<input v-model.number="filters.limit" :class="inputClass" type="number" min="1" max="200" />
|
<input v-model.number="filters.limit" :class="inputClass" type="number" min="1" max="200" />
|
||||||
<Button variant="outline" type="button" @click="load">
|
<Button variant="outline" type="button" @click="load">
|
||||||
|
|||||||
Reference in New Issue
Block a user