Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b42bd7c

Browse filesBrowse files
author
Bogdan Tsechoev
committed
feat(ui): Using unified dblab_clone API endpoint
1 parent 28ce76b commit b42bd7c
Copy full SHA for b42bd7c

File tree

5 files changed

+21
-15
lines changed
Filter options

5 files changed

+21
-15
lines changed

‎ui/packages/platform/src/api/clones/createClone.ts

Copy file name to clipboardExpand all lines: ui/packages/platform/src/api/clones/createClone.ts
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ type Req = {
1212
}
1313

1414
export 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 {

‎ui/packages/platform/src/api/clones/destroyClone.ts

Copy file name to clipboardExpand all lines: ui/packages/platform/src/api/clones/destroyClone.ts
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import { DestroyClone } from '@postgres.ai/shared/types/api/endpoints/destroyClo
1010
import { request } from 'helpers/request'
1111

1212
export 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

‎ui/packages/platform/src/api/clones/getClone.ts

Copy file name to clipboardExpand all lines: ui/packages/platform/src/api/clones/getClone.ts
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ type Request = {
1111
}
1212

1313
export 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
}

‎ui/packages/platform/src/api/clones/resetClone.ts

Copy file name to clipboardExpand all lines: ui/packages/platform/src/api/clones/resetClone.ts
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import { ResetClone } from '@postgres.ai/shared/types/api/endpoints/resetClone'
1010
import { request } from 'helpers/request'
1111

1212
export 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
},

‎ui/packages/platform/src/api/clones/updateClone.ts

Copy file name to clipboardExpand all lines: ui/packages/platform/src/api/clones/updateClone.ts
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { UpdateClone } from '@postgres.ai/shared/types/api/endpoints/updateClone
33
import { request } from 'helpers/request'
44

55
export 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
}),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.