Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tab switching (preserve tab layout, configure defaults & share links) #662

Closed
oliver-sanders opened this issue May 4, 2021 · 11 comments
Closed

Comments

@oliver-sanders
Copy link
Member

oliver-sanders commented May 4, 2021

Note

Definition: "Workspace"

The part of the UI within the Lumino instance. Basically everything that isn't GScan in the "default" view.

A workspace could be for:

  • An installed workflow (only workspace implemented at the moment).
  • A source workflow (soon).
  • The user dashboard (one day).

The aims the GScan tabbing system are:

  • To simplify workspace selection/switching.
  • To make the user's workflow between configuring > running > reviewing easy.
  • To make it easy to work in a single browser tab.

Here are four steps to achieve these goals in order of priority.

  1. Allow the current tab layout to be saved (urgent).
  2. Save the layout last used by a workspace (important). Save & restore workspace layout on navigation #1664
    • When the user navigates away from a workflow, save the tab layout.
    • When the user navigates back to the workflow, load the tab layout.
    • When the user navigates to a new run of the same workflow, copy the layout from the last run of the workflow.
  3. Save view state (useful). In progress
    • Some aspects of the view state should be preserved with the layout.
    • E.G. Any task state filters should be preserved.
    • E.G. The "log" view should remember what log file it is looking at.
    • These things need to be saved as part of the layout information so that we can re-open the layout as it was before.
  4. Named layouts (nice-to-have).
    • Allow users to save "named" layouts.
    • Allow users to re-configure the workspace to a previously saved layout.
@oliver-sanders
Copy link
Member Author

Long run we should provide:

  • A way to "save" the current layout.
  • A mechanism for dumping the view's data into the layout (e.g. if the view is filtered by task state, that should be included in the layout)
  • A way to "load" a pre-saved layout.
  • A configuration for setting the default layout.
  • Possibly an additional configuration on each layout to allow setting it as the default layout based on the workflow hierarchy?

E.G. A layout menu icon which provides a "save current layout" button and lists all pre-saved layouts for quick switching.

@oliver-sanders oliver-sanders modified the milestones: 2.0.0, Pending Jun 8, 2022
@MetRonnie
Copy link
Member

IMO we should split the "Serialise lumino state into local storage" part off into a 1.4.0 issue?

@oliver-sanders oliver-sanders modified the milestones: Pending, 1.x Aug 11, 2022
@oliver-sanders
Copy link
Member Author

For view state (i.e. options like filtering set by the user in the view), I suggest we collect these options into a single objet in the component data () {}. E.G. this.options.taskFilters.

Then the serialisation bit can be done at a higher level, extracting them something like this.$refs[viewID].options.

View defaults (e.g. you might want new table views to open with some sort order pre-configured) could be provided to the view as a prop e.g. this.defaultOptions. We can use the #471 to make these editable in the UserProfile.

@oliver-sanders
Copy link
Member Author

oliver-sanders commented Nov 4, 2022

(assigning @AaronDCole as #1128 leads in this direction to avoid scope for duplication)

@oliver-sanders
Copy link
Member Author

See also #1090

@oliver-sanders
Copy link
Member Author

oliver-sanders commented Dec 21, 2022

Whilst digging through the Lumino source working on #1090 I found a saveLayout interface.

https://github.com/jupyterlab/lumino/blob/d51b0575c7797769af5a6aabed39500bd494a918/packages/widgets/src/docklayout.ts#L265

It has a restoreLayout counterpart too. To use these in the Lumino component we can do something like this:

diff --git a/src/components/cylc/workflow/Lumino.vue b/src/components/cylc/workflow/Lumino.vue
index 90f9bb1a..66441573 100644
--- a/src/components/cylc/workflow/Lumino.vue
+++ b/src/components/cylc/workflow/Lumino.vue
@@ -181,6 +181,14 @@ export default {
       // TODO: remove it if the linter is fixed later #510
       // eslint-disable-next-line vue/custom-event-name-casing
       this.$emit('lumino:deleted', customEvent.detail)
+    },
+
+    saveLayout () {
+      return this.dock.layout.saveLayout()
+    },
+
+    loadLayout (layout) {
+      return this.dock.layout.restoreLayout(layout)
     }
   }
 }

I haven't tried this out for real but it look promising. We should be able to dump this layout into browser LocalStorage for now. This would allow the default layout to be configurable.

We will require an extra step in the "Workflow Component" as we need to create the Vue components that fit into this layout, not sure how those two components will marry up at present. It might be worth looking at the JupyterLab source for inspiration.

@oliver-sanders oliver-sanders changed the title tab switching tab switching (preserve tab layout, configure defaults & share links) Apr 19, 2023
@oliver-sanders oliver-sanders modified the milestones: 2.x, Pending Apr 19, 2023
@MetRonnie MetRonnie modified the milestones: Pending, 2.x Jan 23, 2024
@MetRonnie
Copy link
Member

MetRonnie commented Jan 23, 2024

I've tried that out and it works just like what we want. Will need to figure out how to restore the Tree/Table/etc. views to the restored tabs, which will be empty otherwise.

demo13

https://lumino.readthedocs.io/en/latest/api/classes/widgets.DockPanel-1.html#layout

https://lumino.readthedocs.io/en/latest/api/classes/widgets.DockLayout-1.html

@oliver-sanders
Copy link
Member Author

Moved the remainder of point (1) to #1834

@oliver-sanders
Copy link
Member Author

Moved point (4) to #1835

@oliver-sanders
Copy link
Member Author

Added #1837 to capture preserving layouts between browser sessions.

@oliver-sanders
Copy link
Member Author

The remainder of this issue has now been split into #1834, #1835 and #1837. Closing this master issue.

See also #1836

@oliver-sanders oliver-sanders removed this from the 2.x milestone Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants