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)

View File

@@ -3,29 +3,30 @@
<ProgressSpinner style="width: 50px; height: 50px; margin-top: 50px" strokeWidth="3" fill="transparent"/>
</div>
<div v-else>
<div class="flex items-center justify-between p-2">
<!-- <Button
<!--
<Button
@click="back()"
label="Load"
class="flex items-center text-sm">
<ChevronLeftIcon name="chevron-left" class="w-4 h-5 text-white"/>
<span>Back to Scenarios</span>
</Button> -->
</Button>
-->
</div>
<h2 class="text-xl font-bold mt-6">Executions List</h2>
<DataTable v-model:filters="filters" :value="scenario_execution_store.scenariosExecution"
: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']">
: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']">
<template #header>
<template #header>
<div class="flex justify-end">
<IconField>
<InputIcon>
@@ -35,70 +36,54 @@
</IconField>
</div>
</template>
<Column field="id" header="Execution ID">
<!-- <template #filter="{ filterModel, filterCallback }">
<InputText v-model="filterModel.value" type="text" @input="filterCallback()" placeholder="Search by ID" />
</template>-->
</Column>
<Column field="id" header="Execution ID"></Column>
<Column field="scenario.name" header="Scenario Name">
<template #body="slotProps">
<div class="flex items-center gap-2">
{{ slotProps.data.scenario.name }}
<i
class="pi pi-info-circle text-blue-500 cursor-pointer"
v-tooltip="slotProps.data.scenario.description"
></i>
<i
class="pi pi-info-circle text-blue-500 cursor-pointer"
v-tooltip="slotProps.data.scenario.description"
></i>
</div>
</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 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">
<template #body="slotProps">
{{ slotProps.data.scenario.outputType || 'text' }}
</template>
</Column>
<Column field="rating" header="Rating">
<template #body="slotProps">
<Rating :value="slotProps.data.rating" :stars="5" readonly cancel="false" />
</template>
</Column>
<Column field="id">
<template #body="slotProps">
<div class="flex justify-center items-center h-full">
<Button label="View" @click="goToScenarioExec(slotProps.data)" class="mt-0 ml-0" />
</div>
</template>
</Column>
<template #empty>
<tr>
<td :colspan="9" class="text-center">No executions found</td>
</tr>
</template>
</DataTable>
</div>
<div v-if="loading_data" class="flex justify-center">
<ProgressSpinner style="width: 30px; height: 30px; margin: 30px" strokeWidth="6" fill="transparent"/>
</div>
</template>
<script setup>