-
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
Allow user to set the order of cycle points #658
Conversation
Codecov Report
@@ Coverage Diff @@
## master #658 +/- ##
==========================================
- Coverage 85.38% 85.22% -0.16%
==========================================
Files 70 70
Lines 1498 1509 +11
Branches 113 116 +3
==========================================
+ Hits 1279 1286 +7
- Misses 187 188 +1
- Partials 32 35 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Works well. Seems to me this is fine as a user profile preference. It's likely to be a static choice, not something people want to change for different workflows. Also, if we keep it there, we don't have to worry about reversing existing open tree views, because there won't be any. On naming, maybe "Latest cycle point at top", or if we want top to be the default, "Latest cycle point at bottom". |
Reverted change to spelling of colour, and set the user profile settings name to "Latest cycle point at top". Will let @oliver-sanders have time to look at this draft before adding tests/changelog and marking it ready for review. |
Still Draft? (I guess you want @oliver-sanders opinion on the questions above?) |
That's right. If he agrees with the current implementation I will write the tests and changelog. |
Sorry, missed this.
Sounds good to me, I can't think why users would want this to be different in one view to another.
That sounds fine, a notice saying "reload this page for changes to take effect" (or something like that) should be enough. We can always come back to this later if we accumulate other similar settings. |
Adding test and preparing to mark this PR as ready for review today/tomorrow 👍 |
Rebased first. |
@@ -186,6 +186,43 @@ describe('CylcTree', () => { | |||
expect(cylcTree.root.children[0].id).to.equal(`${WORKFLOW_ID}|2`) | |||
expect(cylcTree.root.children[1].id).to.equal(`${WORKFLOW_ID}|1`) | |||
}) | |||
it('Should add cycle points sorted DESC by default', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two tests assume we have the DESC order by default for cycle points. Should we change it later, we just update the constant in CylcTree
, and these two tests, plus the remaining tests that are expecting elements in order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reverse order (latest point at bottom) doesn't seem to be working properly.
Ah, debugging it for a while, finally found what's wrong! Before, I reversed the array to find the next position to add the element. But in ascending mode (1 to 2, to 3, etc) I don't need to reverse it (otherwise we get a very confusing result as you found out @hjoliver 😅 ). Trying to come up with a unit test to verify this scenario. Thanks @hjoliver ! 💯 |
…urning the wrong order, add unit tests
Fixed! 🤞 Wrote a unit test that failed, then fixed the code and the test passed. |
Yes I figured that out too and was trying to fix it for a PR to your branch ... but my JS is too slow so you bet me to it! |
// reverse to put cyclepoints in ascending order (i.e. 1, 2, 3) | ||
const cyclePoints = [...parent.children].reverse() | ||
// when DESC mode, reverse to put cyclepoints in ascending order (i.e. 1, 2, 3) | ||
const cyclePoints = this.options.cyclePointsOrderDesc ? [...parent.children].reverse() : parent.children |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I was using another if ... else
block, which was annoying hell out of me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's got it 👍
These changes close #333
A draft for discussion I think. @oliver-sanders , @hjoliver I've added a setting under the User Profile page. If you change that setting, then reload the tree view (or just navigate after you've set the value), then it should be displayed with the correct order.
Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.