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 @@
-
- - + + -->

Executions List

+ + :loading="loading_data" + class="mt-0" + :rows="10" + paginator + :paginatorTemplate="paginatorTemplate" + :totalRecords="scenario_execution_store.scenariosExecution.length" + :first="first" + @page="onPage" :globalFilterFields="['id', 'scenario.name', 'execSharedMap.user_input.selected_project', 'execSharedMap.user_input.selected_application']"> -