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

search: keep only the children filter and add filter list #503

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

vgranata
Copy link
Contributor

@vgranata vgranata commented Jun 20, 2022

Signed-off-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch

  • Removes the parent filters when a filter is selected in a hierarchical
    aggregation.
  • Removes useless methods.
  • The aggregationsExpand configuration can be a function.
  • Adds indeterminate state to the parent filters.
  • Stores the aggregationKey and parent properties in each bucket.
  • Add filter list
  • Removed ngx-bootstrap-slider
  • Display banner no results in current page

Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch
Co-Authored-by: Valeria Granata valeria@chaw.com

Screenshot

image

Why are you opening this PR?

  • Which task/US does it implement?
  • Which issue does it fix?

How to test?

  • What command should I have to run to test your PR?
  • What should I test through the UI?

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Extracted translations?

return (this.size === null || this.moreMode === false)
? size
: this.size;
return this.size === null || this.moreMode === false ? size : this.size;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure about parentheses removal ?
COSMETIC : For readability, I prefer use ternary instruction on three separate line (my opinion)

return (this.size === null)
? false
: this.buckets.length > this.size;
return this.size === null ? false : this.buckets.length > this.size;
Copy link
Contributor

Choose a reason for hiding this comment

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

COSMETIC : Seems more readable on three line ; especially when one of the option is itself a boolean comparaison.

Comment on lines 1 to 2
<ul *ngIf="filters?.length > 0" class="pl-0">
<li *ngFor="let filter of filters" class="list-unstyled mb-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

OPINION : (should be discussed with all devs). Using styling in ng/core should be use only if really necessary (especially padding, margin, ...). Using them into ng/core will disallow to have custom styling in children project.

@vgranata vgranata force-pushed the grv-facet-filters branch from 226d638 to 283bacf Compare June 22, 2022 15:02
@vgranata vgranata force-pushed the grv-facet-filters branch 3 times, most recently from d6b92c9 to 4ae14ef Compare July 25, 2022 14:30
@Garfield-fr
Copy link
Contributor

Garfield-fr commented Aug 17, 2022

The commit message is too long (Max 50 chars).

Make a description for that.

And why you are 3 commits ?

Comment on lines 34 to 41
// For language aggregation, we transform language code to human readable
// language.
if (aggregationKey === 'language') {
return this._translateLanguage.translate(bucket.key, this._translateService.currentLang);
}

// Simply translate the bucket key.
return this._translateService.instant(bucket.key);
Copy link
Contributor

Choose a reason for hiding this comment

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

cosmetic : a ternary instruction (I love them 😍) could be used

return (aggregationKey === 'language')
    ? this._translateLanguage.translate(bucket.key, this._translateService.currentLang)
    : this._translateService.instant(bucket.key)

@@ -0,0 +1,8 @@
<ul *ngIf="filters?.length > 0" class="pl-0">
<li id="filter" *ngFor="let filter of filters" class="d-inline list-unstyled pr-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

use an id attribute with a *ngFor should be avoid. An ID must be unique into the DOM. If we create multiple li, the same id cill be used.

Additionnally using a id attribute on this tag seems not required at all except for the spec.ts.
Two solutions :

  • either use an id='filters' attributes on the ul tag. Selectror changes to ul#filters li > button (to be tested)
  • either use an additional class (ex:'filter-value') on each li. Selectror changes to li.filter-value > button(to be tested)

});

it('should display 2 buttons', () => {
const buttons = fixture.debugElement.nativeElement.querySelectorAll('li#filter > button');
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous comment

Comment on lines 9 to 13
/**
* All aggregations
*/
@Input()
aggregations;
Copy link
Contributor

Choose a reason for hiding this comment

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

cosmetic : I prefer the condensed writing method (personal feeling)

/** All aggregations */
@Input() aggregations;

*/
constructor(
private _recordSearchService: RecordSearchService,
private ref: ChangeDetectorRef
Copy link
Contributor

Choose a reason for hiding this comment

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

if private, then use the '_' convention --> _ref

Comment on lines 548 to 552
if (this._config.showFacetsIfNoResults) {
return false;
} else {
return !this.q && this.records.length === 0 && !this.showEmptySearchMessage;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

possible ternary here.

jma and others added 2 commits August 22, 2022 17:53
* Removes the parent filters when a filter is selected in a hierarchical
  aggregation.
* Removes useless methods.
* The aggregationsExpand configuration can be a function.
* Adds indeterminate state to the parent filters.
* Stores the aggregationKey and parent properties in each bucket.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch
Co-Authored-by: Valeria Granata <valeria@chaw.com>
@vgranata vgranata force-pushed the grv-facet-filters branch 2 times, most recently from b84b8c3 to 14b172b Compare August 23, 2022 12:24
* correct Library facet in organisation view
* improve Publication year facet

Co-Authored-by: Valeria Granata <valeria@chaw.com>
@PascalRepond PascalRepond removed the request for review from Garfield-fr August 24, 2022 06:44
@vgranata vgranata requested review from Garfield-fr and removed request for Garfield-fr August 24, 2022 08:39
@vgranata vgranata dismissed Garfield-fr’s stale review August 24, 2022 08:40

The comments were resolved.

@vgranata vgranata merged commit 2befc12 into rero:staging Aug 24, 2022
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.

5 participants