Skip to content

Commit

Permalink
feat(onboarding) disable router mocks
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Wylężek <tomwylezek@gmail.com>
  • Loading branch information
tomaszwylezek committed Jan 14, 2022
1 parent ed2c352 commit a906582
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 48 deletions.
56 changes: 28 additions & 28 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,38 +455,38 @@ export default (store: Store<RootInterface>) => {
* so that they're not sent through it again.
*/

// router.beforeEach(async (to, from, next) => {
// // eslint-disable-next-line no-unmodified-loop-condition
// // This below is to make sure the inital calls have been fulfilled and it does not try to
// // access any route before it will be resolved
// while (store.getters.globalLoading) {
// await new Promise(resolve => {
// setTimeout(() => {
// resolve(null)
// }, 20)
// })
// }
router.beforeEach(async (to, from, next) => {
// eslint-disable-next-line no-unmodified-loop-condition
// This below is to make sure the inital calls have been fulfilled and it does not try to
// access any route before it will be resolved
while (store.getters.globalLoading) {
await new Promise(resolve => {
setTimeout(() => {
resolve(null)
}, 20)
})
}

// const showOnboarding = store.getters['onboarding/showOnboarding']
// const isCompleted = store.state.onboarding.isCompleted
const showOnboarding = store.getters['onboarding/showOnboarding']
const isCompleted = store.state.onboarding.isCompleted

// const onboardingRoute = to.meta.onboardingProcess
const onboardingRoute = to.meta.onboardingProcess

// // If someone is going to open onboarding page but fulfiled already conditionn related to
// // show onboarding, then redirect user to overview
// if (onboardingRoute && !showOnboarding) {
// next({ name: 'global-overview' })
// // if someone never had onboarding and do not fulfiled condition to skip it
// // and try to access some other page than onboarding ones
// // then redirect into first onboarding page
// } else if (!onboardingRoute && showOnboarding && !isCompleted) {
// const name = localStorage.getItem('onboarding/step') || 'onboarding-welcome'
// If someone is going to open onboarding page but fulfiled already conditionn related to
// show onboarding, then redirect user to overview
if (onboardingRoute && !showOnboarding) {
next({ name: 'global-overview' })
// if someone never had onboarding and do not fulfiled condition to skip it
// and try to access some other page than onboarding ones
// then redirect into first onboarding page
} else if (!onboardingRoute && showOnboarding && !isCompleted) {
const name = localStorage.getItem('onboarding/step') || 'onboarding-welcome'

// next({ name })
// } else {
// next()
// }
// })
next({ name })
} else {
next()
}
})

return router
}
5 changes: 1 addition & 4 deletions src/views/Onboarding/AddingNewServicesCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ export default {
},
},
created() {
// TODO before merge remove
setTimeout(() => {
this.getDPPs()
}, 2000)
this.getDPPs()
},
destroyed() {
clearTimeout(this.DPPsTimeout)
Expand Down
5 changes: 1 addition & 4 deletions src/views/Onboarding/DataplanesOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ export default {
},
},
created() {
// TODO before merge remove
setTimeout(() => {
this.getAllDataplanes()
}, 2000)
this.getAllDataplanes()
},
methods: {
async getAllDataplanes() {
Expand Down
11 changes: 2 additions & 9 deletions src/views/Onboarding/MultiZone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,8 @@ export default {
},
},
created() {
// TODO before merge remove
setTimeout(() => {
this.getZoneIngresses()
}, 2000)
// TODO before merge remove
setTimeout(() => {
this.getZones()
}, 3000)
this.getZoneIngresses()
this.getZones()
},
destroyed() {
clearTimeout(this.zoneTimeout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ exports[`DataplanesOverview.vue renders snapshot 1`] = `
class="onboarding-title"
>
Congratulations!
Success
</h1>
<p
class="text-center text-lg mt-3"
>
We have detected the following data plane proxies (DPPs) connecting to the control plane:
The following data plane proxies (DPPs) are connected to the control plane:
</p>
</div>
Expand Down Expand Up @@ -55,7 +55,7 @@ exports[`DataplanesOverview.vue renders snapshot 1`] = `
class="font-bold mb-4"
>
Found 3 DPPs, including:
Found 3 DPPs:
</p>
Expand Down

0 comments on commit a906582

Please sign in to comment.