Skip to content

Commit

Permalink
feat:db delete some databases (#4379)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
zjy365 authored Dec 5, 2023
1 parent d518f58 commit b6654c4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
8 changes: 4 additions & 4 deletions frontend/providers/dbprovider/src/constants/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
15 changes: 9 additions & 6 deletions frontend/providers/dbprovider/src/pages/api/delDBByName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { DeleteJobByName, GetJobByName } from './migrate/delJobByName';
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
try {
const { name } = req.query as { name: string };

if (!name) {
throw new Error('deploy name is empty');
}
Expand All @@ -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 });
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/dbprovider/src/services/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function DELETE<T = any>(
data?: { [key: string]: any },
config?: AxiosRequestConfig
): Promise<T> {
return request.get(url, {
return request.delete(url, {
params: data,
...config
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} ` : '',
Expand Down
4 changes: 2 additions & 2 deletions service/license/src/pages/cluster/components/Tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default function Tutorial({
部署集群
</Text>
<CommandForm
basePath={`tar xzvf ${fileNameParams} && cd sealos-cloud && bash install.sh `}
basePath={`tar xzvf ${fileNameParams} && cd sealos-cloud && bash scripts/load-images.sh && bash install.sh `}
cloudVersion={ossVersion}
enterprise={true}
/>
Expand All @@ -170,7 +170,7 @@ export default function Tutorial({
</AccordionButton>
<AccordionPanel py="20px" pl="40px" gap={'12px'}>
<CommandForm
basePath={`curl -sfL https://mirror.ghproxy.com/https://raw.githubusercontent.com/labring/sealos/main/scripts/cloud/install.sh -o /tmp/install.sh && bash scripts/load-images.sh && bash /tmp/install.sh --zh `}
basePath={`curl -sfL https://mirror.ghproxy.com/https://raw.githubusercontent.com/labring/sealos/main/scripts/cloud/install.sh -o /tmp/install.sh && bash /tmp/install.sh --zh `}
cloudVersion={ossVersion}
/>
<Center
Expand Down

0 comments on commit b6654c4

Please sign in to comment.