新增DNS账户管理及归属显示

增加 DNS 账户列表接口、归属用户记录、脱敏账号标识和管理页面导航,补充前端回归覆盖。
This commit is contained in:
xuans committed 2026-09-26 12:29:03 +08:00
1 parent 443df8165e
commit e6c40d85a4
12 files changed
+407 -4

No files matched your search

@@ -10,7 +10,7 @@ import { aliyunProvider, deferred, mountComposable, verifiedResponse } from "../
test("板块导航默认只选中基本信息,超级管理员可切换全部板块", () => {
const navigation = useDashboardNavigation(ref({ role: "super_admin" }));
assert.equal(navigation.activeSection.value, "overview");
assert.equal(navigation.sections.value.length, 6);
assert.equal(navigation.sections.value.length, 7);
for (const section of navigation.sections.value) {
navigation.selectSection(section.id);
assert.equal(navigation.activeSection.value, section.id);
@@ -31,7 +31,7 @@ test("用户管理导航按权限显示,权限变化后回到基本信息", ()
assert.equal(navigation.activeSection.value, "users");
user.value = { role: "admin" };
assert.equal(navigation.activeSection.value, "users");
assert.equal(navigation.sections.value.length, 6);
assert.equal(navigation.sections.value.length, 7);
user.value = null;
assert.equal(navigation.activeSection.value, "overview");
assert.equal(navigation.sections.value.length, 5);
@@ -41,7 +41,7 @@ test("单板块布局使用互斥条件,切换重置滚动且保留弹窗入
const { readFile } = await import("node:fs/promises");
const template = await readFile(new URL("./Dashboard.vue", import.meta.url), "utf8");
const stylesheet = await readFile(new URL("./DashboardLayout.css", import.meta.url), "utf8");
for (const id of ["overview", "activity", "domains", "servers", "keys", "users"]) {
for (const id of ["overview", "activity", "domains", "servers", "keys", "dns-accounts", "users"]) {
assert.ok(template.includes(`v-if="activeSection === '${id}'"`));
}
assert.match(template, /:key="activeSection"/);
@@ -97,6 +97,7 @@ test("完整页面逐个渲染六个板块,每次只有一个内容标题", as
domains: "托管域名",
servers: "部署服务器",
keys: "SSH 私钥",
"dns-accounts": "DNS 账户管理",
users: "用户管理",
};
for (const section of navigation.sections.value) {
@@ -109,6 +110,7 @@ test("完整页面逐个渲染六个板块,每次只有一个内容标题", as
app.component(name, { render: () => null });
}
app.component("UserManagement", { render: () => Vue.h("h2", headings.users) });
app.component("DNSAccounts", { render: () => Vue.h("h2", headings["dns-accounts"]) });
app.component("DeploymentResult", { render: () => null });
const warnings = [];
app.config.warnHandler = (message) => warnings.push(message);
@@ -1,5 +1,6 @@
<script setup>
import UserManagement from "../UserManagement/UserManagement.vue";
import DNSAccounts from "../DNSAccounts/DNSAccounts.vue";
import SettingsModal from "./SettingsModal.vue";
import DomainModal from "./DomainModal.vue";
import ServerModal from "./ServerModal.vue";
@@ -322,6 +323,7 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
</div>
<UserManagement v-if="activeSection === 'users'" />
<DNSAccounts v-if="activeSection === 'dns-accounts'" :refresh-key="settings" />
<section v-if="activeSection === 'activity'" class="panel operations-panel">
<div class="panel-heading">
@@ -6,13 +6,14 @@ export const dashboardSections = [
{ id: "domains", label: "域名配置", group: "证书与部署", hint: "管理域名、申请证书和执行部署" },
{ id: "servers", label: "部署服务器", group: "证书与部署", hint: "配置部署目标及 SSH 认证方式" },
{ id: "keys", label: "SSH 私钥", group: "证书与部署", hint: "管理加密保存的 SSH 私钥" },
{ id: "dns-accounts", label: "DNS 账户管理", group: "证书与部署", hint: "查看已配置的 DNS 账号及归属用户,凭据标识脱敏显示" },
{ id: "users", label: "用户管理", group: "系统管理", hint: "管理登录账号、角色与使用状态" },
];
export function useDashboardNavigation(currentUser) {
const selectedSection = ref("overview");
const sections = computed(() => dashboardSections.filter(
(section) => section.id !== "users" || ["super_admin", "admin"].includes(currentUser.value?.role),
(section) => !["users", "dns-accounts"].includes(section.id) || ["super_admin", "admin"].includes(currentUser.value?.role),
));
const activeSection = computed(() => sections.value.some(
(section) => section.id === selectedSection.value,
@@ -46,6 +46,11 @@ defineEmits(["select", "settings"]);
<circle cx="8" cy="8" r="5" />
<path d="m12 12 9 9m-6-6 3-3m0 6 3-3" />
</g>
<g v-else-if="section.id === 'dns-accounts'">
<rect x="3" y="4" width="18" height="16" rx="3" />
<circle cx="9" cy="10" r="2" />
<path d="M5 17a4 4 0 0 1 8 0m2-8h4m-4 4h4" />
</g>
<g v-else>
<circle cx="12" cy="8" r="4" />
<path d="M4 21v-2a8 8 0 0 1 16 0v2" />