|
144 | 144 | <script lang="ts" setup>
|
145 | 145 | import createDebug from "debug";
|
146 | 146 | import { List } from "immutable";
|
147 |
| -import { computed, ref, onActivated, watch } from "vue"; |
| 147 | +import { computed, ref, onActivated, watch, nextTick } from "vue"; |
148 | 148 | import { RouterLink, useRouter } from "vue-router";
|
149 | 149 | import { VueSpinner } from "vue3-spinners";
|
150 | 150 |
|
@@ -296,7 +296,7 @@ function taskTitle(taskID: string): string | undefined {
|
296 | 296 |
|
297 | 297 | return titled.displayInformation.taskTitle;
|
298 | 298 | }
|
299 |
| -// Define the steps for the guide when no user's models are available |
| 299 | +//Define the steps for the guide when no user's models are available |
300 | 300 | const modelEmptySteps: DriveStep[] = [
|
301 | 301 | {
|
302 | 302 | popover: {
|
@@ -425,27 +425,23 @@ const evaluationSteps: DriveStep[] = [
|
425 | 425 | ];
|
426 | 426 | watch(
|
427 | 427 | () => guideStoreTesting.showGuide,
|
428 |
| - (newValue) => { |
429 |
| - driverTesting.destroy(); |
430 |
| - if (router.currentRoute.value.path == "/evaluate") { |
431 |
| - if (validationStore.step === 0) { |
432 |
| - if (models.infos.isEmpty()) { |
433 |
| - driverTesting.setSteps(modelEmptySteps); |
434 |
| - } else { |
435 |
| - driverTesting.setSteps(modelSteps); |
436 |
| - } |
| 428 | + async (newValue) => { |
| 429 | + if (driverTesting.isActive()) { |
| 430 | + await driverTesting.destroy(); |
| 431 | + } |
| 432 | + if (router.currentRoute.value.path === "/evaluate") { |
| 433 | + const stepsMap: Record<number, DriveStep[]> = { |
| 434 | + 0: models.infos.isEmpty() ? modelEmptySteps : modelSteps, |
| 435 | + 1: dataSteps, |
| 436 | + 2: evaluationSteps, |
| 437 | + }; |
| 438 | +
|
| 439 | + const steps = stepsMap[validationStore.step] || []; |
| 440 | + if (steps.length) { |
| 441 | + driverTesting.setSteps(steps); |
| 442 | + await nextTick(); |
437 | 443 | driverTesting.drive();
|
438 | 444 | }
|
439 |
| - if (validationStore.step !== 0) { |
440 |
| - if (validationStore.step === 1) { |
441 |
| - driverTesting.setSteps(dataSteps); |
442 |
| - driverTesting.drive(); |
443 |
| - } |
444 |
| - if (validationStore.step === 2) { |
445 |
| - driverTesting.setSteps(evaluationSteps); |
446 |
| - driverTesting.drive(); |
447 |
| - } |
448 |
| - } |
449 | 445 | }
|
450 | 446 | },
|
451 | 447 | );
|
|
0 commit comments