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

Create Workflow component with Lumino #325

Merged
merged 17 commits into from
Jan 14, 2020
Merged

Conversation

kinow
Copy link
Member

@kinow kinow commented Dec 6, 2019

These changes close #90, and close #323

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Appropriate tests are included (unit and/or functional).
  • Appropriate change log entry included.
  • No documentation update required.

@kinow kinow added this to the 0.2 milestone Dec 6, 2019
@kinow kinow self-assigned this Dec 6, 2019
@kinow
Copy link
Member Author

kinow commented Dec 6, 2019

I was just going to get my toes wet learning Lumino, then when I realized it wasn't really hard decided to start digging in the TypeScript code (no docs) and examples. Tried to match as much as possible the design sketch.

There are some limitations to how much we can tweak due to the way it builds screens with multiple widgets, each having some logic to decide the height/width. For instance, I wanted to increase font size and give it more space (padding/margins) to the tabs, but this is quite complicated without docs/examples.

One major issue now is reactivity. I am attaching the Vue component, and destroying it (I think, hard to spot the exact object in the browser memory, but will confirm later). But the component is not being updated. i.e., here's what it looks like at the moment:

image

So each time I add a new Tree component, it picks up the current workflow status, then freezes. Not being updated even though Vuex data is still changing. So I've got to sort this out before this is ready for review.

Then need to check which commits need to be squashed, check if it's possible to add any tests (don't think so at this stage), add the changelog, and it should be ready for review 🎊

@kinow
Copy link
Member Author

kinow commented Dec 6, 2019

Also, almost forgot, not sure if we can use the Graph component. In order to add the Graph here, we must be able to create the Graph component programmatically.

If the Graph component (not the view) depends on VueRouter, extra objects, or if we are not able to create multiple instances of the Graph component, then we will need to refine the component code. But once that's done, adding a new Graph Widget (Lumino layout uses widgets, not components) shouldn't be too hard (<1 day work, couple hours perhaps or less).

@kinow
Copy link
Member Author

kinow commented Dec 6, 2019

Eureka moment going for a walk. Insteas of creatijg a new tree component myself, it should be possible to instead simply add some value to an array, then use a v-for to get vue to create the component for me.

May have to hide the component, or find a way to tell vue where it should go in the dom tho. But a possible fix for reactivity.

@kinow
Copy link
Member Author

kinow commented Dec 6, 2019

Came back from NIWA x-mas function and had to finish it otherwise I wouldn't be able to enjoy the weekend 😄

GIFrecord_2019-12-07_013024

Next week will review the commits, add changelog, and then wait until @oliver-sanders or somebody else has time to review the current draft, before adding any more code. But so far, I'm really happy with Lumino 👍

@hjoliver
Copy link
Member

hjoliver commented Dec 8, 2019

That looks brilliant, well done 💐

@kinow kinow marked this pull request as ready for review December 8, 2019 21:33
@kinow
Copy link
Member Author

kinow commented Dec 8, 2019

Ready for review. Will try to add a few unit tests, but that shouldn't alter the current code, so happy to take any reviews.

The last commit alters the Graph component. I changed as little as I could to get it working as a Lumino widget, and as a standalone Vue component. Tested the existing Graph view, and it appears to be working fine, but better if reviewers can check it too.

Tested with latest Chrome/Ffox on Ubuntu LTS, and IE Edge on Win10Pro. Here's what it should look like:

GIFrecord_2019-12-09_103557

A few known issues:

  • Adding two graphs, only one is updated

image

  • Adding graphs only works on Chrome and Ffox, IE almost works. In IE, I can see the graph in the mini-screen at the bottom right, but not in the main graph area

image

  • There is an increase in memory usage. We will need to keep refining the code incrementally later.
  • Occasionally, you may see an error in the console saying something like "Cannot access name of undefined", this is caused by families and tasks not matching in the returned GraphQL data. I will need to isolate the issue, reproduce, and create an issue either in Cylc UI or in Cylc UI Server to handle that.

image

The issues above are not blockers IMO, as they are not directly caused by the new Workflow component.

@kinow
Copy link
Member Author

kinow commented Dec 8, 2019

NB: No CI on this PR as #324 is still pending review 👍 but just ran lint/tests/build locally and it worked fine on my environment.

@kinow
Copy link
Member Author

kinow commented Dec 9, 2019

Unit tests added, change log too. Commits are as organized as I could, without re-writing code. They are more or less grouped, there some CSS/style commits that could have been grouped together but I worked on separate parts of the code while trying to integrate Lumino, sometimes on the JS part, sometimes on the CSS.

Tested again on Ffox/Chrome. Ran the CI commands locally and everything passed. The CI passed on my repository when I pushed it, so it's possible to confirm it should have passed here too: https://github.com/kinow/cylc-ui/actions (only not running because we need #324 in order to trigger the action on pull requests and on push).

Coverage is not being uploaded in the action. It will reduce, probably, as we have some code for a view added here that is not being tested, only the component is. Will fix the coverage in another PR.

@oliver-sanders
Copy link
Member

Nice!

This is one of those really big things which brings the goal into closer view.

Few niggles:

  • I've got a font issue on the close icons:
    Screenshot from 2019-12-10 13-35-09
  • The graph view currently isn't showing anything for me (no console traceback).
  • Resizing doesn't seem to work.

@kinow
Copy link
Member Author

kinow commented Dec 10, 2019

I've got a font issue on the close icons:

Ah, good to know. I chose a special character for the X close button, but should have done the simple first. I'm pushing one commit to use a simple letter X now.

The graph view currently isn't showing anything for me (no console traceback).

Maybe if you try on a different browser. Though I am afraid the graph component needs a few more changes in order to be used as a widget with lumino (and we need to run a few more tests with cytoscape/etc, as IE Edge is not working, though I believe I've used Cytoscape apps with IE before)

Resizing doesn't seem to work.

This is a bit tricky with lumino. If you position two widgets side by side, then you should be able to resize their width, respecting a minimum-width that I set (otherwise when opening on mobile or smaller screens you wouldn't see the widget content.

But as for height, the hard limit is the screen size I think. Initially I don't set a height for lumino widgets. I set a min-height, and then it computes the widget height. I couldn't pinpoint exactly where they are doing that in their TypeScript code... but the best I could do was to change the height of the content div to occupy as much as possible (see screenshot below) and also define a min-height.

image

(content is the whole area, which includes the toolbar and the workflow area, as well as footer, that's why it has 100 height of viewport)

@oliver-sanders
Copy link
Member

This is a bit tricky with lumino

Sorry, I meant resizing the "panes" within Lumino by hovering over the gap between panes until you get the arrow icon, then using click+drag.

@kinow
Copy link
Member Author

kinow commented Dec 10, 2019

This is a bit tricky with lumino

Sorry, I meant resizing the "panes" within Lumino by hovering over the gap between panes until you get the arrow icon, then using click+drag.

Ah, if that's working in JupyterLab maybe we can copy it from there. I used their examples to implement this PR. Here's how it works in one of their examples.

GIFrecord_2019-12-10_135806

It should be working similarly in this PR.

@kinow
Copy link
Member Author

kinow commented Dec 17, 2019

Will try to fix the conflicts here today.

@kinow
Copy link
Member Author

kinow commented Dec 17, 2019

Will fix conflicts here after #199 and #280 👍

@kinow kinow force-pushed the try-lumino branch 2 times, most recently from 338e29b to 0e34a1d Compare December 23, 2019 03:01
@kinow
Copy link
Member Author

kinow commented Dec 23, 2019

PR updated. Conflicts fixed. Had to update the GraphWrapper component. This component simply gets the required parameters to create a Graph component from the Add Tree dialogue, plus data from Vuex store, and creates a Graph to be added as a Lumino widget/Vue component.

Tested with the recently merged subscriptions/websockets, and two workflows. Almost everything seems to be working as expected.

There is one thing that I may fix after the Tree component. If you have 2 workflows, and you open one and add some views (e.g. one tree, and one graph).

Then, when you switch to another workflow, the two views are kept, and the tasks/jobs are replaced by the new component. Here's what I mean.

GIFrecord_2019-12-23_161108

Between bug and feature, I think this probably falls in the category of bug/unexpected behaviour.

@kinow
Copy link
Member Author

kinow commented Dec 23, 2019

Argh, one test failing 😠

@kinow
Copy link
Member Author

kinow commented Dec 23, 2019

GitHub action happy. This is officially ready for review! Will keep an eye for comments/reviews, but focusing now on the treeview as holiday homework (read: nerdy fun).

@oliver-sanders
Copy link
Member

Resizing Lumino tabs is now working brilliantly!

I think there is an issue with padding, the whitespace under the toolbar appears to be associated with the <main> element. The whole page is vertically scrolling by a similar amount so that might be related.

This could be booted to a follow-on PR.

Screenshot from 2019-12-23 17-35-52

@kinow
Copy link
Member Author

kinow commented Dec 25, 2019

Squashed commits 👍 but still pending one item from Oliver's review.

@kinow
Copy link
Member Author

kinow commented Jan 6, 2020

Fixed #323 while testing this PR with the "Add View" link.

Screen Shot 2020-01-06 at 20 48 24

@kinow
Copy link
Member Author

kinow commented Jan 9, 2020

Finished moving the subscriptions to the view. The Workflow component reacts to events, and adds new widgets. When a widget is added - alongside a Vue wrapper - we also create a subscription.

The widget has the same ID as the subscription. Later, when the user closes the widget, we capture the Lumino event, and emit a new Vue event. That event then triggers the deletion of the Vue components (wrapper et al) and the removal of the subscription.

This a compromise for the discussion around where to keep subscriptions.

The components are free of GraphQL details or queries. The subscription code (gquery in special) is not touched, and works as per design. Screenshot showing one way to confirm what subscriptions we have:

GIFrecord_2020-01-09_161017

Final notes: this PR has a commit that I picked from the Infinite Tree PR to fix the offline mode. Whichever goes first, the other PR will need amending. It is not really important, as they will cause conflicts anyway in the tree component. The conflicts will take a couple of days for fixing and testing, as I haven't experimented the infinite tree with lumino 👍

@oliver-sanders
Copy link
Member

Okay, so you've copied the queries from the tree and graph view into the workflow component?

If so should the query in src/views/Graph.vue still be there?

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay the "compromise" makes sense, it restores the "only subscribe to what you need" model, further refinement should be attempted separately.

@kinow
Copy link
Member Author

kinow commented Jan 9, 2020

Okay, so you've copied the queries from the tree and graph view into the workflow component?

If so should the query in src/views/Graph.vue still be there?

Replied on Riot, copying here for reference

Yes, I think @hjoliver mentioned he'd like to keep the old table at /workflows working. That one where users can see a listing of workflows, and under Actions I think there are links for the Tree view and for the Graph view.

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo, looks good, works, all happy.

@oliver-sanders
Copy link
Member

I think this is perfectly usable and further enhancements / tweaks can be punted as this is already a sizeable change - hence #358 which we can live with until 0.3.

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@hjoliver hjoliver merged commit 122ff95 into cylc:master Jan 14, 2020
@kinow kinow deleted the try-lumino branch March 19, 2020 01:04
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

Successfully merging this pull request may close these issues.

Menu disappears when in responsive/mobile mode Create a Workflow component
3 participants