-
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
api on the fly - part 1 - generate forms from mutations #357
Conversation
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.
One or other typo I think, but found nothing wrong in the pull request. I think you have experienced pretty much every kind of problem I had with Vue.js 😄 Great work going through some of its limitations and working around its reactivity too. One step closer to mutations! 💥
set (val) { | ||
this.$emit('input', val) | ||
} | ||
}, |
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.
Oh, I bet it was not really fun to debug why the v-model
was not working here ( I thought it would work, or :value.sync
, which I tried but also didn't work 👀 )
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.
Yeah, the data model took much longer than all the rest of the work put together. Really confused the hell out of me!
Yes, this was a pretty steep learning curve. I think I understand Vue a lot better now though. |
@kinow sneaking in one more commit to use mixins which make the code much D[n]RYer. |
@wxtim I've put you down for second review. This PR should work with the master branches of Cylc Flow and Cylc UIServer. For second review I reckon:
To test:
The code is a little funky so some pointers here:
|
You can explain it to me now. |
Am I supposed to do anything with the object created by using this? Can I do something with this, or should something happen? Should I paste it into the console? {
"command": "\"nudge\"",
"workflows": [
"simple"
]
} |
I have:
As far as I can tell this pull request does what @oliver-sanders intends it to do, and doesn't do other stuff. I've approved it, but I'd quite like answers to my ignorant questions. I'll merge if @oliver-sanders doesn't. |
The JSON you see at the bottom of the form is just showing the data in the form. It should change as you type. The Once we are finished that JSON will get attached to a GraphQL mutation and sent to the Workflow Server (via the UI Server). |
Keep asking, reviews are a great way of learning and even prompting authors to think more about what they've done. |
I'm happy that you've answered all my questions so I'm merging! Happy days. |
Addresses the first three points of #339
This PR adds a temporary "mutations" view which lists available mutations and auto-generates forms for them on request.
This is orthogonal to cylc/cylc-flow#3469 which makes the mutations more declarative and brings them more inline with the Cylc CLI.
Getting the nested components and data model working correctly took nearly all the time. Thanks for the
<component :is="class" />
suggestion @kinow, I would have wasted days otherwise 👍.Overview:
Caveats:
Some of the default values in the GraphQL schema are presently set as string representations for list types. Either Graphene or GraphQL seems to convert all default types to JSON which is added as a string in the JSON response? This results in traceback and errors. 👀Justification:
There are some tools out there which could have been used, instead I wrote this from scratch. Just to dump my reasoning down here for the record:
There is a potential pathway where we convert GraphQL -> JSONSchema -> Web Form -> JSON -> GraphQL Arguments.
TODO:
FormGenerator
model.Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.