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

api-on-the-fly - part 2 - mutation association #359

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Jan 10, 2020

Addresses the fourth point of #339

Note - Built on top of #357 now merged
Note - Works with the data types defined in cylc/cylc-flow#3469

Use the argument types defined in the GraphQL schema to associate mutations with "Cylc Objects" by which I mean workflows, cycle point, tasks, etc.

This mapping will be used when you right-click on something (say a task in the tree view) to work out which mutations are relevant to the thing you clicked on.

At the moment this is built into the temporary Mutations view.

Example

Screenshot from 2020-01-10 14-41-32

TODO

  • Test

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).
  • No change long necessary, functionality not exposed to users (yet)
  • No documentation update required.

@oliver-sanders oliver-sanders added this to the 0.3 milestone Jan 10, 2020
@oliver-sanders oliver-sanders self-assigned this Jan 10, 2020
@oliver-sanders oliver-sanders mentioned this pull request Jan 10, 2020
11 tasks
Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

Form generation working. Could you explain what are the associations? I chose holdWorkflow, but could choose other types, and not only workflow in association. So not quite sure I understand how that part will work.

Some consoler errors

image

Debugging, it shows that the this.value value is a String I think?

image

Everything else works, nice form generation! 🎉 As the whole code is new, +1 LGTM and we can discuss any changes afterwards if you prefer 👍

src/components/graphqlFormGenerator/FormInput.vue Outdated Show resolved Hide resolved
src/views/Mutations.vue Outdated Show resolved Hide resolved
src/components/graphqlFormGenerator/FormInput.vue Outdated Show resolved Hide resolved
@kinow
Copy link
Member

kinow commented Jan 20, 2020

(Or are associations going to be restricted later, and only for now I can associate anything with any mutation?)

@oliver-sanders
Copy link
Member Author

Could you explain what are the associations

The "associations" work is simply about introspecting the arguments of mutations to find out what Cylc things the mutation operates on (i.e. workflows, cycle points, tasks, jobs).

The result is a mapping (e.g. the broadcast mutation works on multiple workflows and [optionally] multiple cycle points).

This will be used in a future PR to achieve this:

  1. User right-clicks (or taps or whatever) on a cycle point node in the Tree View.
  2. The UI works out which mutations take cycle point(s) as arguments (e.g. broadcast, stop, insert).
  3. The UI lists these mutations in a context menu.

@oliver-sanders
Copy link
Member Author

Debugging, it shows that the this.value value is a String I think?

So this is the same traceback is the same issue mentioned in #357, I had thought this was caused by error in the GraphQL schema (from Cylc Flow) but it turns out it isn't.

GraphQL introspections provide "default values" in JSON format so lists come through as strings (e.g. "[\"*\"]"). The solution is to JSON.parse them which I've done in another branch.

This PR just adds associations and doesn't touch the form generation logic (which is where the error is coming from).

@oliver-sanders
Copy link
Member Author

@wxtim I've put you down for review 2, this is a much quicker review than the last one.

@hjoliver
Copy link
Member

Change log and tests?

@oliver-sanders
Copy link
Member Author

Added unit tests, change log not helpful as the mutations view (as is in this PR), will not make release.

@hjoliver
Copy link
Member

change log not helpful as the mutations view (as is in this PR), will not make release.

It will make the next (alpha-2) release. By 8.0.0 we should have another change long entry that removes it. (At least, that's how we are managing pre-8.0.0 changes, in my mind!)

@hjoliver
Copy link
Member

You seem to have a bunch of minor quoting issues (via the linter) in the new tests.

@oliver-sanders
Copy link
Member Author

It will make the next (alpha-2) release

I'll put a changelog in on the most contemporary aotf PR for a2.

@oliver-sanders
Copy link
Member Author

You seem to have a bunch of minor quoting issues (via the linter) in the new tests.

Doesn't fail in my env, different linter versions perhaps, should be fixed.

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.

LGTM

@hjoliver hjoliver merged commit c3f49f5 into cylc:master Jan 30, 2020
@oliver-sanders oliver-sanders removed the request for review from wxtim January 30, 2020 02:47
@oliver-sanders oliver-sanders deleted the aotf-mutation-association branch January 30, 2020 02:47
@kinow kinow modified the milestones: 0.3, 0.2 Mar 23, 2020
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.

3 participants