Merge pull request #2587 from Budibase/fix-checklist
Fix checklist spinner and progress
This commit is contained in:
commit
63640cd63c
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
<div
|
<div
|
||||||
on:click
|
on:click
|
||||||
class:spectrum-ProgressCircle--indeterminate={!value}
|
class:spectrum-ProgressCircle--indeterminate={value == null}
|
||||||
class:spectrum-ProgressCircle--overBackground={overBackground}
|
class:spectrum-ProgressCircle--overBackground={overBackground}
|
||||||
class="spectrum-ProgressCircle spectrum-ProgressCircle--{convertSize(size)}"
|
class="spectrum-ProgressCircle spectrum-ProgressCircle--{convertSize(size)}"
|
||||||
>
|
>
|
||||||
|
|
|
@ -25,20 +25,14 @@ export function createAdminStore() {
|
||||||
`/api/global/configs/checklist?tenantId=${tenantId}`
|
`/api/global/configs/checklist?tenantId=${tenantId}`
|
||||||
)
|
)
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
|
const totalSteps = Object.keys(json).length
|
||||||
const onboardingSteps = Object.keys(json)
|
const completedSteps = Object.values(json).filter(x => x?.checked).length
|
||||||
|
|
||||||
const stepsComplete = onboardingSteps.reduce(
|
|
||||||
(score, step) => (score + step.checked ? 1 : 0),
|
|
||||||
0
|
|
||||||
)
|
|
||||||
|
|
||||||
await getFlags()
|
await getFlags()
|
||||||
admin.update(store => {
|
admin.update(store => {
|
||||||
store.loaded = true
|
store.loaded = true
|
||||||
store.checklist = json
|
store.checklist = json
|
||||||
store.onboardingProgress =
|
store.onboardingProgress = (completedSteps / totalSteps) * 100
|
||||||
(stepsComplete / onboardingSteps.length) * 100
|
|
||||||
return store
|
return store
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue