Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Convert namespace from aspect to argument in service layer #143

Open
pmuir opened this issue Mar 19, 2017 · 6 comments
Open

Convert namespace from aspect to argument in service layer #143

pmuir opened this issue Mar 19, 2017 · 6 comments
Assignees
Milestone

Comments

@pmuir
Copy link
Contributor

pmuir commented Mar 19, 2017

Right now the namespace is injected and stored in both the stores and the services, which makes them very hard to reuse as composable services.

This happens via the NamespacedResourceService and NamespacedResourceStore.

Instead of injecting the namespace into a parent class, it would be better if operations like loadAll took an argument of namespace: Observable allowing the consumer to explicitly choose the namespace.

Relates to:

  1. Remove store layer #146 - this is a longer term task to remove the store layer entirely
  2. services should not call stores #147 - this issue (Convert namespace from aspect to argument in service layer #143) really a subtask (the most pressing) of services should not call stores #147.
@pmuir pmuir added this to the fabric8-ui integration milestone Mar 19, 2017
@pmuir pmuir changed the title Convert namespace from aspect to argument in service and store layer Convert namespace from aspect to argument in service layer Mar 19, 2017
@pmuir pmuir modified the milestones: Summer, fabric8-ui integration Mar 20, 2017
@jstrachan
Copy link
Contributor

relates to #146 (comment) - I wonder if we can use DI to inject the namespace from the route; using route specific injections? This would avoid the need to use Observable<Params> to watch for namespace changes?

@jstrachan
Copy link
Contributor

also if we injected the namespace using the router; we could then look at adding more caching between related pages in the same namespace maybe?

@pmuir
Copy link
Contributor Author

pmuir commented Mar 21, 2017

I just want to be able to call the service layer, passing in the namespace to look at.

@jstrachan
Copy link
Contributor

yeah - we can maybe just put the ActiveRoute thingy on the observer producer objects and keep the services super simple?

@pmuir
Copy link
Contributor Author

pmuir commented Mar 21, 2017

I think if the observer producers only extracted the namespace from the activeroute and then called in to the service layer, that would work well.

There is currently some useful functionality in the observer producer (aka store) layer (e.g. attaching a watcher, the loading stuff) that should move up in to the service layer - IOW the observer producer layer is simply a really thin facade that sets the right namespace.

WDYT?

@jstrachan
Copy link
Contributor

yeah - sounds fine to me. Plus folks could compose the observable producers maybe with a different Observable<string> for the current namespace to the ActiveRoute params thingy (e.g. if it wanted to use a different namespace to the one from the route)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants