-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert frontend-core API client to Typescript #15096
Changes from all commits
fdc6e53
6776a55
a26eb57
a7873ca
785938b
bac341f
2c40b9a
d50df9a
1e535d3
9c35a77
544e3a9
679f08d
7ab6a1b
fd19986
aeb0af6
c9daead
6b0b7fe
152cc38
07afd92
5f9eb04
6d67a10
6d50f70
417040f
00359d8
accd21d
e2ea52d
dedd5f2
417286b
1b6e6ed
1620564
d36122b
b2b2648
85e8690
7a437aa
2038467
99c3955
d59a3a0
c6f5287
ac8c2cc
abddbde
ac05ccd
e938fdd
2a7c0ca
0e8c89d
9926e8d
ea84af7
b546512
86c34cc
2361155
5ea8e0d
7100b4b
4565b2d
c4caa89
c6bad69
2d46939
9b16849
a585ba1
63790e0
3f15216
66d7fb2
b329187
ef28b03
edbcc1f
a469e1c
170d453
1b467f2
50fd530
fc463ed
f57dbfa
a85a7a6
92f8d79
a528743
de97219
739cab0
f8f81fd
dcb9fd2
0da9ad0
29a1df7
f99372a
29aa2cc
e1178ea
42c3a54
315d284
7d4974a
78f1690
2b06a7d
4c80d9e
ca10a21
7806eeb
8992a1d
feee403
9877caf
fe91639
dd9cd6d
b025878
923859b
a42fd87
100efef
00cbee5
557406a
5c08b6d
e44ce7e
32bb912
fccfaeb
d0b3c9d
65f37e0
f20c07a
7b01d3c
6862730
cee5354
6101335
f93f278
7ea9478
6463b1c
8efb2d7
d0ebb6a
4f3a3aa
eb0a475
9495a90
bcfe3d2
a781800
4c5bfa5
28f895f
31b696d
31a8d85
7be2d9e
a706a76
0cbf0a7
61b42d3
3a51a81
ea444a9
c5407d3
cb8f052
e77a029
cb88f1f
8c4bb89
4fd47b5
d5eaa6e
22d8994
4b499ca
c883f0d
287f8ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,21 +99,18 @@ | |
} | ||
|
||
async function fetchBackups(filters, page, dateRange = []) { | ||
const body = { | ||
appId: $appStore.appId, | ||
const opts = { | ||
...filters, | ||
page, | ||
} | ||
|
||
const [startDate, endDate] = dateRange | ||
if (startDate) { | ||
body.startDate = startDate | ||
opts.startDate = startDate | ||
} | ||
if (endDate) { | ||
body.endDate = endDate | ||
opts.endDate = endDate | ||
} | ||
|
||
const response = await backups.searchBackups(body) | ||
const response = await backups.searchBackups($appStore.appId, opts) | ||
pageInfo.fetched(response.hasNextPage, response.nextPage) | ||
|
||
// flatten so we have an easier structure to use for the table schema | ||
|
@@ -123,9 +120,7 @@ | |
async function createManualBackup() { | ||
try { | ||
loading = true | ||
let response = await backups.createManualBackup({ | ||
appId: $appStore.appId, | ||
}) | ||
let response = await backups.createManualBackup($appStore.appId) | ||
await fetchBackups(filterOpt, page) | ||
notifications.success(response.message) | ||
} catch (err) { | ||
|
@@ -149,24 +144,14 @@ | |
|
||
async function handleButtonClick({ detail }) { | ||
if (detail.type === "backupDelete") { | ||
await backups.deleteBackup({ | ||
appId: $appStore.appId, | ||
backupId: detail.backupId, | ||
}) | ||
await backups.deleteBackup($appStore.appId, detail.backupId) | ||
await fetchBackups(filterOpt, page) | ||
} else if (detail.type === "backupRestore") { | ||
await backups.restoreBackup({ | ||
appId: $appStore.appId, | ||
backupId: detail.backupId, | ||
name: detail.restoreBackupName, | ||
}) | ||
await fetchBackups(filterOpt, page) | ||
} else if (detail.type === "backupUpdate") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the backup update no longer required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope I believe we actually stopped using and allowing custom naming of backups a while ago, so this code existed but was never used. So just pruning dead code with this. |
||
await backups.updateBackup({ | ||
appId: $appStore.appId, | ||
backupId: detail.backupId, | ||
name: detail.name, | ||
}) | ||
await backups.restoreBackup( | ||
$appStore.appId, | ||
detail.backupId, | ||
detail.restoreBackupName | ||
) | ||
await fetchBackups(filterOpt, page) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
I guess this was broken? Or were we supporting both formats?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't broken, but I've just flattened the structure a little to make it simpler. We used to do this logic inside the API client code, but there was no point in wrapping things in a
search
object just to pull them out again later. So the result sent to the API is identical but it's a bit simpler to use it now :)