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

Implement FilterService.getDisplayValueMap() #2209

Closed
jniles opened this issue Oct 16, 2017 · 0 comments
Closed

Implement FilterService.getDisplayValueMap() #2209

jniles opened this issue Oct 16, 2017 · 0 comments

Comments

@jniles
Copy link
Collaborator

jniles commented Oct 16, 2017

We're recently undertaken a large refactor of our filters to ensure that human readable ids are presented to the user when they filter the registries instead of large uuids or irrelevant numbers. One of the last PRs to land will be #2206.

Each search modal controller now contains the following code to create a map of id:displayValue:

var lastViewFilters = SOME_SERVICE.filters.formatView().customFilters;
var lastDisplayValues = lastViewFilters.reduce(function (object, filter) {
    object[filter._key] = filter.displayValue;
    return object;
}, {});

This code could easily be included in the FilterService on the client. Instead, of the above 5+ lines of code, a search modal should just do this:

var lastDisplayValues = SOME_SERVICE.filters.getDisplayValueMap();

to the same effect. It would reduce the complexity in our search modals and the total lines of code overall.

@jniles jniles self-assigned this Nov 3, 2017
jniles added a commit to jniles/bhima that referenced this issue Nov 3, 2017
This commit implements the getDisplayValueMap() method on the
FilterService as a wrapper for code that cached display values for
lookup later.  This code was used in every single search modal file.  It
has now been replace with a method on the FilterService itself.

Closes IMA-WorldHealth#2209.
jniles added a commit to jniles/bhima that referenced this issue Nov 4, 2017
This commit implements the getDisplayValueMap() method on the
FilterService as a wrapper for code that cached display values for
lookup later.  This code was used in every single search modal file.  It
has now been replace with a method on the FilterService itself.

Closes IMA-WorldHealth#2209.
jniles added a commit to jniles/bhima that referenced this issue Nov 11, 2017
This commit implements the getDisplayValueMap() method on the
FilterService as a wrapper for code that cached display values for
lookup later.  This code was used in every single search modal file.  It
has now been replace with a method on the FilterService itself.

Closes IMA-WorldHealth#2209.
jniles added a commit to jniles/bhima that referenced this issue Nov 20, 2017
This commit implements the getDisplayValueMap() method on the
FilterService as a wrapper for code that cached display values for
lookup later.  This code was used in every single search modal file.  It
has now been replace with a method on the FilterService itself.

Closes IMA-WorldHealth#2209.
bors bot added a commit that referenced this issue Nov 20, 2017
2273: feat(filters): implement getDisplayValueMap() r=jniles a=jniles

This commit implements the getDisplayValueMap() method on the
FilterService as a wrapper for code that cached display values for
lookup later.  This code was used in every single search modal file.  It
has now been replace with a method on the FilterService itself.

Closes #2209.
@bors bors bot closed this as completed in #2273 Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant