fix(admin): 生产环境隐藏并禁用自动化测试
侧栏与路由按服务端 NODE_ENV 控制;可通过 ALLOW_SMOKE_TESTS=true 临时开启。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { useAdminLocale } from '../composables/useAdminLocale';
|
||||
import { useSmokeTestsAllowed } from '../composables/useSmokeTestsAllowed';
|
||||
import api from '../api';
|
||||
import AdminTableEmpty from '../components/AdminTableEmpty.vue';
|
||||
|
||||
const { t, locale, localeTag } = useAdminLocale();
|
||||
const router = useRouter();
|
||||
const { allowed: smokeTestsAllowed, ensureLoaded: ensureSmokeTestsAllowed } = useSmokeTestsAllowed();
|
||||
|
||||
type SuiteInfo = { id: string; name: string; description: string; caseCount: number };
|
||||
type CaseMeta = { id: string; suite: string; name: string; uatRef?: string };
|
||||
@@ -153,7 +157,14 @@ function statusTagType(status: string) {
|
||||
return 'info';
|
||||
}
|
||||
|
||||
onMounted(loadMeta);
|
||||
onMounted(async () => {
|
||||
await ensureSmokeTestsAllowed();
|
||||
if (!smokeTestsAllowed.value) {
|
||||
router.replace('/');
|
||||
return;
|
||||
}
|
||||
await loadMeta();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user