File tree Expand file tree Collapse file tree 5 files changed +21
-15
lines changed
ui/packages/platform/src/api/clones Expand file tree Collapse file tree 5 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,13 @@ type Req = {
1212}
1313
1414export const createClone = async ( req : Req ) => {
15- const response = await request ( '/rpc/dblab_clone_create ' , {
15+ const response = await request ( '/rpc/dblab_api_call ' , {
1616 method : 'POST' ,
1717 body : JSON . stringify ( {
1818 instance_id : req . instanceId ,
19- clone_data : {
19+ action : '/clone' ,
20+ method : 'post' ,
21+ data : {
2022 id : req . cloneId ,
2123 snapshot : {
2224 id : req . snapshotId ,
@@ -27,7 +29,7 @@ export const createClone = async (req: Req) => {
2729 } ,
2830 protected : req . isProtected ,
2931 } ,
30- } ) ,
32+ } )
3133 } )
3234
3335 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
1010import { request } from 'helpers/request'
1111
1212export const destroyClone : DestroyClone = async ( req ) => {
13- const response = await request ( '/rpc/dblab_clone_destroy ' , {
13+ const response = await request ( '/rpc/dblab_api_call ' , {
1414 method : 'POST' ,
1515 body : JSON . stringify ( {
16+ action : '/clone/' + encodeURIComponent ( req . cloneId ) ,
1617 instance_id : req . instanceId ,
17- clone_id : req . cloneId ,
18+ method : 'delete'
1819 } ) ,
1920 } )
2021
Original file line number Diff line number Diff line change @@ -11,17 +11,18 @@ type Request = {
1111}
1212
1313export const getClone = async ( req : Request ) => {
14- const response = ( await request ( '/rpc/dblab_clone_status ' , {
14+ const response = ( await request ( '/rpc/dblab_api_call ' , {
1515 method : 'POST' ,
1616 body : JSON . stringify ( {
17+ action : '/clone/' + encodeURIComponent ( req . cloneId ) ,
1718 instance_id : req . instanceId ,
18- clone_id : req . cloneId ,
19- } ) ,
19+ method : 'get'
20+ } )
2021 } ) )
2122
2223 return {
2324 response : response . ok
24- ? formatCloneDto ( ( await response . json ( ) ) as CloneDto )
25+ ? formatCloneDto ( await response . json ( ) as CloneDto )
2526 : null ,
2627 error : response . ok ? null : response ,
2728 }
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ import { ResetClone } from '@postgres.ai/shared/types/api/endpoints/resetClone'
1010import { request } from 'helpers/request'
1111
1212export const resetClone : ResetClone = async ( req ) => {
13- const response = await request ( '/rpc/dblab_clone_reset ' , {
13+ const response = await request ( '/rpc/dblab_api_call ' , {
1414 method : 'post' ,
1515 body : JSON . stringify ( {
16+ action : '/clone/' + encodeURIComponent ( req . cloneId ) + '/reset' ,
1617 instance_id : req . instanceId ,
17- clone_id : req . cloneId ,
18- reset_options : {
18+ method : 'post' ,
19+ data : {
1920 snapshotID : req . snapshotId ,
2021 latest : false ,
2122 } ,
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ import { UpdateClone } from '@postgres.ai/shared/types/api/endpoints/updateClone
33import { request } from 'helpers/request'
44
55export const updateClone : UpdateClone = async ( req ) => {
6- const response = await request ( '/rpc/dblab_clone_update ' , {
6+ const response = await request ( '/rpc/dblab_api_call ' , {
77 method : 'POST' ,
88 body : JSON . stringify ( {
9+ action : '/clone/' + encodeURIComponent ( req . cloneId ) ,
910 instance_id : req . instanceId ,
10- clone_id : req . cloneId ,
11- clone : {
11+ method : 'patch' ,
12+ data : {
1213 protected : req . clone . isProtected ,
1314 } ,
1415 } ) ,
You can’t perform that action at this time.
0 commit comments