diff --git a/src/router/index.js b/src/router/index.js index 46b9299..b760468 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -29,10 +29,16 @@ const router = createRouter({ path: 'exec/:id', name: 'scenario-exec', component: () => import('@/views/pages/ScenarioExec.vue') - },{ + }, + { + path: 'exec-history', + name: 'scenario-exec-history', + component: () => import('@/views/pages/OldScenarioExec.vue') + }, + { path: '/executions', name: 'executions', - component: () => import('@/views/pages/OldScenarioExec.vue') + component: () => import('@/views/pages/ScenarioExecList.vue') }, { path: '/canvas', diff --git a/src/service/ScenarioService.js b/src/service/ScenarioService.js index 52ba0c8..24eba36 100644 --- a/src/service/ScenarioService.js +++ b/src/service/ScenarioService.js @@ -17,5 +17,9 @@ export const ScenarioService = { return axios.get('/scenariosCross') }, + getExecScenariosByUser() { + return axios.get('/scenariosByUser') + + } } \ No newline at end of file diff --git a/src/stores/ScenarioExecutionStore.js b/src/stores/ScenarioExecutionStore.js new file mode 100644 index 0000000..c050058 --- /dev/null +++ b/src/stores/ScenarioExecutionStore.js @@ -0,0 +1,36 @@ +import { defineStore } from 'pinia'; +import { computed, ref } from 'vue'; +import { ScenarioService } from '../service/ScenarioService'; +import { LoadingStore } from './LoadingStore'; + + +export const ScenarioExecutionStore = defineStore('scenario_execution_store', () => { + + const lstScenarioExecution = ref([]) + const selectedExecScenario = ref(null) + const loadingStore = LoadingStore() + + + async function fetchScenariosExecution() { + loadingStore.scenario_loading = true; + await ScenarioService.getExecScenariosByUser().then(resp => { + lstScenarioExecution.value = resp.data; + loadingStore.scenario_loading = false; + }); + + } + const scenariosExecution = computed(() => { + return lstScenarioExecution.value + }) + + const getSelectedExecScenario = computed(() => { + return selectedExecScenario.value + }) + + async function setSelectedExecScenario(execScenario){ + selectedExecScenario.value = execScenario + console.log("selectedExecScenario", selectedExecScenario.value); + } + + return { fetchScenariosExecution, selectedExecScenario, lstScenarioExecution, scenariosExecution, getSelectedExecScenario, setSelectedExecScenario} + }) \ No newline at end of file diff --git a/src/views/pages/OldScenarioExec.vue b/src/views/pages/OldScenarioExec.vue index 197175b..1ed6ba6 100644 --- a/src/views/pages/OldScenarioExec.vue +++ b/src/views/pages/OldScenarioExec.vue @@ -5,30 +5,15 @@