From 934872a753f7a194e197f9ba6191cfed4e96c7cb Mon Sep 17 00:00:00 2001 From: Florinda Date: Mon, 3 Mar 2025 11:52:34 +0100 Subject: [PATCH 1/2] bug exec --- src/views/pages/ScenarioExec.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/views/pages/ScenarioExec.vue b/src/views/pages/ScenarioExec.vue index c44f400..3461e99 100644 --- a/src/views/pages/ScenarioExec.vue +++ b/src/views/pages/ScenarioExec.vue @@ -560,7 +560,6 @@ if (scenario.value.inputs.some((input) => input.name === 'MultiFileUpload')) { }else{ console.log("Error in execution"); - } } @@ -895,7 +894,7 @@ const downloadZipFile = async (fileName) => { function downloadFile() { try { // Converti la stringa base64 in un blob - const base64String = this.scenario_output; + const base64String = this.scenario_output.value; const byteCharacters = atob(base64String); const byteNumbers = Array.from(byteCharacters, char => char.charCodeAt(0)); const byteArray = new Uint8Array(byteNumbers); From 10c28cac0d28a326dab4bca92e6f7077844d990c Mon Sep 17 00:00:00 2001 From: Emanuele Ferrelli Date: Mon, 3 Mar 2025 12:20:49 +0100 Subject: [PATCH 2/2] Clean Canvas and resolve bug --- src/layout/AppProfileMenu.vue | 16 +- src/stores/ScenarioStore.js | 59 +- src/views/pages/ScenarioExec.vue | 1105 ++++++++--------- src/views/pages/ScenarioList.vue | 4 +- src/views/pages/canvas/MdCanvas.vue | 71 +- .../canvas/MdScenarioExecutionDialog.vue | 782 +++++++++++- 6 files changed, 1322 insertions(+), 715 deletions(-) diff --git a/src/layout/AppProfileMenu.vue b/src/layout/AppProfileMenu.vue index d3e347b..5b7facb 100644 --- a/src/layout/AppProfileMenu.vue +++ b/src/layout/AppProfileMenu.vue @@ -6,7 +6,9 @@ {{ user.name + " " + user.surname }} - + + + @@ -16,14 +18,26 @@ import { useAuth } from '@websanova/vue-auth/src/v3.js'; import { computed } from 'vue'; import { useRouter } from 'vue-router'; +import { ScenarioStore } from '@/stores/ScenarioStore'; const auth = useAuth(); const user = computed(() => auth.user()); const router = useRouter(); +const scenario_store = ScenarioStore(); + function redirectProject() { router.push('/projects'); // Specifica il percorso per la pagina "Projects" } +function logout() { + auth.logout().then(() => { + scenario_store.resetStore(); + router.push('/auth/login'); + }).catch(err => { + console.error("Errore durante il logout:", err); + }); +} + diff --git a/src/stores/ScenarioStore.js b/src/stores/ScenarioStore.js index aa0c9e4..44d2565 100644 --- a/src/stores/ScenarioStore.js +++ b/src/stores/ScenarioStore.js @@ -6,7 +6,6 @@ import { UserPrefStore } from './UserPrefStore' export const ScenarioStore = defineStore('scenario_store', () => { - const projectScenarios = ref([]) const globalScenarios = ref([]) const applicationScenarios = ref([]) @@ -18,7 +17,6 @@ export const ScenarioStore = defineStore('scenario_store', () => { const userPrefStore = UserPrefStore() const loadingStore = LoadingStore() - async function fetchScenarios() { loadingStore.scenario_loading = true; await ScenarioService.getScenariosProject(userPrefStore.selectedProject).then(resp => { @@ -26,7 +24,6 @@ export const ScenarioStore = defineStore('scenario_store', () => { allScenarios.value = [...projectScenarios.value] loadingStore.scenario_loading = false; }); - } async function fetchScenariosForRE() { @@ -35,7 +32,6 @@ export const ScenarioStore = defineStore('scenario_store', () => { scenariosForRE.value = resp.data; loadingStore.scenario_loading = false; }); - } async function fetchScenariosCross() { @@ -45,19 +41,16 @@ export const ScenarioStore = defineStore('scenario_store', () => { allScenarios.value = [...globalScenarios.value] loadingStore.scenario_loading = false; }); - } - async function fetchApplicationScenarios() { loadingStore.scenario_loading = true; - console.log("fetchApplicationScenarios >= selectedApp", userPrefStore.selectedApp) ; - await ScenarioService.getScenariosApplication(userPrefStore.selectedApp).then(resp=>{ + console.log("fetchApplicationScenarios >= selectedApp", userPrefStore.selectedApp); + await ScenarioService.getScenariosApplication(userPrefStore.selectedApp).then(resp => { console.log("response scenari", resp); applicationScenarios.value = resp.data allScenarios.value = [...projectScenarios.value, ...applicationScenarios.value] loadingStore.scenario_loading = false; - }) } @@ -65,7 +58,6 @@ export const ScenarioStore = defineStore('scenario_store', () => { return allScenarios.value }) - const filteredScenarios = computed(() => { console.log("scenarios", allScenarios.value); var filteredScenario = [] @@ -91,12 +83,43 @@ export const ScenarioStore = defineStore('scenario_store', () => { }); }) + const filteredScenariosCanvas = computed(() => { + console.log("scenarios", allScenarios.value); + var filteredScenario = [] - return {filteredScenarios, - projectScenarios, - applicationScenarios, - fetchScenarios, - fetchApplicationScenarios, - scenarios, - filterString , typeFilter, fetchScenariosCross, globalScenarios, fetchScenariosForRE, scenariosForRE} - }) \ No newline at end of file + if(userPrefStore.getSelApp != null) { + filteredScenario = [...globalScenarios.value,...projectScenarios.value, ...applicationScenarios.value] + } else { + filteredScenario = [...globalScenarios.value,...projectScenarios.value] + } + + return filteredScenario + }) + + function resetStore() { + projectScenarios.value = [] + globalScenarios.value = [] + applicationScenarios.value = [] + filterString.value = '' + allScenarios.value = [] + typeFilter.value = { name: 'All', value: 'all' } + scenariosForRE.value = [] + } + + return { + filteredScenarios, + filteredScenariosCanvas, + projectScenarios, + applicationScenarios, + fetchScenarios, + fetchApplicationScenarios, + scenarios, + filterString, + typeFilter, + fetchScenariosCross, + globalScenarios, + fetchScenariosForRE, + scenariosForRE, + resetStore + } +}) \ No newline at end of file diff --git a/src/views/pages/ScenarioExec.vue b/src/views/pages/ScenarioExec.vue index 3461e99..39d70b1 100644 --- a/src/views/pages/ScenarioExec.vue +++ b/src/views/pages/ScenarioExec.vue @@ -1,262 +1,199 @@