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

UI: Add support for blocking queries on the service instance detail page #5487

Merged
merged 5 commits into from
Mar 22, 2019

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Mar 14, 2019

See #5479, This PR will be merged on top of that one but I've split these up for ease.

This follows the same implementation as the above PR. There are a couple of tiny nuances here, see below for details:

  1. Previously we would return undefined when a service instance has no
    proxy, but this means we have nothing to attach meta.cursor to. We've changed
    this to return an almost empty object, with only a meta property.
    Leading on from this, at first glance there doesn't seem to be any way to provide a proxy
    object to templates and be able to detect whether it is actually undefined
    or not so we instead change some conditional logic in the templates to
    detect the property we are using to generate the anchor. I had a very quick
    look here to see if I could do something with is-empty, but that wasn't very
    successful, plus I'd rather stick with the {{#if proxy}} rather than having to
    use a helper like {{#if (is-empty proxy)}}. If anyone knows how to achieve this
    and tips/suggestions would be great. In the meantime, just moving this to use a
    {{#if proxy.ServiceName}} instead works fine.
  2. Made a pauseUntil test helper function for steps where we wait for
    things to happen. We are likely to make quite a few more or these so this helps
    with that but also means if we can move away from setInterval to something else
    later at some point we can do it in one place.
  3. Whilst running into point 1 here, we managed to make the blocking
    queries eternally loop. Whilst this is due to an error in the code (proxy being
    undefined not having meta properties) and shouldn't ever happen whilst in
    actual use, we've added an extra check so that we only recur/loop the blocking
    query if the previous response has ameta.cursor

John Cowen added 2 commits March 12, 2019 15:38
This commit includes several pieces of functionality to enable services
to be removed and the page to present information that this has happened
but also keep the deleted information on the page. Along with the more
usual blocking query based listing.

To enable this:

1. Implements `meta` on the model (only available on collections in
ember)
2. Adds new `catchable` ComputedProperty alongside a `listen` helper for
working with specific errors that can be thrown from EventSources in an
ember-like way. Briefly, normal computed properties update when a
property changes, EventSources can additionally throw errors so we can
catch them and show different visuals based on that.
Also:

1. Previous we could return  undefined when a serivce instance has no
proxy, but this means we have nothing to attach `meta` to. We've changed
this to return an almost empty object, so with only a meta property.
At first glance there doesn't seem to be any way to provide a proxy
object to tempaltes and be abnle to detect whether it is actually null
or not so we instead change some conditional logic in the templates to
detect the property we are using to generate the anchor.
2. Made a `pauseUntil` test helper function for steps where we wait for
things. This helps for DRYness but also means if we can move away from
setInterval to something else later, we can do it in one place
3. Whilst running into point 1 here, we managed to make the blocking
queries eternally loop. Whilst this is due to an error in the code and
shouldn't ever happen whilst in actual use, we've added an extra check
so that we only recur/loop the blocking query if the previous response has a
`meta.cursor`
@johncowen johncowen requested a review from a team March 14, 2019 14:43
@johncowen johncowen added the theme/ui Anything related to the UI label Mar 14, 2019
@johncowen johncowen changed the base branch from feature/ui-instance-blocking to ui-staging March 22, 2019 17:12
1. Moves data re-shaping for the templates variables into a repository
so they are easily covered by blocking queries (into coordinatesRepo)
2. The node API returns a 404 as signal for deregistration, we also
close the sessions and coordinates blocking queries when this happens
@johncowen johncowen merged commit 7a82172 into ui-staging Mar 22, 2019
@johncowen johncowen deleted the feature/ui-instance-detail-blocking branch March 22, 2019 17:24
johncowen added a commit that referenced this pull request Apr 29, 2019
…age (#5487)

This commit includes several pieces of functionality to enable services
to be removed and the page to present information that this has happened
but also keep the deleted information on the page. Along with the more
usual blocking query based listing.

To enable this:

1. Implements `meta` on the model (only available on collections in
ember)
2. Adds new `catchable` ComputedProperty alongside a `listen` helper for
working with specific errors that can be thrown from EventSources in an
ember-like way. Briefly, normal computed properties update when a
property changes, EventSources can additionally throw errors so we can
catch them and show different visuals based on that.

Also:

Add support for blocking queries on the service instance detail page

1. Previous we could return  undefined when a service instance has no
proxy, but this means we have nothing to attach `meta` to. We've changed
this to return an almost empty object, so with only a meta property.
At first glance there doesn't seem to be any way to provide a proxy
object to templates and be able to detect whether it is actually null
or not so we instead change some conditional logic in the templates to
detect the property we are using to generate the anchor.
2. Made a `pauseUntil` test helper function for steps where we wait for
things. This helps for DRYness but also means if we can move away from
setInterval to something else later, we can do it in one place
3. Whilst running into point 1 here, we managed to make the blocking
queries eternally loop. Whilst this is due to an error in the code and
shouldn't ever happen whilst in actual use, we've added an extra check
so that we only recur/loop the blocking query if the previous response has a
`meta.cursor`

Adds support for blocking queries on the node detail page (#5489)

1. Moves data re-shaping for the templates variables into a repository
so they are easily covered by blocking queries (into coordinatesRepo)
2. The node API returns a 404 as signal for deregistration, we also
close the sessions and coordinates blocking queries when this happens
johncowen added a commit that referenced this pull request May 1, 2019
…age (#5487)

This commit includes several pieces of functionality to enable services
to be removed and the page to present information that this has happened
but also keep the deleted information on the page. Along with the more
usual blocking query based listing.

To enable this:

1. Implements `meta` on the model (only available on collections in
ember)
2. Adds new `catchable` ComputedProperty alongside a `listen` helper for
working with specific errors that can be thrown from EventSources in an
ember-like way. Briefly, normal computed properties update when a
property changes, EventSources can additionally throw errors so we can
catch them and show different visuals based on that.

Also:

Add support for blocking queries on the service instance detail page

1. Previous we could return  undefined when a service instance has no
proxy, but this means we have nothing to attach `meta` to. We've changed
this to return an almost empty object, so with only a meta property.
At first glance there doesn't seem to be any way to provide a proxy
object to templates and be able to detect whether it is actually null
or not so we instead change some conditional logic in the templates to
detect the property we are using to generate the anchor.
2. Made a `pauseUntil` test helper function for steps where we wait for
things. This helps for DRYness but also means if we can move away from
setInterval to something else later, we can do it in one place
3. Whilst running into point 1 here, we managed to make the blocking
queries eternally loop. Whilst this is due to an error in the code and
shouldn't ever happen whilst in actual use, we've added an extra check
so that we only recur/loop the blocking query if the previous response has a
`meta.cursor`

Adds support for blocking queries on the node detail page (#5489)

1. Moves data re-shaping for the templates variables into a repository
so they are easily covered by blocking queries (into coordinatesRepo)
2. The node API returns a 404 as signal for deregistration, we also
close the sessions and coordinates blocking queries when this happens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants