feat: add shared PostgreSQL client deletion
This commit is contained in:
@@ -161,6 +161,21 @@ async function revokeClient(client: Client) {
|
||||
await loadAll();
|
||||
}
|
||||
|
||||
async function deleteClient(client: Client) {
|
||||
await ElMessageBox.confirm(
|
||||
`删除后 ${client.displayName} 的数据库 ${client.databaseName} 和角色 ${client.roleName} 将被彻底销毁,不可恢复。`,
|
||||
"删除接入应用",
|
||||
{ type: "warning", confirmButtonText: "确认删除", confirmButtonClass: "el-button--danger" }
|
||||
);
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
`请输入 ${client.appId} 确认删除。`,
|
||||
"二次确认",
|
||||
{ type: "warning" }
|
||||
);
|
||||
await api(`/api/v1/clients/${encodeURIComponent(client.appId)}?confirmation=${encodeURIComponent(value)}`, { method: "DELETE" });
|
||||
await loadAll();
|
||||
}
|
||||
|
||||
async function createDatabase() {
|
||||
const { value: name } = await ElMessageBox.prompt("仅允许小写字母、数字和下划线。", "新建数据库", { inputPattern: /^[a-z][a-z0-9_]{2,62}$/, inputErrorMessage: "数据库名称格式无效" });
|
||||
await api("/api/v1/databases", { method: "POST", body: JSON.stringify({ name }) });
|
||||
@@ -285,7 +300,7 @@ onMounted(async () => {
|
||||
<el-table-column prop="roleName" label="角色" min-width="190" />
|
||||
<el-table-column label="扩展"><template #default="{ row }">{{ row.extensions.join(", ") || "-" }}</template></el-table-column>
|
||||
<el-table-column label="状态"><template #default="{ row }"><el-tag :type="row.status === 'active' ? 'success' : 'danger'">{{ row.status === "active" ? "正常" : "已吊销" }}</el-tag></template></el-table-column>
|
||||
<el-table-column label="操作" width="190" fixed="right"><template #default="{ row }"><el-button size="small" @click="rotateClient(row)">轮换密码</el-button><el-button size="small" type="danger" plain @click="revokeClient(row)">吊销</el-button></template></el-table-column>
|
||||
<el-table-column label="操作" width="190" fixed="right"><template #default="{ row }"><el-button size="small" @click="rotateClient(row)">轮换密码</el-button><el-button size="small" type="danger" plain @click="revokeClient(row)">吊销</el-button><el-button size="small" type="danger" @click="deleteClient(row)">删除</el-button></template></el-table-column>
|
||||
</el-table>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user