fixed Project application bug

This commit is contained in:
2024-11-05 15:52:08 +01:00
parent c842ec45e2
commit 10edf80233
2 changed files with 53 additions and 61 deletions

View File

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