-
Notifications
You must be signed in to change notification settings - Fork 27
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
Tree Component #145
Comments
Taking a quick look around I think we are unlikely to find a tree which will marry into our data structure as our data is kinda unstructured in a way, its about how you combine families, cycle points, etc which forms the tree in Cylc. Unless anything crops up which ticks all the boxes I'd be inclined to nick the Vuetify CSS and apply it to a <ul v-for="x in y">
<li>
<ul v-for="j in j">
<li>
.... Which is the approach used in https://github.com/cylc/cylc-ui/blob/master/src/views/Tree.vue The Vuetify tree is about 400 lines of typescript so really not that large a development effort https://github.com/vuetifyjs/vuetify/blob/3a9fdc292af97c98be91c014bde1fac40a96e865/packages/vuetify/src/components/VTreeview/VTreeview.ts |
With Vuetifyjs 2.0, the TreeView appears to have gained a few more options. The component has a demo playground where we can change the settings and see what it would look like on the fly.
But looking at the other items, it's still the same as before. I don't think we will find one that checks all the boxes here. I thought we would have to write a component from scratch (especially because of the responsive part), but if we can get some parts of TreeView that'd be great. I started a small experiment to use the I'm using version 2.0.2 of Vuetify, and their TreeView is a bit limited. No easy way to disable/gray out items (as in tasks already done as per sketch). We will need to customize it quite a bit I think. But we may be able to just create a new component based on this one perhaps... we don't need to use TypeScript... we can eliminate the features that we don't need, and just copy whatever we need. |
@oliver-sanders are you planning to work on this? Otherwise I can have the first try at creating a simple tree component. The part of tabular data is not so clear for me, but the rest I think I understand how/why we need. |
@kinow - do you mean how to do the tabular data (in a tree view) is not clear, or why we need it? On why, I can see @oliver-sanders 's point that the tabular form is useful if you want to sort a whole bunch of jobs by submit-time (e.g.). But it is unfortunate that we need it from a clean-layout point of view. I suppose the question is then, can we get (or make) a single treeview component that can do it all - can it switch between tabular and tree-expand at the lowest (individual task) level - or do we need two views? I think @oliver-sanders thinks we can do it with one, but perhaps that remains to be seen. If it does prove difficult to do it all with a single tree-view, I think another option is:
As an example of 2. see the cylc-7 GUI tree view with family grouping turned off. Such a view could still be family-friendly by allowing filtering (inclusive and exclusive) based on family names. I'm expecting this idea not to be very popular with the UK team (ping @oliver-sanders?) but I think we should consider it. Advantages:
The only(?) disadvantages are:
@cylc/core - any opinions on this? |
I am more confused with the how. I thought we would be able to display extra information in a collapsible panel, which appear in the sketch. Where the user would click a task/family/or workflow to see more information e.g. I think the information in this panel is the same we have in the current table? I got the impression after the last meeting that some users preferred to have the table. What I had in mind for that, then, was to use two components allowing the user to switch back and forth between then. That's how NIWAData does when it displays a graph with information for the users, but there is a button at the top that when the user clicks, it turns around and has some other information in the back, https://data.niwa.co.nz/#/what_you_get But I like your suggestion of simply having two components, and let the user choose. +1 especially for "less complexity in our own code base".
Why can't we have a table with expand/collapse option for families? I think the vue-ads-table-tree component was able to show tabular data with hierarchy, allowing to extend/collapse table rows. |
We can always split it into two components, that's not a huge problem. I don't see it as being a big challenge though, getting a table layout in CSS is trivial these days. <!-- psuedo-vue -->
<ul>
<li>
<task status="task.status">
{{ task.name }}
<span if="expanded">
<span for="column in table">
{{ column}}
</span>
</span>
</li>
</ul> |
Feel free to take a crack at it, I think you have a much better understanding of Vue than me! |
Not sure about that, but I intend to check with you as soon as possible once I have anything (especially CSS; the Task & Job components got well organized scss structure). On the multi-selection, just to confirm: as a user, can I select multiple tasks, from multiple workflows? Or is there any requirement to allow multiple selections only within the same workflow? |
There is actually a requirement for users to be able to select multiple tasks across suites (workflows). E.g. To hold all tasks that run on a certain job platform and the job platform is about to go down for maintenance; or to re-run all failed archiving tasks (when the archiving system was down and is now back up again). |
I think we at least need to implement the same multi-selection functionality we have in the Cylc7 GUI:
Why not! I don't see any reason to restrict the number of suites displayed by a view to one, even if we don't make use of this functionality in early Cylc8 releases. |
Good points, noted! Multi selection across workflows it will be then. Thanks! |
Started with the approach from an existing component, where we re-use the same component recursively, i.e.
The issue is that the structure of the workflows has The current @oliver-sanders just wondering if the data structure is going to change, or if the component will have to handle the cycle points? (I'm already working on it, but just in case there are any plans to organise the tasks by cycle points... as that would be way easier :) ) |
Just discussed on Riot chat - no plans to do that. |
Still a bit clumsy, as selection values are not persisted (probably due the use of Branch with the current code: https://github.com/kinow/cylc-ui/tree/tree-component-1 There are only three files that matter being touched.
So every entry in the With this approach, we should be able to control whether a node is expanded or not programmatically. We can have functions to collapse all tasks, or expand all cycle points, etc. I will be working to add slots now. With slots, I hope to be able to allow to customize what the component does when we have a Task, a Cycle point, a Job, etc. Not sure if it will work OK due the recursion... but there's only way way to know it :-) The ugly in this approach is the computed data structure, which is about the same size as the workflow. Vuejs should take care of updating it, but the approach in |
Oh, and the reason for adding slots, is so that this component can be used in both |
Fixed after using |
Looking good! |
Wow @kinow that was quick. Your approach looks sensible to me, nice and flexible. 👏 |
@kinow Just took a look at your branch. Big result with so little logic! |
Thanks guys! I can't take much credit. Parts of the logic are from an existing component, and having the existing |
Please take some much-deserved credit Bruno! This looks great 💯 |
Added features to
The current implementation is based on the Vuetify TreeView component. Gif showing these features: Some questions after looking at the current result and the sketch: 1. What icon should we have for Workflow and Cyclepoint?
2. What should be the order of jobs?I think in the sketch the jobs with highest submission number appear at the top. But I am displaying the data in the same order returned from GraphQL. Changing it is quite easy, but just wanted to confirm that we must display from the greater to the smallest? 3. What is the text next to the Task summary and how to select its value?I think that's the Job host? If so, the task But what is the rule for the task 4. How should we handle multi-select?The component now has the options to hover items, and to mark items as active. Probably we will have only one item active. The Vuetify TreeView has the same features, plus the "selectable", which when enabled displays a checkbox next to each element, allowing the user to select one or multiple nodes. I think we can implement the examples in this issue description, allowing the user to use SHIFT and CTRL to select multiple contiguous and non contiguous items... though implementing will take a bit longer (and generate a few more questions :) But would it be alright to have this feature only in desktop mode? Or is there an alternative for mobile to allow multiple selection? I know some mobile apps allow you to Hold your finger on one item, and that activates multiple item selection... but I think that would be easier to be implemented later... 5. Align jobs the same way for GScan and Tree?The Tree component appears to align job icons to the left when summarizing a Task: While the GScan component seems to align job icons to the right when summarizing a Workflow: Should we align both the same way, or keep left/right as they are? Also, we will have to wrap when there are too many jobs... e.g. if a workflow has over 100 jobs, it won't be able to be displayed in GScan or Tree... we will have to display as many as possible - given any other information displayed like the task or workflow names - and wrap the remaining items. Is that OK? |
ps: tried to use slots, which was supposed to be simple, but turns out it's not that simple when you have recursion in your component... interesting, but so far it's Vuejs 1 x 0 Bruno |
Yes, "play" (triangle) = running workflow. Possibly we should have a whole-workflow state summary icon though (or as well) - what do you think @oliver-sanders ?
We go through a list of statuses in order of importance/criticality, and stop at the first that is present in the suite. In 7.8.x see
Most recent job at the top
Good question, let's see what @oliver-sanders was thinking there...
IMO we can just do it for desktop mode, at least to start with
I think the scan component is different in that it appears in a narrow-width sidebar, and the job icons are the right-most content in it. So it may make sense to right-align that, but not the tree component (esp. if there is other stuff to the right in the tree view, e.g. job host). (Or do you just mean right-align within a column?) |
I think we discussed truncating the list of job icons - e.g. show just the five most recent jobs, then |
To further elaborate on Hillary's comments.
Workflow:
Cyclepoint:
Yes
We can put one up, should be really quick as the standard icon set may suffice.
Most recent job at the top
Job host. So this is the first column of the data table, perhaps it can be hidden by default. image
Yes. This comes from Dave who felt that we needed a way of collapsing jobs so that the tree view didn't become too unwieldy, which is a fair point. Perhaps we could collapse the job if only one has been submitted.
TBC! Options:
Sounds sensible.
Should be! Good quality mobile support can follow later.
The alignment of jobs in the tree view (Cylc8) kinda bugs me. For a collapsed job we could potentially put the job icon next to the task icon? The potential for many-many relationship between tasks-jobs makes this messy. |
If we have room to display a message for a job, I'll vote for the job host/platform + the job ID. |
I agree, that's definitely the most critical job info - where is the job, and what's its ID? |
In the sketches I left it as just the host/platform as the JobID is something you would only want to know if something has gone wrong (i.e. information you would be happy to request on a case by case basis rather than information you would need in tabulated form). |
Hi @hjoliver I think by default Material UI has no borders. We added to match the sketch design. Let me create a ticket for that, and I will see if I can prepare a PR by Friday if there are no objections there 👍 I like flat design, and would be +1 to remove the borders as well. Looking at the two diffs the second looks better IMO. |
And I am having fun creating the component because I spend so long looking at the UI, that it helps me review the layout, find other issues with other components or even with Cylc UI Server. So thanks for remembering to comment on what improvements/issues you are finding for the UI 🎉 |
Probably the "Ready" state. |
Added functions in the component to expand and collapse. Example page has controls to "Expand All", "Collapse All", "Expand all Tasks", and "Collapse all Tasks". The functions are in the component, but the buttons that call them are not. Had to learn how to call methods in a component from outside - you assign a Also had to work on event propagation. It does seem to have a small performance penalty adding so many events, but the component still looks OK testing with a running suite. A good test will be when we add multiple trees to the user interface. The expand/collapse feature uses caches (JS "Expand All" and "Collapse All" persist the state. So if you expand all, new nodes will be expanded (default behaviour). If you collapse all, new nodes will be collapsed. When you pass a filter (in this example we use Just add slots, maybe try to add some tests, and PR will be ready. Cheers |
Finished unit tests today. Now adding slots, we just need to confirm visually it looks OK, and the unit tests pass as well. Did not have to add anything to the project to write the unit tests, just learn how to use Vue Test Utils, especially its Wrapper object, and difference between Unit tests passed on Travis CI without increasing build time noticeable, nor coverage (low as we have included Just slots and some docs now 😪 |
Closing this as addressed by the many PRs to date. The remaining work is covered by #434. |
A component / style library for displaying nested trees for use by:
Requirements:
Options:
Likely Conclusion
The tree view for Cylc is quite complicated and there likely isn't an off-the-shelf component which can do the job.
Can we borrow code from existing components to give ourselves a head start?
The text was updated successfully, but these errors were encountered: