Refetch the admin checklist on SMTP config save
This commit is contained in:
parent
7379b4e860
commit
696d1714f6
|
@ -13,7 +13,7 @@
|
||||||
Table,
|
Table,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { email } from "stores/portal"
|
import { email, admin } from "stores/portal"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import analytics, { Events } from "analytics"
|
import analytics, { Events } from "analytics"
|
||||||
|
@ -58,6 +58,7 @@
|
||||||
const savedConfig = await API.saveConfig(smtp)
|
const savedConfig = await API.saveConfig(smtp)
|
||||||
smtpConfig._rev = savedConfig._rev
|
smtpConfig._rev = savedConfig._rev
|
||||||
smtpConfig._id = savedConfig._id
|
smtpConfig._id = savedConfig._id
|
||||||
|
await admin.getChecklist()
|
||||||
notifications.success(`Settings saved`)
|
notifications.success(`Settings saved`)
|
||||||
analytics.captureEvent(Events.SMTP.SAVED)
|
analytics.captureEvent(Events.SMTP.SAVED)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -24,14 +24,8 @@ export function createAdminStore() {
|
||||||
const admin = writable(DEFAULT_CONFIG)
|
const admin = writable(DEFAULT_CONFIG)
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
const tenantId = get(auth).tenantId
|
await getChecklist()
|
||||||
const checklist = await API.getChecklist(tenantId)
|
|
||||||
const totalSteps = Object.keys(checklist).length
|
|
||||||
const completedSteps = Object.values(checklist).filter(
|
|
||||||
x => x?.checked
|
|
||||||
).length
|
|
||||||
await getEnvironment()
|
await getEnvironment()
|
||||||
|
|
||||||
// enable system status checks in the cloud
|
// enable system status checks in the cloud
|
||||||
if (get(admin).cloud) {
|
if (get(admin).cloud) {
|
||||||
await getSystemStatus()
|
await getSystemStatus()
|
||||||
|
@ -40,8 +34,6 @@ export function createAdminStore() {
|
||||||
|
|
||||||
admin.update(store => {
|
admin.update(store => {
|
||||||
store.loaded = true
|
store.loaded = true
|
||||||
store.checklist = checklist
|
|
||||||
store.onboardingProgress = (completedSteps / totalSteps) * 100
|
|
||||||
return store
|
return store
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -81,6 +73,20 @@ export function createAdminStore() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getChecklist() {
|
||||||
|
const tenantId = get(auth).tenantId
|
||||||
|
const checklist = await API.getChecklist(tenantId)
|
||||||
|
const totalSteps = Object.keys(checklist).length
|
||||||
|
const completedSteps = Object.values(checklist).filter(
|
||||||
|
x => x?.checked
|
||||||
|
).length
|
||||||
|
admin.update(store => {
|
||||||
|
store.checklist = checklist
|
||||||
|
store.onboardingProgress = (completedSteps / totalSteps) * 100
|
||||||
|
return store
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function unload() {
|
function unload() {
|
||||||
admin.update(store => {
|
admin.update(store => {
|
||||||
store.loaded = false
|
store.loaded = false
|
||||||
|
@ -93,6 +99,7 @@ export function createAdminStore() {
|
||||||
init,
|
init,
|
||||||
checkImportComplete,
|
checkImportComplete,
|
||||||
unload,
|
unload,
|
||||||
|
getChecklist,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue