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

change filter from is to is one of #3529

Merged

Conversation

eze9252
Copy link
Contributor

@eze9252 eze9252 commented Aug 3, 2021

Hi team, this resolve:

  • change custom search bar from is to is one of to support multiple values

closes #3521

@eze9252 eze9252 self-assigned this Aug 3, 2021
Comment on lines 54 to 62
const newFilters = []
values.forEach(element => {
const filter = {
match_phrase: {
[element.value]: element.label
}
}
newFilters.push(filter);
});
Copy link
Member

@Desvelao Desvelao Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: You could use Array.prototype.map instead of Array.prototype.forEach + Array.prototype.push

const newFilters = values.map(element => ({
  match: {
    [element.value]: {
      query: element.label,
      type: 'phrase'
    }
  }
});

The match_phrase gives problems with some app logic. Use:

match: {
  [element.value]: {
    query: element.label,
    type: 'phrase'
  }
}

Comment on lines 99 to 102
filters.forEach(item => {
item.params.forEach(element => {
filterCustom.push({ label: element, value: item.key })
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: We could use Array.prototype.map instead of Array.protype.forEach + Array.prototype.push

Copy link
Contributor

@CPAlejandro CPAlejandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog is missing

Copy link
Contributor

@CPAlejandro CPAlejandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@Machi3mfl Machi3mfl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines 34 to 41
useEffect(() => {
let filterSubscriber = filterManager.getUpdates$().subscribe(() => {
onFiltersUpdated();
return () => {
filterSubscriber.unsubscribe();
};
});
}, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: The returned function to unsubscribe to the changes on the filterManager should be the returned on the useEffect callback, not the subscription function.

suggestion: You could use the useFilterManager hook instead of use the filterManager.getUpdates$().subscribe and listen to the chagens of filters variable returned by the mentioned hook to apply the effect.


const getComponent = (item: any) => {
var types = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: You could use const instead of var here. Anyways, we prefer let over var in the variable declaration.

@Desvelao
Copy link
Member

Desvelao commented Aug 4, 2021

issue: We should be able to remove the filters applied to the selectors. The button to remove the filter is hidden with CSS
image
image

@eze9252 eze9252 linked an issue Aug 5, 2021 that may be closed by this pull request
Copy link
Contributor

@CPAlejandro CPAlejandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second revision of CR and testing: LGTM!

@sortiz1191 sortiz1191 self-requested a review August 5, 2021 10:47
const prevValues = usePrevious(values);

useEffect(() => {
if (prevValues != values) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why check for differences when values is already a dependence?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Contributor

@sortiz1191 sortiz1191 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@eze9252 eze9252 merged commit 7d41e64 into feature/Office365 Aug 6, 2021
@eze9252 eze9252 deleted the feature/3521-change-operator-is-to-is-one-of branch August 6, 2021 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change operator from "is" to "is one of" to allow multiple selections
6 participants