-
Notifications
You must be signed in to change notification settings - Fork 1
Devices updated #216
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
Devices updated #216
Conversation
…om coniql successfully
… elsewhere cleaning up
Thanks, I'm having a look this morning. |
It is a complicated part of the code, isn't it? I see one pretty big simplification. If you look at https://github.com/dls-controls/coniql/blob/master/coniql/schema.gql, you see that you can get a channel either with a query or a subscription, but you can only get a device with a query. I think Tom intends that devices don't update. So if a widget needs a device, we just execute the query and store the result. We don't need to unsubscribe or handle updates. I think the only addition to What do you think? @thomascobb any thoughts? |
const DEVICE_SUBSCRIPTION = gql` | ||
query deviceQuery($pvDevice: ID!) { | ||
getDevice(id: $pvDevice) { | ||
id | ||
children(flatten: true) { | ||
name | ||
label | ||
child { | ||
__typename | ||
... on Channel { | ||
id | ||
} | ||
... on Device { | ||
id | ||
} | ||
... on Group { | ||
layout | ||
children { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; |
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.
This should be all you ever have to do, on connection to coniql. And it is static, so can't change without restarting coniql, so you never need to refetch it. This means no subscribing or unsubscribing, the first time you are asked about the contents of a Device you run this query, then subscribe to the Channels give.
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.
So yes, what @willrogers said is correct
Ah, well that is quite a big misunderstanding on my part then. Yes it is quite complicated, but I have wrapped in a few different things into the pull request which may exaggerate the difficulty. |
It's not all wasted time as I understand it now so I will change that tomorrow then. @thomascobb the current M1Yaw device example doesn't return channel names but returns string current values, is that what it is meant to be doing if instead of subscribing to the device we should be subscribing to the channels given? The current response looks something like this just for context to Will and others
|
Closed in favour of #217. |
@willrogers I thought it might be worthwhile opening a pull request now to get the infrastructure for devices all merged in. The device widget is still basic, but it collects the device json and sends it down to the component.