forked from xiaohei/taiji-pda-v0
fix: 删除多余的数据库模板选项,将数据存储模板改名为数据库模板
- 删除旧的'数据库模板'选项及其相关代码 - 将'数据存储模板'改名为'数据库模板' - 保留数据库模板(来自API的dataTemplates)、JSON API模板、云存储模板三个选项
This commit is contained in:
@@ -436,8 +436,8 @@ export function ChannelsTab({
|
||||
// 超级管理员删除租户时需要提供 channel_id
|
||||
const result = await TaijiAPIClient.deleteTenant(tenantId, selectedChannel?.id)
|
||||
if (result.success) {
|
||||
setChannelTenants(channelTenants.filter((t) => t.id !== tenantId))
|
||||
console.log("Tenant deleted successfully")
|
||||
setChannelTenants(channelTenants.filter((t) => t.id !== tenantId))
|
||||
console.log("Tenant deleted successfully")
|
||||
} else {
|
||||
console.error("Failed to delete tenant:", result.message || "Unknown error")
|
||||
}
|
||||
|
||||
@@ -1240,8 +1240,8 @@ export default function AdminDashboard() {
|
||||
// 超级管理员删除租户时需要提供 channel_id
|
||||
const result = await TaijiAPIClient.deleteTenant(tenantId, selectedChannel?.id)
|
||||
if (result.success) {
|
||||
setChannelTenants(channelTenants.filter(t => t.id !== tenantId))
|
||||
console.log('Tenant deleted successfully')
|
||||
setChannelTenants(channelTenants.filter(t => t.id !== tenantId))
|
||||
console.log('Tenant deleted successfully')
|
||||
} else {
|
||||
console.error('Failed to delete tenant:', result.message || 'Unknown error')
|
||||
}
|
||||
|
||||
@@ -2361,13 +2361,13 @@ export default function ChannelDashboard() {
|
||||
},
|
||||
}))
|
||||
// 如果选中,初始化分配数量为1;如果取消选中,清除分配数量
|
||||
setTenantAgentAllocations((prev) => ({
|
||||
...prev,
|
||||
[selectedTenantForAgentAllocation?.id]: {
|
||||
...prev[selectedTenantForAgentAllocation?.id],
|
||||
setTenantAgentAllocations((prev) => ({
|
||||
...prev,
|
||||
[selectedTenantForAgentAllocation?.id]: {
|
||||
...prev[selectedTenantForAgentAllocation?.id],
|
||||
[agent.name]: checked ? 1 : 0,
|
||||
},
|
||||
}))
|
||||
},
|
||||
}))
|
||||
}}
|
||||
className="h-5 w-5"
|
||||
/>
|
||||
@@ -2413,13 +2413,13 @@ export default function ChannelDashboard() {
|
||||
const parsedValue = Number.parseInt(inputValue, 10)
|
||||
if (!isNaN(parsedValue)) {
|
||||
const value = Math.min(Math.max(1, parsedValue), maxVal)
|
||||
setTenantAgentAllocations((prev) => ({
|
||||
...prev,
|
||||
[selectedTenantForAgentAllocation?.id]: {
|
||||
...prev[selectedTenantForAgentAllocation?.id],
|
||||
[agent.name]: value,
|
||||
},
|
||||
}))
|
||||
setTenantAgentAllocations((prev) => ({
|
||||
...prev,
|
||||
[selectedTenantForAgentAllocation?.id]: {
|
||||
...prev[selectedTenantForAgentAllocation?.id],
|
||||
[agent.name]: value,
|
||||
},
|
||||
}))
|
||||
}
|
||||
}}
|
||||
onBlur={(e) => {
|
||||
|
||||
+5
-48
@@ -353,18 +353,6 @@ export default function DataToolsPage() {
|
||||
config.endpoint = `storage://${templateConfig.service}`
|
||||
config.method = "GET"
|
||||
description = t("云存储工具", "Cloud Storage Tool")
|
||||
} else if (templateType === "database") {
|
||||
// 数据库模板
|
||||
toolType = "database"
|
||||
if (!templateConfig.dbType || !templateConfig.connectionString) {
|
||||
alert(t("请填写数据库类型和连接字符串", "Please fill in database type and connection string"))
|
||||
return
|
||||
}
|
||||
config.dbType = templateConfig.dbType
|
||||
config.connectionString = templateConfig.connectionString
|
||||
config.endpoint = `database://${templateConfig.dbType}`
|
||||
config.method = "GET"
|
||||
description = t("数据库工具", "Database Tool")
|
||||
}
|
||||
|
||||
// 使用创建工具接口 POST /api/user/tools/create
|
||||
@@ -1203,12 +1191,12 @@ export default function DataToolsPage() {
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{/* 优先显示数据存储模板(来自API) */}
|
||||
{/* 数据库模板(来自API) */}
|
||||
{apiDataTemplates.length > 0 && (
|
||||
<SelectItem value="data_storage">
|
||||
<div className="flex items-center gap-2">
|
||||
<Boxes className="h-4 w-4" />
|
||||
{t("数据存储模板", "Data Storage Template")}
|
||||
{t("数据库模板", "Database Template")}
|
||||
</div>
|
||||
</SelectItem>
|
||||
)}
|
||||
@@ -1224,21 +1212,15 @@ export default function DataToolsPage() {
|
||||
{t("云存储模板", "Cloud Storage Template")}
|
||||
</div>
|
||||
</SelectItem>
|
||||
<SelectItem value="database">
|
||||
<div className="flex items-center gap-2">
|
||||
<Cloud className="h-4 w-4" />
|
||||
{t("数据库模板", "Database Template")}
|
||||
</div>
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* 数据存储模板(来自API的dataTemplates) */}
|
||||
{/* 数据库模板(来自API的dataTemplates) */}
|
||||
{templateType === "data_storage" as any ? (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label>{t("选择数据存储模板", "Select Data Storage Template")} <span className="text-destructive">*</span></Label>
|
||||
<Label>{t("选择数据库模板", "Select Database Template")} <span className="text-destructive">*</span></Label>
|
||||
<Select
|
||||
value={selectedApiDataTemplate}
|
||||
onValueChange={(value) => {
|
||||
@@ -1398,7 +1380,7 @@ export default function DataToolsPage() {
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : templateType === "cloud_storage" ? (
|
||||
) : templateType === "cloud_storage" && (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label>{t("存储服务", "Storage Service")}</Label>
|
||||
@@ -1423,31 +1405,6 @@ export default function DataToolsPage() {
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label>{t("数据库类型", "Database Type")}</Label>
|
||||
<Select value={templateConfig.dbType} onValueChange={(value) => setTemplateConfig({ ...templateConfig, dbType: value })}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder={t("选择数据库类型", "Select database type")} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="postgresql">PostgreSQL</SelectItem>
|
||||
<SelectItem value="mysql">MySQL</SelectItem>
|
||||
<SelectItem value="mongodb">MongoDB</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>{t("连接字符串", "Connection String")}</Label>
|
||||
<Input
|
||||
placeholder={t("输入连接字符串", "Enter connection string")}
|
||||
type="password"
|
||||
value={templateConfig.connectionString}
|
||||
onChange={(e) => setTemplateConfig({ ...templateConfig, connectionString: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user