upate rating
This commit is contained in:
@@ -71,8 +71,18 @@
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-bold">Workflow Response</span>
|
||||
</div>
|
||||
<div>
|
||||
<Rating
|
||||
|
||||
:modelValue="rating"
|
||||
:stars="5"
|
||||
@change="updateRating($event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #icons>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<Button severity="secondary" rounded @click="openDebug" v-tooltip.left="'View code'">
|
||||
<i class="pi pi-code"></i>
|
||||
@@ -111,20 +121,24 @@ import axios from 'axios';
|
||||
import JsonEditorVue from 'json-editor-vue';
|
||||
import { MdPreview } from 'md-editor-v3';
|
||||
import 'md-editor-v3/lib/style.css';
|
||||
import moment from 'moment';
|
||||
import InputText from 'primevue/inputtext';
|
||||
import Select from 'primevue/select';
|
||||
import Textarea from 'primevue/textarea';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import moment from 'moment';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { JellyfishLoader } from "vue3-spinner";
|
||||
import { ScenarioService } from '../../service/ScenarioService';
|
||||
|
||||
|
||||
const loadingStore = LoadingStore();
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const value = ref('');
|
||||
const rating = ref(0);
|
||||
const scenario = ref({});
|
||||
const scenario_response = ref(null);
|
||||
const scenario_output = ref(null);
|
||||
@@ -205,7 +219,6 @@ watch(() => route.params.id, fetchScenario);
|
||||
return InputText;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const execScenario = () => {
|
||||
loading_data.value = true;
|
||||
@@ -286,6 +299,36 @@ watch(() => route.params.id, fetchScenario);
|
||||
console.log("Polling stopped.");
|
||||
}
|
||||
|
||||
async function updateRating(newRating) {
|
||||
|
||||
ScenarioService.updateScenarioExecRating(exec_id.value,newRating.value).then((response) => {
|
||||
|
||||
console.log('response:', response);
|
||||
if (response.data === "OK") {
|
||||
rating.value = newRating.value;
|
||||
console.log('Rating aggiornato con successo:', response.data);
|
||||
toast.add({
|
||||
severity: 'success', // Tipo di notifica (successo)
|
||||
summary: 'Successo', // Titolo della notifica
|
||||
detail: 'Rating updated with success.', // Messaggio dettagliato
|
||||
life: 3000 // Durata della notifica in millisecondi
|
||||
});
|
||||
} else {
|
||||
console.error('Errore nell\'aggiornamento del rating', response.data);
|
||||
toast.add({
|
||||
severity: 'error', // Tipo di notifica (errore)
|
||||
summary: 'Errore', // Titolo della notifica
|
||||
detail: 'Error updating rating. Try later.', // Messaggio dettagliato
|
||||
life: 3000 // Durata della notifica in millisecondi
|
||||
});
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('Errore durante la chiamata al backend:', error);
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user