Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:db delete some databases #4379

Merged
merged 3 commits into from Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/providers/dbprovider/src/constants/db.ts
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
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
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
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
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