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 InputText from 'primevue/inputtext';
import Select from 'primevue/select'; import Select from 'primevue/select';
import Textarea from 'primevue/textarea'; 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 { useRoute, useRouter } from 'vue-router';
import { JellyfishLoader } from "vue3-spinner"; import { JellyfishLoader } from "vue3-spinner";
@@ -139,19 +139,28 @@ const isInputFilled = computed(() => {
}); });
onMounted(() => { onMounted(() => {
loading.value = true fetchScenario(route.params.id);
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 // 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) => { const getInputComponent = (type) => {
switch (type) { switch (type) {
@@ -223,8 +232,6 @@ axios.get('/scenarios/getExecutionProgress/'+exec_id.value).then(response => {
}); });
} }
// Function to start polling // Function to start polling
function startPolling() { function startPolling() {
// Set polling interval (every 5 seconds in this case) // Set polling interval (every 5 seconds in this case)

View File

@@ -3,18 +3,19 @@
<ProgressSpinner style="width: 50px; height: 50px; margin-top: 50px" strokeWidth="3" fill="transparent"/> <ProgressSpinner style="width: 50px; height: 50px; margin-top: 50px" strokeWidth="3" fill="transparent"/>
</div> </div>
<div v-else> <div v-else>
<div class="flex items-center justify-between p-2"> <div class="flex items-center justify-between p-2">
<!--
<!-- <Button <Button
@click="back()" @click="back()"
label="Load" label="Load"
class="flex items-center text-sm"> class="flex items-center text-sm">
<ChevronLeftIcon name="chevron-left" class="w-4 h-5 text-white"/> <ChevronLeftIcon name="chevron-left" class="w-4 h-5 text-white"/>
<span>Back to Scenarios</span> <span>Back to Scenarios</span>
</Button> --> </Button>
-->
</div> </div>
<h2 class="text-xl font-bold mt-6">Executions List</h2> <h2 class="text-xl font-bold mt-6">Executions List</h2>
<DataTable v-model:filters="filters" :value="scenario_execution_store.scenariosExecution" <DataTable v-model:filters="filters" :value="scenario_execution_store.scenariosExecution"
:loading="loading_data" :loading="loading_data"
class="mt-0" class="mt-0"
@@ -35,11 +36,8 @@
</IconField> </IconField>
</div> </div>
</template> </template>
<Column field="id" header="Execution ID">
<!-- <template #filter="{ filterModel, filterCallback }"> <Column field="id" header="Execution ID"></Column>
<InputText v-model="filterModel.value" type="text" @input="filterCallback()" placeholder="Search by ID" />
</template>-->
</Column>
<Column field="scenario.name" header="Scenario Name"> <Column field="scenario.name" header="Scenario Name">
<template #body="slotProps"> <template #body="slotProps">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@@ -50,55 +48,42 @@
></i> ></i>
</div> </div>
</template> </template>
</Column>
<Column field="execSharedMap.user_input.selected_project" header="Project Input">
</Column>
<Column field="execSharedMap.user_input.selected_application" header="Application Input">
</Column>
<Column field="startDate" header="Start Date">
</Column>
<Column field="endDate" header="End Date">
</Column>
<Column field="scenario.aiModel.apiProvider" header="Model AI">
</Column>
<Column field="scenario.aiModel.model" header="Version">
</Column> </Column>
<Column field="execSharedMap.user_input.selected_project" header="Project Input"></Column>
<Column field="execSharedMap.user_input.selected_application" header="Application Input"></Column>
<Column field="startDate" header="Start Date"></Column>
<Column field="endDate" header="End Date"></Column>
<Column field="scenario.aiModel.apiProvider" header="Model AI"></Column>
<Column field="scenario.aiModel.model" header="Version"></Column>
<Column header="Output Type"> <Column header="Output Type">
<template #body="slotProps"> <template #body="slotProps">
{{ slotProps.data.scenario.outputType || 'text' }} {{ slotProps.data.scenario.outputType || 'text' }}
</template> </template>
</Column> </Column>
<Column field="rating" header="Rating"> <Column field="rating" header="Rating">
<template #body="slotProps"> <template #body="slotProps">
<Rating :value="slotProps.data.rating" :stars="5" readonly cancel="false" /> <Rating :value="slotProps.data.rating" :stars="5" readonly cancel="false" />
</template> </template>
</Column> </Column>
<Column field="id"> <Column field="id">
<template #body="slotProps"> <template #body="slotProps">
<div class="flex justify-center items-center h-full"> <div class="flex justify-center items-center h-full">
<Button label="View" @click="goToScenarioExec(slotProps.data)" class="mt-0 ml-0" /> <Button label="View" @click="goToScenarioExec(slotProps.data)" class="mt-0 ml-0" />
</div> </div>
</template> </template>
</Column> </Column>
</DataTable>
<template #empty>
<tr>
<td :colspan="9" class="text-center">No executions found</td>
</tr>
</template>
</DataTable>
</div> </div>
<div v-if="loading_data" class="flex justify-center"> <div v-if="loading_data" class="flex justify-center">
<ProgressSpinner style="width: 30px; height: 30px; margin: 30px" strokeWidth="6" fill="transparent"/> <ProgressSpinner style="width: 30px; height: 30px; margin: 30px" strokeWidth="6" fill="transparent"/>
</div> </div>
</template> </template>
<script setup> <script setup>