mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
feat: move jobs to action based
Signed-off-by: allanice001 <allanice001@gmail.com>
This commit is contained in:
30
ui/src/api/actions.ts
Normal file
30
ui/src/api/actions.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { withRefresh } from "@/api/with-refresh.ts"
|
||||
import type { DtoCreateActionRequest, DtoUpdateActionRequest } from "@/sdk"
|
||||
import { makeActionsApi } from "@/sdkClient.ts"
|
||||
|
||||
const actions = makeActionsApi()
|
||||
export const actionsApi = {
|
||||
listActions: () =>
|
||||
withRefresh(async () => {
|
||||
return await actions.listActions()
|
||||
}),
|
||||
createAction: (body: DtoCreateActionRequest) =>
|
||||
withRefresh(async () => {
|
||||
return await actions.createAction({
|
||||
dtoCreateActionRequest: body,
|
||||
})
|
||||
}),
|
||||
updateAction: (id: string, body: DtoUpdateActionRequest) =>
|
||||
withRefresh(async () => {
|
||||
return await actions.updateAction({
|
||||
actionID: id,
|
||||
dtoUpdateActionRequest: body,
|
||||
})
|
||||
}),
|
||||
deleteAction: (id: string) =>
|
||||
withRefresh(async () => {
|
||||
await actions.deleteAction({
|
||||
actionID: id,
|
||||
})
|
||||
}),
|
||||
}
|
||||
@@ -8,9 +8,10 @@ import type {
|
||||
DtoSetKubeconfigRequest,
|
||||
DtoUpdateClusterRequest,
|
||||
} from "@/sdk"
|
||||
import { makeClusterApi } from "@/sdkClient"
|
||||
import { makeClusterApi, makeClusterRunsApi } from "@/sdkClient"
|
||||
|
||||
const clusters = makeClusterApi()
|
||||
const clusterRuns = makeClusterRunsApi()
|
||||
|
||||
export const clustersApi = {
|
||||
// --- basic CRUD ---
|
||||
@@ -147,4 +148,20 @@ export const clustersApi = {
|
||||
withRefresh(async () => {
|
||||
return await clusters.detachNodePool({ clusterID, nodePoolID })
|
||||
}),
|
||||
|
||||
// --- cluster runs / actions ---
|
||||
listClusterRuns: (clusterID: string) =>
|
||||
withRefresh(async () => {
|
||||
return await clusterRuns.listClusterRuns({ clusterID })
|
||||
}),
|
||||
|
||||
getClusterRun: (clusterID: string, runID: string) =>
|
||||
withRefresh(async () => {
|
||||
return await clusterRuns.getClusterRun({ clusterID, runID })
|
||||
}),
|
||||
|
||||
runClusterAction: (clusterID: string, actionID: string) =>
|
||||
withRefresh(async () => {
|
||||
return await clusterRuns.runClusterAction({ clusterID, actionID })
|
||||
}),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user