Skip to content

Commit

Permalink
chore: fixes bugs with auto switching of menu
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Jun 21, 2024
1 parent ae960ba commit 3d19870
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
12 changes: 4 additions & 8 deletions assets/components/HostMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,14 @@ const menuItems = computed(() => {
const route = useRoute("/container/[id]");
const updateHostForContainerRoute = (to: RouteLocationNormalizedLoaded) => {
if (to.name === "/container/[id]") {
const container = containerStore.findContainerById(to.params.id as string);
watchEffect(() => {
if (route.name === "/container/[id]") {
const container = containerStore.findContainerById(route.params.id);
if (container) {
setHost(container.host);
}
}
};
updateHostForContainerRoute(route);
onBeforeRouteUpdate((to) => updateHostForContainerRoute(to));
});
</script>
<style scoped lang="postcss">
.menu {
Expand Down
2 changes: 1 addition & 1 deletion assets/components/SideMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const showSwarm = useSessionStorage<boolean>("DOZZLE_SWARM_MODE", false);
onBeforeRouteLeave((to) => {
if (to.meta.swarmMode) {
showSwarm.value = true;
} else {
} else if (to.meta.containerMode) {
showSwarm.value = false;
}
});
Expand Down
4 changes: 4 additions & 0 deletions assets/pages/container/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ watchEffect(() => {
}
});
</script>
<route lang="yaml">
meta:
containerMode: true
</route>
4 changes: 4 additions & 0 deletions assets/pages/merged/[name].vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ watchEffect(() => {
}
});
</script>
<route lang="yaml">
meta:
containerMode: true
</route>

0 comments on commit 3d19870

Please sign in to comment.