Reinstate welcome pane in refactored wizard.

This commit is contained in:
Julian Stirling 2025-10-22 21:49:12 +01:00
parent 00f0fe664c
commit 8f1253ec02
5 changed files with 107 additions and 12 deletions

View file

@ -5,9 +5,9 @@
<component <component
v-if="currentTask" v-if="currentTask"
:is="currentTask" :is="currentTask.component"
:key="taskIndex" :key="taskIndex"
:num="taskIndex" v-bind="currentTask.props"
:first="isFirstTask" :first="isFirstTask"
:final="isFinalTask" :final="isFinalTask"
:startOnLast="movingBackward" :startOnLast="movingBackward"
@ -20,7 +20,8 @@
</template> </template>
<script> <script>
import calibrationWizardTask from "./calibrationWizardComponents/calibrationWizardTask.vue"; import singleStepTask from "./calibrationWizardComponents/singleStepTask.vue";
import welcomeStep from "./calibrationWizardComponents/welcomeStep.vue";
export default { export default {
name: "calibrationWizard", name: "calibrationWizard",
@ -57,7 +58,9 @@ export default {
"camera_stage_mapping" "camera_stage_mapping"
]; ];
this.calibrateableThings = thingsToCheck.filter(name => this.thingAvailable(name)); this.calibrateableThings = thingsToCheck.filter(name => this.thingAvailable(name));
this.tasks = [calibrationWizardTask, calibrationWizardTask, calibrationWizardTask]; this.tasks = [
{component: singleStepTask, props: {stepComponent: welcomeStep}},
]
}, },
methods: { methods: {

View file

@ -1,6 +1,22 @@
<!-- The base component for a wizard task.
Do not import this directly into CalibrationWizard as the list of steps and props
will be confusing.
A task should be used for higher level groupings of individual steps in the wizard,
such as calibrating a Thing.
Tasks can be divided into multiple steps.
-->
<template> <template>
<div> <div>
<p>{{num}}.{{stepIndex}}</p> <component
v-if="currentStep"
:is="currentStep.component"
:key="stepIndex"
v-bind="currentStep.props"
/>
<p class="uk-text-right"> <p class="uk-text-right">
<button <button
v-if="showBackButton" v-if="showBackButton"
@ -22,11 +38,11 @@
</template> </template>
<script> <script>
export default { export default {
name: "calibrationWizardTask", name: "calibrationWizardTask",
props: { props: {
num: Number,
first: Boolean, first: Boolean,
final: Boolean, final: Boolean,
startOnLast: { startOnLast: {
@ -34,23 +50,30 @@ export default {
default: false default: false
}, },
steps: { steps: {
type: Number, type: Array,
default: 2 required: true
} }
}, },
data() { data() {
return { return {
stepIndex: this.startOnLast ? this.steps-1 : 0 stepIndex: this.startOnLast ? this.steps.length-1 : 0
}; };
}, },
mounted() {
console.log("Steps received:", this.steps);
},
computed: { computed: {
currentStep() {
return this.steps[this.stepIndex] || null;
},
showBackButton() { showBackButton() {
return !this.first || this.stepIndex > 0; return !this.first || this.stepIndex > 0;
}, },
nextButtonText() { nextButtonText() {
return this.final && this.stepIndex === this.steps - 1 ? "Finish" : "Next"; return this.final && this.stepIndex === this.steps.length - 1 ? "Finish" : "Next";
} }
}, },
@ -70,7 +93,7 @@ export default {
* Move to the next step in this task, or the next task if final step. * Move to the next step in this task, or the next task if final step.
*/ */
nextStep: function() { nextStep: function() {
if (this.stepIndex < this.steps - 1) { if (this.stepIndex < this.steps.length - 1) {
this.stepIndex = this.stepIndex + 1; this.stepIndex = this.stepIndex + 1;
return true; return true;
} else { } else {

View file

@ -0,0 +1,47 @@
<template>
<calibrationWizardTask
:first="first"
:final="final"
:startOnLast="startOnLast"
:steps="steps"
@next="$emit('next')"
@back="$emit('back')"
/>
</template>
<script>
import calibrationWizardTask from "./calibrationWizardTask.vue";
export default {
name: "singleStepTask",
components: {calibrationWizardTask},
props: {
// This must be sent
stepComponent: Object,
// This is optional.
stepProps: {
type: Object,
default: () => ({})
},
// Standard calibrationWizardTask props below:
first: Boolean,
final: Boolean,
startOnLast: {
type: Boolean,
default: false
},
},
data: function() {
return {
steps: [
{component: this.stepComponent, props: this.stepProps}
]
};
},
mounted(){
console.log(this.stepComponent);
}
}
</script>

View file

@ -0,0 +1,23 @@
<template>
<div>
<p>
<b>
Some important microscope calibration data is currently missing.
</b>
</p>
<p>
Your microscope will still function, however some functionality will
be limited, and image quality will likely suffer.
</p>
<p>
<b>Click Next to begin microscope calibration.</b>
</p>
</div>
</template>
<script>
export default {
name: "welcomeStep"
}
</script>

View file

@ -3,7 +3,6 @@
<div uk-grid class="uk-height-1-1 uk-margin-remove uk-padding-remove"> <div uk-grid class="uk-height-1-1 uk-margin-remove uk-padding-remove">
<calibrationWizard <calibrationWizard
ref="calibrationWizard" ref="calibrationWizard"
@onClose="enterApp()"
></calibrationWizard> ></calibrationWizard>
<div class="settings-nav"> <div class="settings-nav">
<ul class="uk-nav uk-nav-default"> <ul class="uk-nav uk-nav-default">