Skip to content

Commit a0ed045

Browse files
remove stepper tree in components
1 parent e341763 commit a0ed045

File tree

7 files changed

+66
-24
lines changed

7 files changed

+66
-24
lines changed

components/CrsSelector.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@
2424
</template>
2525

2626
<script setup>
27-
const stepper_tree = inject("stepper_tree")
27+
const emit = defineEmits([
28+
"update_values",
29+
"increment_current_step",
30+
"decrement_current_step",
31+
])
32+
2833
const props = defineProps({
2934
input_geode_object: { type: String, required: true },
30-
variable_to_update: { type: String, required: true },
35+
key_to_update: { type: String, required: true },
3136
schema: { type: Object, required: true },
3237
})
3338
34-
const { input_geode_object, variable_to_update, schema } = props
39+
const { input_geode_object, key_to_update, schema } = props
3540
3641
const search = ref("")
3742
const data_table_loading = ref(false)
@@ -41,14 +46,13 @@
4146
4247
watch(selected_crs, (new_value) => {
4348
const crs = get_selected_crs(new_value[0])
44-
set_crs(crs)
49+
const keys_values_object = {
50+
[key_to_update]: crs,
51+
}
52+
emit("update_values", keys_values_object)
53+
emit("increment_current_step")
4554
})
4655
47-
function set_crs(crs_value) {
48-
stepper_tree[variable_to_update] = crs_value
49-
stepper_tree["current_step_index"]++
50-
}
51-
5256
function get_selected_crs(crs_code) {
5357
for (let i = 0; i <= crs_list.value.length; i++) {
5458
if (crs_list.value[i]["code"] == crs_code) {

components/ExtensionSelector.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
</template>
4040

4141
<script setup>
42-
const stepper_tree = inject("stepper_tree")
42+
const emit = defineEmits([
43+
"update_values",
44+
"increment_current_step",
45+
"decrement_current_step",
46+
])
4347
4448
const props = defineProps({
4549
input_geode_object: { type: String, required: true },
@@ -68,9 +72,14 @@
6872
}
6973
7074
function set_variables(geode_object, output_extension) {
71-
stepper_tree["output_geode_object"] = geode_object
72-
stepper_tree["output_extension"] = output_extension
73-
stepper_tree["current_step_index"]++
75+
if (geode_object != "" && output_extension != "") {
76+
const keys_values_object = {
77+
output_geode_object: geode_object,
78+
output_extension,
79+
}
80+
emit("update_values", keys_values_object)
81+
emit("increment_current_step")
82+
}
7483
}
7584
7685
onMounted(() => {

components/FileSelector.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
</template>
99

1010
<script setup>
11-
const stepper_tree = inject("stepper_tree")
11+
const emit = defineEmits([
12+
"update_values",
13+
"increment_current_step",
14+
"decrement_current_step",
15+
])
1216
1317
const props = defineProps({
1418
multiple: { type: Boolean, required: true },
@@ -24,9 +28,9 @@
2428
const toggle_loading = useToggle(loading)
2529
2630
function files_uploaded_event(value) {
27-
stepper_tree["files"] = value
2831
if (value.length) {
29-
stepper_tree["current_step_index"]++
32+
emit("update_values", { files: value })
33+
emit("increment_current_step")
3034
}
3135
}
3236

components/FileUploader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</template>
3232

3333
<script setup>
34-
const emit = defineEmits(["files_uploaded"])
34+
const emit = defineEmits(["files_uploaded", "decrement_current_step"])
3535
3636
const props = defineProps({
3737
multiple: { type: Boolean, required: true },

components/MissingFilesSelector.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<v-icon color="warning" icon="mdi-file-document-alert-outline" />
77
</v-col>
88
<p class="pa-1">Mandatory files:</p>
9-
<v-col v-for="mandatory_file in mandatory_files" class="pa-0">
9+
<v-col v-for="mandatory_file in mandatory_files" cols="auto" class="pa-0">
1010
<v-chip>{{ mandatory_file }}</v-chip>
1111
</v-col>
1212
</v-row>
@@ -43,7 +43,11 @@
4343
</template>
4444

4545
<script setup>
46-
const stepper_tree = inject("stepper_tree")
46+
const emit = defineEmits([
47+
"update_values",
48+
"increment_current_step",
49+
"decrement_current_step",
50+
])
4751
4852
const props = defineProps({
4953
multiple: { type: Boolean, required: true },
@@ -62,7 +66,7 @@
6266
const toggle_loading = useToggle(loading)
6367
6468
function files_uploaded(value) {
65-
stepper_tree["additional_files"] = value
69+
emit("update_values", { additional_files: value })
6670
missing_files()
6771
}
6872
@@ -94,7 +98,7 @@
9498
.map((filename) => "." + filename.split(".").pop())
9599
.join(",")
96100
if (!has_missing_files.value) {
97-
stepper_tree["current_step_index"]++
101+
emit("increment_current_step")
98102
}
99103
},
100104
},

components/ObjectSelector.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<script setup>
3434
import geode_objects from "@/assets/geode_objects"
3535
36-
const stepper_tree = inject("stepper_tree")
36+
const emit = defineEmits(["update_values", "increment_current_step"])
3737
3838
const props = defineProps({
3939
files: { type: Array, required: true },
@@ -63,8 +63,10 @@
6363
}
6464
6565
function set_geode_object(geode_object) {
66-
stepper_tree["input_geode_object"] = geode_object
67-
stepper_tree["current_step_index"]++
66+
if (geode_object != "") {
67+
emit("update_values", { input_geode_object: geode_object })
68+
emit("increment_current_step")
69+
}
6870
}
6971
7072
onMounted(() => {

components/Step.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
<component
4242
:is="steps[step_index].component.component_name"
4343
v-bind="steps[step_index].component.component_options"
44+
@update_values="update_values_event"
45+
@increment_current_step="increment_current_step()"
46+
@decrement_current_step="decrement_current_step()"
4447
/>
4548
</v-col>
4649
</Transition>
@@ -58,6 +61,22 @@
5861
function set_current_step(step_index) {
5962
stepper_tree.current_step_index = step_index
6063
}
64+
65+
function update_values_event(keys_values_object) {
66+
console.log("update_values_event", keys_values_object)
67+
for (const [key, value] of Object.entries(keys_values_object)) {
68+
console.log(key, value)
69+
stepper_tree[key] = value
70+
}
71+
}
72+
73+
function increment_current_step() {
74+
stepper_tree.current_step_index++
75+
}
76+
77+
function decrement_current_step() {
78+
stepper_tree.current_step_index--
79+
}
6180
</script>
6281

6382
<style scoped>

0 commit comments

Comments
 (0)