Aggiungi gestione degli errori per l'esecuzione dello scenario in OldScenarioExec e ScenarioExec
This commit is contained in:
@@ -209,14 +209,21 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button severity="secondary" rounded @click="openDebug" v-tooltip.left="'View code'">
|
||||
<Button severity="secondary" rounded @click="openDebug" v-tooltip.left="'View execution info'">
|
||||
<i class="pi pi-code"></i>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="card flex flex-col gap-4 w-full">
|
||||
<div v-if="errored_execution" class="card flex flex-col gap-4 w-full">
|
||||
<div v-if="error_message">
|
||||
<p class="text-red-500 font-bold">Error: {{ error_message }}</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p class="text-red-500 font-bold">Error: Execution failed.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="card flex flex-col gap-4 w-full">
|
||||
<div v-if="scenario.outputType == 'ciaOutput'">
|
||||
<ChangeImpactOutputViewer :scenario_output="scenario_output" />
|
||||
</div>
|
||||
@@ -224,19 +231,6 @@
|
||||
<Button icon="pi pi-download" label="Download File" class="p-button-primary" @click="downloadFile" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<!-- <div v-if="fileNamesOutput.length">
|
||||
<ul>
|
||||
<li v-for="(file, idx) in fileNamesOutput" :key="idx" class="file-item">
|
||||
{{ file }}
|
||||
<Button
|
||||
icon="pi pi-download"
|
||||
class="p-button-text p-button-sm"
|
||||
label="Download"
|
||||
@click="downloadZipFile(file)"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
<div v-if="fileType == 'FILE'">
|
||||
<ul>
|
||||
<li class="file-item">
|
||||
@@ -300,7 +294,7 @@ import Select from 'primevue/select';
|
||||
import Textarea from 'primevue/textarea';
|
||||
import { useConfirm } from 'primevue/useconfirm';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { JellyfishLoader } from 'vue3-spinner';
|
||||
import { ScenarioService } from '../../service/ScenarioService';
|
||||
@@ -314,9 +308,11 @@ const scenario = ref({});
|
||||
const scenario_response = ref(null);
|
||||
const scenario_output = ref(null);
|
||||
const scenario_response_message = ref(null);
|
||||
const error_message = ref(null);
|
||||
const loading = ref(false);
|
||||
const data_loaded = ref(false);
|
||||
const loading_data = ref(false);
|
||||
const errored_execution = ref(false);
|
||||
const formData = ref({});
|
||||
const exec_id = ref(null);
|
||||
const exec_scenario = ref({});
|
||||
@@ -384,6 +380,11 @@ const isInputFilled = computed(() => {
|
||||
});
|
||||
return isFilled;
|
||||
});
|
||||
//When the component is dismissed stop the polling
|
||||
onBeforeUnmount(() => {
|
||||
stopPolling();
|
||||
stopTimer();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
fetchScenario(route.params.id);
|
||||
@@ -531,6 +532,12 @@ const pollBackendAPI = () => {
|
||||
stopPolling();
|
||||
|
||||
stopTimer();
|
||||
|
||||
if(response.data.status == 'ERROR') {
|
||||
errored_execution.value = true;
|
||||
error_message.value = response.data.message;
|
||||
}
|
||||
|
||||
loading_data.value = false;
|
||||
data_loaded.value = true;
|
||||
scenario_output.value = response.data.stringOutput;
|
||||
@@ -545,16 +552,7 @@ const pollBackendAPI = () => {
|
||||
// Accedi al primo step e controlla se esiste l'attributo `codegenie_output_type`
|
||||
const firstStep = scenario.value.steps[0];
|
||||
if (firstStep?.attributes?.['codegenie_output_type']) {
|
||||
// Controlla se `codegenie_output_type` è uguale a 'FILE'
|
||||
// if (firstStep.attributes['codegenie_output_type'] === 'FILE') {
|
||||
// console.log('base64 ', scenario_output.value);
|
||||
|
||||
// Chiama la funzione `extractFiles` con il valore di `scenario_output.value`
|
||||
//extractFiles(scenario_output.value);
|
||||
//}
|
||||
if (firstStep.attributes['codegenie_output_type'] == 'FILE') {
|
||||
//console.log('base64 ', scenario_output.value)
|
||||
//extractFiles(scenario_output.value, 'output', zipOutput)
|
||||
fileType.value = 'FILE';
|
||||
} else if (firstStep.attributes['codegenie_output_type'] == 'MARKDOWN') {
|
||||
fileType.value = 'MARKDOWN';
|
||||
|
||||
Reference in New Issue
Block a user