Refactor AppMenu and AppTopbar components
- Updated the AppMenu component to only add available scenarios to the menu if there are any. - Refactored the AppTopbar component to use the selectedApp value from the UserPrefStore. - Added an updateApplication function to update the selectedApp value in the UserPrefStore and fetch the application scenarios. - Created a watcher to update the selectedApp value when it changes in the UserPrefStore. Fix axios base URL configuration - Updated the axios base URL configuration in the main.js file to use a hardcoded URL instead of the VITE_BACKEND_URL environment variable. Update ProjectService and UserPrefStore - Added an updateSelectedApplication function to the ProjectService to update the selected application. - Updated the UserPrefStore to fetch the selected application from the user data and set it as the selectedApp value. - Added a setSelectedApp function to the UserPrefStore to update the selectedApp value and call the updateSelectedApplication function. Update ScenarioStore - Updated the fetchApplicationScenarios function in the ScenarioStore to use the selectedApp value from the UserPrefStore when fetching scenarios. Remove unused components - Removed the Empty, SeatDemo, PersonalDemo, PaymentDemo, ConfirmationDemo, TreeDoc, and FileDoc components from the project. Fix menu typo - Fixed a typo in the menu component. Revert changes for Canva - Reverted the changes made for Canva. Merge branch 'master' of https://gitlab.gcp.windtre.it/olympus_ai/hermione-fe - Merged the changes from the master branch of the remote repository.
This commit is contained in:
@@ -7,8 +7,6 @@ import AppMenuItem from './AppMenuItem.vue';
|
|||||||
const userPrefStore = UserPrefStore();
|
const userPrefStore = UserPrefStore();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const model = ref([
|
const model = ref([
|
||||||
{
|
{
|
||||||
label: '',
|
label: '',
|
||||||
@@ -41,9 +39,12 @@ function updateApplicationsMenu() {
|
|||||||
{ label: 'Rev Eng Code', icon: 'pi pi-fw pi-id-card', to: '/app-browser' }
|
{ label: 'Rev Eng Code', icon: 'pi pi-fw pi-id-card', to: '/app-browser' }
|
||||||
];
|
];
|
||||||
|
|
||||||
selectedApp.available_scenarios.forEach(app => {
|
if( selectedApp.available_scenarios.length > 0) {
|
||||||
model.value[0].items.push({ label: app.label, icon: 'pi pi-fw pi-id-card', to: `/scenario/exec/${app.scenario_id}` });
|
selectedApp.available_scenarios.forEach(app => {
|
||||||
});
|
model.value[0].items.push({ label: app.label, icon: 'pi pi-fw pi-id-card', to: `/scenario/exec/${app.scenario_id}` });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Se selectedApp è nullo, svuota gli item
|
// Se selectedApp è nullo, svuota gli item
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import { LoadingStore } from '../stores/LoadingStore.js';
|
|||||||
import { ScenarioStore } from '../stores/ScenarioStore.js';
|
import { ScenarioStore } from '../stores/ScenarioStore.js';
|
||||||
import { UserPrefStore } from '../stores/UserPrefStore.js';
|
import { UserPrefStore } from '../stores/UserPrefStore.js';
|
||||||
|
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import AppConfigurator from './AppConfigurator.vue';
|
import AppConfigurator from './AppConfigurator.vue';
|
||||||
import AppProfileMenu from './AppProfileMenu.vue';
|
import AppProfileMenu from './AppProfileMenu.vue';
|
||||||
|
|
||||||
|
|
||||||
const auth = useAuth();
|
const auth = useAuth();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
@@ -23,8 +23,23 @@ const userPrefStore = UserPrefStore();
|
|||||||
const scenario_store = ScenarioStore();
|
const scenario_store = ScenarioStore();
|
||||||
const loadingStore = LoadingStore()
|
const loadingStore = LoadingStore()
|
||||||
|
|
||||||
|
|
||||||
|
const selectedApp = ref(userPrefStore.getSelApp);
|
||||||
|
|
||||||
const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout();
|
const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout();
|
||||||
|
|
||||||
|
async function updateApplication() {
|
||||||
|
await userPrefStore.setSelectedApp(selectedApp.value);
|
||||||
|
|
||||||
|
scenario_store.fetchApplicationScenarios();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function appUpdated() {
|
||||||
|
selectedApp.value = userPrefStore.getSelApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => userPrefStore.getSelApp, appUpdated, { immediate: true });
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -85,12 +100,12 @@ const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dropdown
|
<Dropdown
|
||||||
v-model="userPrefStore.selectedApp"
|
v-model="selectedApp"
|
||||||
:options="userPrefStore.availableApp"
|
:options="userPrefStore.availableApp"
|
||||||
optionLabel="fe_name"
|
optionLabel="fe_name"
|
||||||
placeholder="Select an Option"
|
placeholder="Select an Option"
|
||||||
class="dropdown-list"
|
class="dropdown-list"
|
||||||
@change="scenario_store.fetchApplicationScenarios()"
|
@change="updateApplication()"
|
||||||
:disabled="route.path === '/projects'"
|
:disabled="route.path === '/projects'"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ var auth = createAuth({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
axios.defaults.baseURL = import.meta.env.VITE_BACKEND_URL;//'http://localhost:8081'
|
axios.defaults.baseURL = 'http://localhost:8081'///import.meta.env.VITE_BACKEND_URL;//
|
||||||
console.log(import.meta.env.VITE_BACKEND_URL);
|
console.log(import.meta.env.VITE_BACKEND_URL);
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ export const ProjectService = {
|
|||||||
return axios.post('/updateSelectedProject', data)
|
return axios.post('/updateSelectedProject', data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
updateSelectedApplication(data) {
|
||||||
|
return axios.post('/updateSelectedApplication', data)
|
||||||
|
}
|
||||||
|
|
||||||
/* {
|
/* {
|
||||||
projectName: selectedProjectName
|
projectName: selectedProjectName
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ export const ScenarioStore = defineStore('scenario_store', () => {
|
|||||||
|
|
||||||
async function fetchApplicationScenarios() {
|
async function fetchApplicationScenarios() {
|
||||||
loadingStore.scenario_loading = true;
|
loadingStore.scenario_loading = true;
|
||||||
|
console.log("fetchApplicationScenarios >= selectedApp", userPrefStore.selectedApp) ;
|
||||||
await ScenarioService.getScenariosApplication(userPrefStore.selectedApp).then(resp=>{
|
await ScenarioService.getScenariosApplication(userPrefStore.selectedApp).then(resp=>{
|
||||||
console.log("response scenari", resp);
|
console.log("response scenari", resp);
|
||||||
applicationScenarios.value = resp.data
|
applicationScenarios.value = resp.data
|
||||||
allScenarios.value = [...projectScenarios.value, ...applicationScenarios.value]
|
allScenarios.value = [...projectScenarios.value, ...applicationScenarios.value]
|
||||||
loadingStore.scenario_loading = false;
|
loadingStore.scenario_loading = false;
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export const UserPrefStore = defineStore('userpref_store', () => {
|
|||||||
loadingStore.user_loading = true;
|
loadingStore.user_loading = true;
|
||||||
await auth.fetch().then((fetchedUser) => {
|
await auth.fetch().then((fetchedUser) => {
|
||||||
user.value = fetchedUser.data.data;
|
user.value = fetchedUser.data.data;
|
||||||
|
selectedApp.value = user.value.selectedApplication;
|
||||||
userLoaded.value = true;
|
userLoaded.value = true;
|
||||||
loadingStore.user_loading = false;
|
loadingStore.user_loading = false;
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
@@ -29,11 +30,8 @@ export const UserPrefStore = defineStore('userpref_store', () => {
|
|||||||
try {
|
try {
|
||||||
loadingStore.user_loading = true;
|
loadingStore.user_loading = true;
|
||||||
selectedApp.value = null;
|
selectedApp.value = null;
|
||||||
|
|
||||||
// Aspetta che l'aggiornamento del progetto finisca
|
// Aspetta che l'aggiornamento del progetto finisca
|
||||||
await ProjectService.updateSelectedProject(project);
|
await ProjectService.updateSelectedProject(project);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore durante l'aggiornamento del progetto:", error);
|
console.error("Errore durante l'aggiornamento del progetto:", error);
|
||||||
@@ -46,8 +44,11 @@ export const UserPrefStore = defineStore('userpref_store', () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function setSelectedApp(app){
|
async function setSelectedApp(app){
|
||||||
|
loadingStore.user_loading = true;
|
||||||
|
await ProjectService.updateSelectedApplication(app);
|
||||||
selectedApp.value = app;
|
selectedApp.value = app;
|
||||||
|
loadingStore.user_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedProject = computed(() => user.value.selectedProject)
|
const selectedProject = computed(() => user.value.selectedProject)
|
||||||
|
|||||||
Reference in New Issue
Block a user