From b6654c4010a00ddff88a8ed5f8061ecb6405ea56 Mon Sep 17 00:00:00 2001 From: zhujingyang <72259332+zjy365@users.noreply.github.com> Date: Tue, 5 Dec 2023 20:18:21 +0800 Subject: [PATCH] feat:db delete some databases (#4379) * feat:db delete some databases Signed-off-by: jingyang <3161362058@qq.com> * license command Signed-off-by: jingyang <3161362058@qq.com> * fix --------- Signed-off-by: jingyang <3161362058@qq.com> --- frontend/providers/dbprovider/src/constants/db.ts | 8 ++++---- .../dbprovider/src/pages/api/delDBByName.ts | 15 +++++++++------ .../providers/dbprovider/src/services/request.ts | 2 +- .../src/pages/cluster/components/CommandForm.tsx | 2 +- .../src/pages/cluster/components/Tutorial.tsx | 4 ++-- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/frontend/providers/dbprovider/src/constants/db.ts b/frontend/providers/dbprovider/src/constants/db.ts index 9a42ebfee51..c342112ddde 100644 --- a/frontend/providers/dbprovider/src/constants/db.ts +++ b/frontend/providers/dbprovider/src/constants/db.ts @@ -160,10 +160,10 @@ export const DBTypeList = [ { id: DBTypeEnum.mongodb, label: 'mongo' }, { id: DBTypeEnum.mysql, label: 'mysql' }, { id: DBTypeEnum.redis, label: 'redis' }, - { id: DBTypeEnum.kafka, label: 'kafka' }, - { id: DBTypeEnum.qdrant, label: 'qdrant' }, - { id: DBTypeEnum.nebula, label: 'nebula' }, - { id: DBTypeEnum.weaviate, label: 'weaviate' } + { id: DBTypeEnum.kafka, label: 'kafka' } + // { id: DBTypeEnum.qdrant, label: 'qdrant' }, + // { id: DBTypeEnum.nebula, label: 'nebula' }, + // { id: DBTypeEnum.weaviate, label: 'weaviate' } ]; export const DBComponentNameMap = { diff --git a/frontend/providers/dbprovider/src/pages/api/delDBByName.ts b/frontend/providers/dbprovider/src/pages/api/delDBByName.ts index 0322cea9e9a..cfe12dd74dc 100644 --- a/frontend/providers/dbprovider/src/pages/api/delDBByName.ts +++ b/frontend/providers/dbprovider/src/pages/api/delDBByName.ts @@ -12,6 +12,7 @@ import { DeleteJobByName, GetJobByName } from './migrate/delJobByName'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { try { const { name } = req.query as { name: string }; + if (!name) { throw new Error('deploy name is empty'); } @@ -29,13 +30,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse< }); // get migrates and delete - const migrates = await getMigrateList({ migrateName: name, req }); - console.log(migrates, 'migrates'); - await Promise.all( - migrates.map((item) => delMigrateByName({ migrateName: item.metadata.name, req })) - ).catch((error) => { + try { + const migrates = await getMigrateList({ migrateName: name, req }); + await Promise.all( + migrates.map((item) => delMigrateByName({ migrateName: item.metadata.name, req })) + ); + } catch (error) { console.log(error); - }); + } // get backup and delete const backups = await getBackups({ dbName: name, req }); @@ -68,6 +70,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse< jsonRes(res, { data: result?.body }); } catch (err: any) { + console.log(err, 'delete db by name err'); jsonRes(res, { code: 500, error: err diff --git a/frontend/providers/dbprovider/src/services/request.ts b/frontend/providers/dbprovider/src/services/request.ts index 6ec77e10fde..553be1c7438 100644 --- a/frontend/providers/dbprovider/src/services/request.ts +++ b/frontend/providers/dbprovider/src/services/request.ts @@ -133,7 +133,7 @@ export function DELETE( data?: { [key: string]: any }, config?: AxiosRequestConfig ): Promise { - return request.get(url, { + return request.delete(url, { params: data, ...config }); diff --git a/service/license/src/pages/cluster/components/CommandForm.tsx b/service/license/src/pages/cluster/components/CommandForm.tsx index b394edd9429..7f2a6760570 100644 --- a/service/license/src/pages/cluster/components/CommandForm.tsx +++ b/service/license/src/pages/cluster/components/CommandForm.tsx @@ -46,7 +46,7 @@ export default function CommandForm({ const commandParts = [ basePath, cloudVersion ? ` --cloud-version=${cloudVersion} ` : '', - ' --image-registry=registry.cn-shanghai.aliyuncs.com ', + enterprise ? '' : ' --image-registry=registry.cn-shanghai.aliyuncs.com ', enterprise ? '' : ' --proxy-prefix=https://mirror.ghproxy.com ', masterIps ? ` --master-ips=${masterIps} ` : '', nodeIps ? ` --node-ips=${nodeIps} ` : '', diff --git a/service/license/src/pages/cluster/components/Tutorial.tsx b/service/license/src/pages/cluster/components/Tutorial.tsx index 255ca7018ec..1e786c3f778 100644 --- a/service/license/src/pages/cluster/components/Tutorial.tsx +++ b/service/license/src/pages/cluster/components/Tutorial.tsx @@ -152,7 +152,7 @@ export default function Tutorial({ 部署集群 @@ -170,7 +170,7 @@ export default function Tutorial({