|
1 | 1 | <template> |
2 | | - <v-row class="justify-left"> |
3 | | - <v-col |
4 | | - v-for="file_extension in file_extensions" |
5 | | - :key="file_extension" |
6 | | - cols="2" |
7 | | - > |
8 | | - <v-card |
9 | | - class="card ma-2" |
10 | | - hover |
11 | | - elevation="5" |
12 | | - @click="set_output_extension(file_extension)" |
13 | | - > |
14 | | - <v-card-title align="center"> |
15 | | - {{ file_extension }} |
16 | | - </v-card-title> |
17 | | - </v-card> |
18 | | - </v-col> |
| 2 | + <FetchingData v-if="loading" /> |
| 3 | + <v-row |
| 4 | + v-for="item in geode_objects_and_output_extensions" |
| 5 | + :key="item.geode_object" |
| 6 | + class="justify-left" |
| 7 | + > |
| 8 | + <v-card class="card ma-2 pa-2" width="100%"> |
| 9 | + <v-tooltip :text="`Export as a ${item.geode_object}`" location="bottom"> |
| 10 | + <template v-slot:activator="{ props }"> |
| 11 | + <v-card-title v-bind="props"> |
| 12 | + {{ item.geode_object }} |
| 13 | + </v-card-title> |
| 14 | + </template> |
| 15 | + </v-tooltip> |
| 16 | + <v-card-text> |
| 17 | + <v-row> |
| 18 | + <v-col |
| 19 | + v-for="output_extension in item.output_extensions" |
| 20 | + :key="output_extension" |
| 21 | + cols="auto" |
| 22 | + class="pa-0" |
| 23 | + > |
| 24 | + <v-card |
| 25 | + class="card ma-2" |
| 26 | + color="primary" |
| 27 | + hover |
| 28 | + @click="set_variables(item.geode_object, output_extension)" |
| 29 | + > |
| 30 | + <v-card-title align="center"> |
| 31 | + {{ output_extension }} |
| 32 | + </v-card-title> |
| 33 | + </v-card> |
| 34 | + </v-col> |
| 35 | + </v-row> |
| 36 | + </v-card-text> |
| 37 | + </v-card> |
19 | 38 | </v-row> |
20 | 39 | </template> |
21 | 40 |
|
22 | 41 | <script setup> |
23 | | - const stepper_tree = inject("stepper_tree") |
24 | | - const { geode_object } = stepper_tree |
| 42 | + const emit = defineEmits([ |
| 43 | + "update_values", |
| 44 | + "increment_step", |
| 45 | + "decrement_step", |
| 46 | + ]) |
25 | 47 |
|
26 | 48 | const props = defineProps({ |
27 | | - variable_to_update: { type: String, required: true }, |
28 | | - variable_to_increment: { type: String, required: true }, |
| 49 | + input_geode_object: { type: String, required: true }, |
29 | 50 | schema: { type: Object, required: true }, |
30 | 51 | }) |
31 | | - const { variable_to_update, variable_to_increment, schema } = props |
| 52 | + const { input_geode_object, schema } = props |
32 | 53 |
|
33 | | - const file_extensions = ref([]) |
| 54 | + const geode_objects_and_output_extensions = ref([]) |
| 55 | + const loading = ref(false) |
| 56 | +
|
| 57 | + const toggle_loading = useToggle(loading) |
34 | 58 |
|
35 | 59 | async function get_output_file_extensions() { |
36 | | - const params = { geode_object: geode_object } |
| 60 | + toggle_loading() |
| 61 | + const params = { input_geode_object } |
37 | 62 | await api_fetch( |
38 | 63 | { schema, params }, |
39 | 64 | { |
40 | 65 | response_function: (response) => { |
41 | | - file_extensions.value = response._data.output_file_extensions |
| 66 | + geode_objects_and_output_extensions.value = |
| 67 | + response._data.geode_objects_and_output_extensions |
42 | 68 | }, |
43 | 69 | }, |
44 | 70 | ) |
| 71 | + toggle_loading() |
45 | 72 | } |
46 | 73 |
|
47 | | - function set_output_extension(extension) { |
48 | | - stepper_tree[variable_to_update] = extension |
49 | | - stepper_tree[variable_to_increment]++ |
| 74 | + function set_variables(geode_object, output_extension) { |
| 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_step") |
| 82 | + } |
50 | 83 | } |
51 | 84 |
|
52 | 85 | onMounted(() => { |
53 | 86 | get_output_file_extensions() |
54 | 87 | }) |
55 | 88 | </script> |
56 | | - |
57 | | -<style scoped> |
58 | | - .card { |
59 | | - border-radius: 15px; |
60 | | - } |
61 | | -</style> |
|
0 commit comments