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

Use cycle point ID in the tree view structure #505

Merged
merged 10 commits into from
Oct 5, 2020

Conversation

kinow
Copy link
Member

@kinow kinow commented Sep 24, 2020

These changes are related to #504 #339

At the moment every node in the tree has an ID like kinow|five|1|foo, except the cycle points, which use just 1 (integer-type).

I implemented that way as it was the simplest approach, and because our cycle points are built from family proxies in the GraphQL query (cycle points are not types in the schema I think). @oliver-sanders found out that we didn't have the ID's while working on the mutations & api-on-the-fly integration.

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).
  • Already covered by existing tests.
  • Appropriate change log entry included.
  • No documentation update required.

…y-proxy ID.

With this we are able to derive the cycle point ID from the family-proxy ID (as the cyclepoint ID is part of it).
@kinow kinow self-assigned this Sep 24, 2020
@kinow kinow added this to the 0.3 milestone Sep 24, 2020
@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2020

Codecov Report

Merging #505 into master will increase coverage by 3.08%.
The diff coverage is 86.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #505      +/-   ##
==========================================
+ Coverage   63.29%   66.38%   +3.08%     
==========================================
  Files          44       43       -1     
  Lines         970      949      -21     
  Branches       59       59              
==========================================
+ Hits          614      630      +16     
+ Misses        338      301      -37     
  Partials       18       18              
Flag Coverage Δ
#unittests 66.38% <86.66%> (+3.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/graphql/queries.js 100.00% <ø> (ø)
src/components/cylc/tree/index.js 93.54% <66.66%> (-6.46%) ⬇️
src/components/cylc/tree/cylc-tree.js 100.00% <100.00%> (ø)
src/graphql/graphiql.js
src/mixins/toolbar.js 100.00% <0.00%> (+30.00%) ⬆️
src/mixins/index.js 100.00% <0.00%> (+100.00%) ⬆️
src/mixins/treeview.js 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a6931c...6062fb7. Read the comment docs.

@kinow
Copy link
Member Author

kinow commented Sep 24, 2020

The TreeItem props contain the tree node. This node now uses the cycle point ID, built from another node's ID.

image

The CylcTree object also stores the cycle point nodes received from GraphQL deltas using the complete cycle point ID for consistency. So either using data from deltas, or the available data in the Vue virtual DOM components data, you should have the same cycle point ID with a pattern user|workflow|cyclepoint

image

@@ -338,16 +340,17 @@ class CylcTree {
// NOTE: when deleting the root family, we can also remove the entire cycle point
if (familyProxyId.endsWith('|root')) {
// 0 has the owner, 1 has the workflow Id, 2 has the cycle point, and 3 the family name
const [owner, workflowId, cyclePoint] = familyProxyId.split('|')
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed cyclePoint as I don't need that, since I'll build the full cycle point ID

fragment CyclePointData on FamilyProxy {
id
cyclePoint
}
Copy link
Member Author

Choose a reason for hiding this comment

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

A new fragment for cycle points. Notice that it is built from a FamilyProxy, so effectively the id is a FamilyProxy ID

src/components/cylc/tree/index.js Outdated Show resolved Hide resolved
@kinow
Copy link
Member Author

kinow commented Sep 24, 2020

Note to self: look at the offline data and check if we need to re-generate it

@@ -100,7 +100,4 @@
# reset stuff
cylc unhold \
"${CYLC_SUITE_NAME}" "sleepy.${CYLC_TASK_CYCLE_POINT}"
cylc reset \
"${CYLC_SUITE_NAME}" "retrying.${CYLC_TASK_CYCLE_POINT}" \
-s 'succeeded'

This comment was marked as resolved.

@kinow
Copy link
Member Author

kinow commented Sep 28, 2020

Unit tests green. Almost there. I fixed the workflow one, but now got a new problem. The old data was generated before we had deltas. The code used to produce the offline data used cylc client to run a query workflows {}.

But now, cylc client doesn't support a deltas subscription (although I think we can enable that with some parameter?). But even if that worked, we couldn't really use it, because the generate shell needs 1 payload returned, instead of multiple messages with the deltas.

So my idea now is to write a new query for the offline data, re-using parts of the deltas fragments. But hit a bump with https://github.com/cylc/cylc-uiserver/issues/159

@kinow kinow marked this pull request as ready for review September 28, 2020 01:41
@kinow
Copy link
Member Author

kinow commented Sep 28, 2020

Alright, ready for review. @hjoliver is away this week, so happy if any other @cylc/core volunteers to review after @oliver-sanders , or we can wait until next week 👍

@kinow
Copy link
Member Author

kinow commented Sep 29, 2020

Added one commit that throws an Error if the node.id doesn't have at least three parts (part1|part2|part3). It should never happen, but in case it does, the tree would have incorrect data, and likely miss elements that need to be removed.

Tested with five, families2, and complex, no browser console errors. Then added one more commit with a unit test for that function 👍

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.

Looks good, tested as working:

Screenshot 2020-09-29 at 09 23 43

@oliver-sanders oliver-sanders mentioned this pull request Oct 2, 2020
13 tasks
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.

Tested as working 👍

Still needs a change log entry @kinow ?

@kinow
Copy link
Member Author

kinow commented Oct 5, 2020

Tested as working +1

Still needs a change log entry @kinow ?

Ops, just added it. Thanks @hjoliver !

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.

4 participants