-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: jingyang <3161362058@qq.com>
- Loading branch information
Showing
15 changed files
with
120 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { EnvResponse } from '@/pages/api/platform/getEnv'; | ||
import { GET } from '@/services/request'; | ||
|
||
export const updateRepo = () => GET('/api/updateRepo'); | ||
|
||
export const getPlatformEnv = () => GET<EnvResponse>('/api/platform/getEnv'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
frontend/providers/template/src/pages/api/resource/delJob.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { NextApiRequest, NextApiResponse } from 'next'; | ||
import { ApiResp } from '@/services/kubernet'; | ||
import { authSession } from '@/services/backend/auth'; | ||
import { getK8s } from '@/services/backend/kubernetes'; | ||
import { jsonRes } from '@/services/backend/response'; | ||
|
||
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) { | ||
try { | ||
const { instanceName } = req.query as { instanceName: string }; | ||
if (!instanceName) { | ||
throw new Error('Job name is empty'); | ||
} | ||
|
||
const { namespace, k8sBatch } = await getK8s({ | ||
kubeconfig: await authSession(req.headers) | ||
}); | ||
|
||
// 删除 Job | ||
const result = await k8sBatch.deleteNamespacedJob(instanceName, namespace); | ||
|
||
jsonRes(res, { data: result }); | ||
} catch (err: any) { | ||
jsonRes(res, { | ||
code: 500, | ||
error: err | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.