diff --git a/src/views/pages/ScenarioExec.vue b/src/views/pages/ScenarioExec.vue
index 7aa22bb..e9a7dfa 100644
--- a/src/views/pages/ScenarioExec.vue
+++ b/src/views/pages/ScenarioExec.vue
@@ -104,7 +104,7 @@ import 'md-editor-v3/lib/style.css';
import InputText from 'primevue/inputtext';
import Select from 'primevue/select';
import Textarea from 'primevue/textarea';
-import { computed, onMounted, ref } from 'vue';
+import { computed, onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { JellyfishLoader } from "vue3-spinner";
@@ -139,20 +139,29 @@ const isInputFilled = computed(() => {
});
-
onMounted(() => {
- loading.value = true
- const id = route.params.id;
- loadingStore.scenario_loading = true;
- axios.get('/scenarios/' + id )
- .then(response => {
- loading.value = false
- loadingStore.scenario_loading = false;
-
- scenario.value = response.data
- });
+ fetchScenario(route.params.id);
});
+// Ricarica i dati quando cambia il parametro `id`
+watch(() => route.params.id, fetchScenario);
+
+
+ //Function to fetch scenarios
+ function fetchScenario(id) {
+ loading.value = true;
+ axios.get(`/scenarios/${id}`)
+ .then(response => {
+ scenario.value = response.data;
+ })
+ .catch(error => {
+ console.error("Error fetching scenario:", error);
+ })
+ .finally(() => {
+ loading.value = false;
+ });
+ }
+
const getInputComponent = (type) => {
switch (type) {
case 'text':
@@ -223,8 +232,6 @@ axios.get('/scenarios/getExecutionProgress/'+exec_id.value).then(response => {
});
}
-
-
// Function to start polling
function startPolling() {
// Set polling interval (every 5 seconds in this case)
diff --git a/src/views/pages/ScenarioExecList.vue b/src/views/pages/ScenarioExecList.vue
index 679a4e4..fe7b696 100644
--- a/src/views/pages/ScenarioExecList.vue
+++ b/src/views/pages/ScenarioExecList.vue
@@ -3,29 +3,30 @@