Created
February 12, 2025 15:58
-
-
Save dannon/e15cfbc64eabe9ea8940d3e7300191ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit fcea1f489cced844d37c0de66d492a83c19025c3 | |
Author: Dannon Baker <[email protected]> | |
Date: Thu Feb 6 11:46:09 2025 -0500 | |
Add activity panel closure on route navigation to workflow landing | |
diff --git a/client/src/entry/analysis/router.js b/client/src/entry/analysis/router.js | |
index 033b70136c..edca96224a 100644 | |
--- a/client/src/entry/analysis/router.js | |
+++ b/client/src/entry/analysis/router.js | |
@@ -54,6 +54,7 @@ import AdminRoutes from "entry/analysis/routes/admin-routes"; | |
import LibraryRoutes from "entry/analysis/routes/library-routes"; | |
import StorageDashboardRoutes from "entry/analysis/routes/storageDashboardRoutes"; | |
import { getAppRoot } from "onload/loadConfig"; | |
+import { PiniaVuePlugin } from "pinia"; | |
import Vue from "vue"; | |
import VueRouter from "vue-router"; | |
@@ -62,6 +63,7 @@ import CreateFileSourceInstance from "@/components/FileSources/Instances/CreateI | |
import GridHistory from "@/components/Grid/GridHistory"; | |
import GridPage from "@/components/Grid/GridPage"; | |
import CreateObjectStoreInstance from "@/components/ObjectStore/Instances/CreateInstance"; | |
+import { useActivityStore } from "@/stores/activityStore"; | |
import { parseBool } from "@/utils/utils"; | |
import { patchRouterPush } from "./router-push"; | |
@@ -87,6 +89,8 @@ import WorkflowPublished from "@/components/Workflow/Published/WorkflowPublished | |
import WorkflowInvocationState from "@/components/WorkflowInvocationState/WorkflowInvocationState.vue"; | |
Vue.use(VueRouter); | |
+// Load Pinia | |
+// Vue.use(PiniaVuePlugin); | |
// patches $router.push() to trigger an event and hide duplication warnings | |
patchRouterPush(VueRouter); | |
@@ -517,6 +521,17 @@ export function getRouter(Galaxy) { | |
{ | |
path: "workflow_landings/:uuid", | |
component: WorkflowLanding, | |
+ // On this route, we close any open activity panel | |
+ beforeEnter: (to, from, next) => { | |
+ // We currently only use the default activity store for routing concerns. | |
+ // We only want to touch the activity store from a route navigation context here | |
+ const activityStore = useActivityStore("default"); | |
+ // Toggle the sidebar to close | |
+ console.debug("Closing activity panel"); | |
+ activityStore.toggleSideBar(""); | |
+ activityStore.closeSideBar(); | |
+ next(); | |
+ }, | |
props: (route) => ({ | |
uuid: route.params.uuid, | |
public: route.query.public.toLowerCase() === "true", | |
commit 619b1b2b07be6bd8537664e8b9382d736e01ca5f | |
Author: Dannon Baker <[email protected]> | |
Date: Thu Feb 6 11:36:35 2025 -0500 | |
Add explicit close state for sidebar -- an alternative to this would be a separate boolean but that has different complications (intentionally retaining state of the last selected bar vs when we want to dump it, etc) | |
diff --git a/client/src/stores/activityStore.ts b/client/src/stores/activityStore.ts | |
index 4ab0c9cad1..f7fad52718 100644 | |
--- a/client/src/stores/activityStore.ts | |
+++ b/client/src/stores/activityStore.ts | |
@@ -68,6 +68,10 @@ export const useActivityStore = defineScopedStore("activityStore", (scope) => { | |
toggledSideBar.value = toggledSideBar.value === currentOpen ? "" : currentOpen; | |
} | |
+ function closeSideBar() { | |
+ toggledSideBar.value = "closed"; | |
+ } | |
+ | |
function overrideDefaultActivities(activities: Activity[]) { | |
customDefaultActivities.value = activities; | |
sync(); | |
@@ -197,6 +201,8 @@ export const useActivityStore = defineScopedStore("activityStore", (scope) => { | |
return { | |
toggledSideBar, | |
toggleSideBar, | |
+ closeSideBar, | |
+ isSideBarOpen, | |
activities, | |
activityMeta, | |
metaForId, | |
commit 4e62c954c375984e89541bdffb10938a47da8318 | |
Author: Dannon Baker <[email protected]> | |
Date: Thu Feb 6 11:32:16 2025 -0500 | |
Refactor to shift isSideBarOpen helper computed to activityStore for | |
central state management. | |
diff --git a/client/src/components/ActivityBar/ActivityBar.vue b/client/src/components/ActivityBar/ActivityBar.vue | |
index dd2f0bbffc..d6c727e2b9 100644 | |
--- a/client/src/components/ActivityBar/ActivityBar.vue | |
+++ b/client/src/components/ActivityBar/ActivityBar.vue | |
@@ -89,7 +89,7 @@ const emit = defineEmits<{ | |
}>(); | |
// activities from store | |
-const { activities } = storeToRefs(activityStore); | |
+const { activities, isSideBarOpen } = storeToRefs(activityStore); | |
// drag references | |
const dragTarget: Ref<EventTarget | null> = ref(null); | |
@@ -112,8 +112,6 @@ function isActiveSideBar(menuKey: string) { | |
return activityStore.toggledSideBar === menuKey; | |
} | |
-const isSideBarOpen = computed(() => activityStore.toggledSideBar !== ""); | |
- | |
/** | |
* Checks if an activity that has a panel should have the `is-active` prop | |
*/ | |
diff --git a/client/src/stores/activityStore.ts b/client/src/stores/activityStore.ts | |
index b74a66286f..4ab0c9cad1 100644 | |
--- a/client/src/stores/activityStore.ts | |
+++ b/client/src/stores/activityStore.ts | |
@@ -60,6 +60,7 @@ export const useActivityStore = defineScopedStore("activityStore", (scope) => { | |
const customDefaultActivities = ref<Activity[] | null>(null); | |
const currentDefaultActivities = computed(() => customDefaultActivities.value ?? defaultActivities); | |
+ const isSideBarOpen = computed(() => toggledSideBar.value !== "" && toggledSideBar.value !== "closed"); | |
const toggledSideBar = useUserLocalStorage(`activity-store-current-side-bar-${scope}`, "tools"); | |
@@ -130,7 +131,7 @@ export const useActivityStore = defineScopedStore("activityStore", (scope) => { | |
activities.value = newActivities; | |
// if toggled side-bar does not exist, choose the first option | |
- if (toggledSideBar.value !== "") { | |
+ if (isSideBarOpen.value) { | |
const allSideBars = activities.value.flatMap((activity) => { | |
if (activity.panel) { | |
return [activity.id]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment