From 1443fafb7bfa6aa408467f555bbaeac89df4cbca Mon Sep 17 00:00:00 2001 From: "Ferrelli, Emanuele" Date: Mon, 18 Nov 2024 16:50:56 +0000 Subject: [PATCH 1/2] added scroll for Tree --- src/views/pages/ApplicationBrowser.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/views/pages/ApplicationBrowser.vue b/src/views/pages/ApplicationBrowser.vue index 3300ef6..87f3e97 100644 --- a/src/views/pages/ApplicationBrowser.vue +++ b/src/views/pages/ApplicationBrowser.vue @@ -25,7 +25,7 @@ -
+
File Explorer

@@ -147,6 +147,15 @@ const skeletonConfigs = [ { width: "80%", height: "1.5rem" } ]; +watch(selectedFile, () => { + if (selectedFile.value) { + const cardFlowCodeViewer = document.getElementById('card-flow-codeviewer'); + if (cardFlowCodeViewer) { + window.scrollTo({ top: 0, behavior: 'smooth' }); + } + } +}); + From e9d55af49c68c8af81b3b6c447c597e27717d21f Mon Sep 17 00:00:00 2001 From: Emanuele Ferrelli Date: Mon, 18 Nov 2024 18:00:28 +0100 Subject: [PATCH 2/2] added scenario information for user while executing scenario --- src/views/pages/ScenarioExec.vue | 72 ++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/src/views/pages/ScenarioExec.vue b/src/views/pages/ScenarioExec.vue index d2e0e3b..abdc4e3 100644 --- a/src/views/pages/ScenarioExec.vue +++ b/src/views/pages/ScenarioExec.vue @@ -49,11 +49,21 @@

- -
- - +
+
+ +
+
+ {{ scenario_response_message.split('-').join(' ') }} +
+
+ Starting execution... +
+
+

Time elapsed: 

+
00:00
+
@@ -105,6 +115,7 @@ import InputText from 'primevue/inputtext'; import Select from 'primevue/select'; import Textarea from 'primevue/textarea'; import { computed, onMounted, ref, watch } from 'vue'; +import moment from 'moment'; import { useRoute, useRouter } from 'vue-router'; import { JellyfishLoader } from "vue3-spinner"; @@ -115,7 +126,9 @@ const router = useRouter(); const route = useRoute(); const value = ref(''); const scenario = ref({}); +const scenario_response = ref(null); const scenario_output = ref(null); +const scenario_response_message = ref(null); const loading = ref(false); const data_loaded = ref(false); const loading_data = ref(false); @@ -125,6 +138,22 @@ const exec_scenario = ref({}); const debug_modal = ref(false); let pollingInterval = null; +let startTime = ref(null); +let timerInterval = ref(null); + +function startTimer() { + startTime = Date.now(); + timerInterval = setInterval(() => { + const elapsedTime = moment.duration(Date.now() - startTime); + document.getElementById("timer").textContent = moment.utc(elapsedTime.asMilliseconds()).format("mm:ss"); + }, 1000); +} + +function stopTimer() { + clearInterval(timerInterval); +} + + const isInputFilled = computed(() => { var isFilled = true; if(scenario.value.inputs === undefined) { @@ -179,6 +208,7 @@ watch(() => route.params.id, fetchScenario); const execScenario = () => { loading_data.value = true; data_loaded.value = false; + startTimer(); loadingStore.exectuion_loading = true; @@ -189,15 +219,17 @@ watch(() => route.params.id, fetchScenario); axios.post('/scenarios/execute-async', data) .then(response => { + scenario_response.value = response.data; + scenario_response_message.value = response.data.message; scenario_output.value = response.data.stringOutput; exec_id.value = response.data.scenarioExecution_id + // Start polling startPolling(); }) .catch(error => { console.error('Error executing scenario:', error); loadingStore.exectuion_loading = false; - }); }; @@ -216,25 +248,29 @@ watch(() => route.params.id, fetchScenario); const pollBackendAPI = () => { -axios.get('/scenarios/getExecutionProgress/'+exec_id.value).then(response => { - if (response.data.status == 'OK' || response.data.status == 'ERROR') { - console.log("Condition met, stopping polling."); - stopPolling(); + axios.get('/scenarios/getExecutionProgress/'+exec_id.value).then(response => { + if (response.data.status == 'OK' || response.data.status == 'ERROR') { + console.log("Condition met, stopping polling."); + stopPolling(); - loading_data.value = false; - data_loaded.value = true; - scenario_output.value = response.data.stringOutput; - exec_id.value = response.data.scenarioExecution_id + stopTimer(); + loading_data.value = false; + data_loaded.value = true; + scenario_output.value = response.data.stringOutput; + exec_id.value = response.data.scenarioExecution_id + scenario_response_message.value = null //if != null, next scenario starts with old message - } else { - console.log("Condition not met, polling continues."); + } else { + console.log("Condition not met, polling continues."); + scenario_response.value = response.data; + scenario_response_message.value = response.data.message; + } + }); } -}); -} // Function to start polling function startPolling() { - // Set polling interval (every 5 seconds in this case) + // Set polling interval (every 2.5 seconds in this case) pollingInterval = setInterval(pollBackendAPI, 2500); console.log("Polling started."); }