Tidy up
This commit is contained in:
parent
bce1b86059
commit
13f80ad735
|
@ -4,13 +4,18 @@
|
|||
|
||||
import { API } from "api"
|
||||
|
||||
let timeout
|
||||
const timeoutMs = 60000 // 1 minute
|
||||
const loadTime = Date.now()
|
||||
|
||||
async function checkMigrationsFinished() {
|
||||
timeout = setTimeout(async () => {
|
||||
const response = await API.get({ url: "/api/migrations/status" })
|
||||
setTimeout(async () => {
|
||||
const response = await API.getMigrationStatus()
|
||||
if (!response.migrated) {
|
||||
checkMigrationsFinished()
|
||||
return
|
||||
if (loadTime + timeoutMs > Date.now()) {
|
||||
return checkMigrationsFinished()
|
||||
}
|
||||
|
||||
return migrationTimeout()
|
||||
}
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
|
@ -22,11 +27,10 @@
|
|||
|
||||
checkMigrationsFinished()
|
||||
|
||||
setTimeout(() => {
|
||||
clearTimeout(timeout)
|
||||
function migrationTimeout() {
|
||||
// TODO
|
||||
alert("Something went wrong 💀")
|
||||
}, 60000)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="loading">
|
||||
|
|
|
@ -33,6 +33,7 @@ import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
|
|||
import { buildEventEndpoints } from "./events"
|
||||
import { buildAuditLogsEndpoints } from "./auditLogs"
|
||||
import { buildLogsEndpoints } from "./logs"
|
||||
import { buildMigrationEndpoints } from "./migrations"
|
||||
|
||||
/**
|
||||
* Random identifier to uniquely identify a session in a tab. This is
|
||||
|
@ -298,6 +299,7 @@ export const createAPIClient = config => {
|
|||
...buildEventEndpoints(API),
|
||||
...buildAuditLogsEndpoints(API),
|
||||
...buildLogsEndpoints(API),
|
||||
...buildMigrationEndpoints(API),
|
||||
viewV2: buildViewV2Endpoints(API),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
export const buildMigrationEndpoints = API => ({
|
||||
/**
|
||||
* Gets the info about the current app migration
|
||||
*/
|
||||
getMigrationStatus: async () => {
|
||||
return await API.get({
|
||||
url: "/api/migrations/status",
|
||||
})
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue