From 42bfe0d3cbcc842c2501329d20e661610579776a Mon Sep 17 00:00:00 2001 From: Emanuele Ferrelli Date: Tue, 26 Nov 2024 12:02:07 +0100 Subject: [PATCH] cleared execution data after changing a scenario, added logic to change scenario execution from url --- src/views/pages/OldScenarioExec.vue | 30 +++++++++++++++++++++++----- src/views/pages/ScenarioExec.vue | 2 ++ src/views/pages/ScenarioExecList.vue | 16 +++++++-------- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/views/pages/OldScenarioExec.vue b/src/views/pages/OldScenarioExec.vue index 397e8f8..58b9020 100644 --- a/src/views/pages/OldScenarioExec.vue +++ b/src/views/pages/OldScenarioExec.vue @@ -23,7 +23,7 @@ + +
+
+
+ {{ index.replace(/_/g, ' ').replace(/\b\w/g, char => char.toUpperCase()) }}: + {{ input }} +
+
+
-
+
@@ -82,12 +91,22 @@ const exec_id = ref(null); const exec_scenario = ref({}); const debug_modal = ref(false); const scenario_execution_store = ScenarioExecutionStore(); -const execution_id = scenario_execution_store.getSelectedExecScenario; +const execution = scenario_execution_store.getSelectedExecScenario; +const execution_id = ref(null) +const inputs = ref(null); onMounted(() => { - console.log("scenario id: ", execution_id.id); - retrieveScenarioExec(execution_id.id) + if (execution){ + console.log("scenario id: ", execution); + execution_id.value = execution.id + console.log("execution_id: ",execution_id) + }else{ + const url = window.location.href; + execution_id.value = (new URL(url)).searchParams.get('id') + console.log(execution_id.value) + } + retrieveScenarioExec(execution_id.value) }); const retrieveScenarioExec = (id) => { @@ -102,6 +121,7 @@ const retrieveScenarioExec = (id) => { data_loaded.value = true; scenario_output.value = response.data.execSharedMap.scenario_output; exec_id.value = response.data.scenarioExecution_id + inputs.value = response.data.scenarioExecutionInput.inputs }); }; diff --git a/src/views/pages/ScenarioExec.vue b/src/views/pages/ScenarioExec.vue index ec438d1..0acbf5b 100644 --- a/src/views/pages/ScenarioExec.vue +++ b/src/views/pages/ScenarioExec.vue @@ -178,6 +178,8 @@ watch(() => route.params.id, fetchScenario); //Function to fetch scenarios function fetchScenario(id) { + data_loaded.value = false; + formData.value = {}; loading.value = true; axios.get(`/scenarios/${id}`) .then(response => { diff --git a/src/views/pages/ScenarioExecList.vue b/src/views/pages/ScenarioExecList.vue index f439eaa..45579c7 100644 --- a/src/views/pages/ScenarioExecList.vue +++ b/src/views/pages/ScenarioExecList.vue @@ -2,9 +2,9 @@
-
-
- -
+ +
-->

Executions List

- - +