fix: 脱敏处理 — 移除公司域名和内部实例名
- placeholder: pro-cex-rds → prod-mysql, pro-rds-ro.51aipay.com → mysql.example.com - test fixtures 同步替换 - 修复 PageHeader 权限检查: 同时检查 routePermissionMap 和 actionPermissionMap - 前端构建零错误, 后端202测试通过
This commit is contained in:
1 parent
dfdac3ad37
commit
87d2af5e48
3 files changed
+9
-7
No files matched your search
@@ -7,9 +7,9 @@ from tests.conftest import auth_header
|
|||||||
async def test_create_instance_with_full_fields(client, admin_token):
|
async def test_create_instance_with_full_fields(client, admin_token):
|
||||||
"""创建数据源:完整字段"""
|
"""创建数据源:完整字段"""
|
||||||
res = await client.post("/api/v1/instances", json={
|
res = await client.post("/api/v1/instances", json={
|
||||||
"name": "pro-cex-rds-只读库",
|
"name": "prod-mysql-只读库",
|
||||||
"db_type": "mysql",
|
"db_type": "mysql",
|
||||||
"host": "pro-rds-ro.51aipay.com",
|
"host": "mysql.example.com",
|
||||||
"port": 3306,
|
"port": 3306,
|
||||||
"username": "admin",
|
"username": "admin",
|
||||||
"password": "secret123",
|
"password": "secret123",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAuth } from '@/hooks/useAuth';
|
import { useAuth, actionPermissionMap } from '@/hooks/useAuth';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
interface ActionConfig {
|
interface ActionConfig {
|
||||||
@@ -17,9 +17,11 @@ interface PageHeaderProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function PageHeader({ title, description, action, secondaryAction, children }: PageHeaderProps) {
|
export default function PageHeader({ title, description, action, secondaryAction, children }: PageHeaderProps) {
|
||||||
const { hasPermission } = useAuth();
|
const { user, hasPermission } = useAuth();
|
||||||
|
|
||||||
const canShowAction = !action?.permission || hasPermission(action.permission);
|
const canShowAction = !action?.permission
|
||||||
|
|| hasPermission(action.permission)
|
||||||
|
|| (actionPermissionMap[action.permission] || []).includes(user.role);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
|
|||||||
@@ -408,13 +408,13 @@ function CreateInstanceForm({ defaultType, onCancel, onCreated }: { defaultType:
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className={labelCls}>名称 <span className="text-red-400">*</span></label>
|
<label className={labelCls}>名称 <span className="text-red-400">*</span></label>
|
||||||
<input value={name} onChange={e => setName(e.target.value)} className={inputCls} placeholder="pro-cex-rds-只读库" />
|
<input value={name} onChange={e => setName(e.target.value)} className={inputCls} placeholder="例如:prod-mysql-只读库" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-3 gap-4">
|
<div className="grid grid-cols-3 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label className={labelCls}>地址 <span className="text-red-400">*</span></label>
|
<label className={labelCls}>地址 <span className="text-red-400">*</span></label>
|
||||||
<input value={host} onChange={e => setHost(e.target.value)} className={inputCls} placeholder="pro-rds-ro.51aipay.com" />
|
<input value={host} onChange={e => setHost(e.target.value)} className={inputCls} placeholder="例如:mysql.example.com" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className={labelCls}>端口 <span className="text-red-400">*</span></label>
|
<label className={labelCls}>端口 <span className="text-red-400">*</span></label>
|
||||||
|
|||||||
Reference in new issue
Block a user