File tree 5 files changed +21
-15
lines changed
ui/packages/platform/src/api/clones
5 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,13 @@ type Req = {
12
12
}
13
13
14
14
export const createClone = async ( req : Req ) => {
15
- const response = await request ( '/rpc/dblab_clone_create ' , {
15
+ const response = await request ( '/rpc/dblab_api_call ' , {
16
16
method : 'POST' ,
17
17
body : JSON . stringify ( {
18
18
instance_id : req . instanceId ,
19
- clone_data : {
19
+ action : '/clone' ,
20
+ method : 'post' ,
21
+ data : {
20
22
id : req . cloneId ,
21
23
snapshot : {
22
24
id : req . snapshotId ,
@@ -27,7 +29,7 @@ export const createClone = async (req: Req) => {
27
29
} ,
28
30
protected : req . isProtected ,
29
31
} ,
30
- } ) ,
32
+ } )
31
33
} )
32
34
33
35
return {
Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ import { DestroyClone } from '@postgres.ai/shared/types/api/endpoints/destroyClo
10
10
import { request } from 'helpers/request'
11
11
12
12
export const destroyClone : DestroyClone = async ( req ) => {
13
- const response = await request ( '/rpc/dblab_clone_destroy ' , {
13
+ const response = await request ( '/rpc/dblab_api_call ' , {
14
14
method : 'POST' ,
15
15
body : JSON . stringify ( {
16
+ action : '/clone/' + encodeURIComponent ( req . cloneId ) ,
16
17
instance_id : req . instanceId ,
17
- clone_id : req . cloneId ,
18
+ method : 'delete'
18
19
} ) ,
19
20
} )
20
21
Original file line number Diff line number Diff line change @@ -11,17 +11,18 @@ type Request = {
11
11
}
12
12
13
13
export const getClone = async ( req : Request ) => {
14
- const response = ( await request ( '/rpc/dblab_clone_status ' , {
14
+ const response = ( await request ( '/rpc/dblab_api_call ' , {
15
15
method : 'POST' ,
16
16
body : JSON . stringify ( {
17
+ action : '/clone/' + encodeURIComponent ( req . cloneId ) ,
17
18
instance_id : req . instanceId ,
18
- clone_id : req . cloneId ,
19
- } ) ,
19
+ method : 'get'
20
+ } )
20
21
} ) )
21
22
22
23
return {
23
24
response : response . ok
24
- ? formatCloneDto ( ( await response . json ( ) ) as CloneDto )
25
+ ? formatCloneDto ( await response . json ( ) as CloneDto )
25
26
: null ,
26
27
error : response . ok ? null : response ,
27
28
}
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ import { ResetClone } from '@postgres.ai/shared/types/api/endpoints/resetClone'
10
10
import { request } from 'helpers/request'
11
11
12
12
export const resetClone : ResetClone = async ( req ) => {
13
- const response = await request ( '/rpc/dblab_clone_reset ' , {
13
+ const response = await request ( '/rpc/dblab_api_call ' , {
14
14
method : 'post' ,
15
15
body : JSON . stringify ( {
16
+ action : '/clone/' + encodeURIComponent ( req . cloneId ) + '/reset' ,
16
17
instance_id : req . instanceId ,
17
- clone_id : req . cloneId ,
18
- reset_options : {
18
+ method : 'post' ,
19
+ data : {
19
20
snapshotID : req . snapshotId ,
20
21
latest : false ,
21
22
} ,
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ import { UpdateClone } from '@postgres.ai/shared/types/api/endpoints/updateClone
3
3
import { request } from 'helpers/request'
4
4
5
5
export const updateClone : UpdateClone = async ( req ) => {
6
- const response = await request ( '/rpc/dblab_clone_update ' , {
6
+ const response = await request ( '/rpc/dblab_api_call ' , {
7
7
method : 'POST' ,
8
8
body : JSON . stringify ( {
9
+ action : '/clone/' + encodeURIComponent ( req . cloneId ) ,
9
10
instance_id : req . instanceId ,
10
- clone_id : req . cloneId ,
11
- clone : {
11
+ method : 'patch' ,
12
+ data : {
12
13
protected : req . clone . isProtected ,
13
14
} ,
14
15
} ) ,
You can’t perform that action at this time.
0 commit comments