-
Notifications
You must be signed in to change notification settings - Fork 32
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
WIP : Advanced filters #702
Conversation
Affected libs:
|
021b5f0
to
7dba06f
Compare
7ef0511
to
c7d0f9a
Compare
b91f0fa
to
efa9686
Compare
efa9686
to
b91f0fa
Compare
.search( | ||
'bucket', | ||
JSON.stringify( | ||
this.esService.getSearchRequestBody({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this degrades the abstraction over the GN4/ElasticSearch backend; this abstraction is still not fully complete but we should be careful not to "open new holes" in it.
If achieving this through the Repository interface is really too far-fetched then I guess keeping this would be acceptable though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No gn4 api calls should be made but in gn4 repository lib.
to compare semantic version of backend API
as the error is thrown from getApiVersion()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work @Angi-Kinas & @f-necas, it was a tough one.
The contact & thesaurus fields work well, congratz.
Nevertheless, we have to refactor your work as it violates many OOP and architectural principles. See my components to understand small issues from here to there !
I am taking over it in #719 to bring a little help on the way 🤟
@@ -913,4 +926,88 @@ export class ToolsApiService { | |||
} | |||
) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never write open API client by hand.
BTW, the registries
client already exists in RegistriesApiService
@@ -127,6 +128,57 @@ export class GnUiTranslationSearchField extends SimpleSearchField { | |||
} | |||
} | |||
|
|||
export class ThesaurusTranslationSearchField extends SimpleSearchField { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have extended the GnuiTranslationField
, which is almost the same, instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content of the commit has nothing to do with the commit message.
@@ -4,7 +4,7 @@ | |||
class="py-[37px] pl-[47px] rounded-lg border bg-white mb-5 card-shadow cursor-pointer" | |||
[figure]="recordsCount$ | async" | |||
[icon]="'folder_open'" | |||
[title]="'catalog.figures.datasets'" | |||
[title]="'catalog.figures.datasets' | translate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless as the gn-ui-figure
already does a translation.
@@ -1,6 +1,6 @@ | |||
{ | |||
"catalog.figures.datasets": "{count, plural, =0{datasets} one{dataset} other{datasets}}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should tells that there is an issue with the translation.
In a previous commit, you added a key which is not recognized by ngx-translate.
Never add key by hand in this file.
return this.version.pipe( | ||
switchMap((version) => | ||
version == '4.2.2' | ||
? super.getFiltersForValues(values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both lines are exactly the same as the default value of esFieldName
in getFiltersForValues
is this.esFieldName
|
||
constructor(public order: 'asc' | 'desc' = 'asc', public injector: Injector) { | ||
super('OrgForResource', order, injector) | ||
this.esFieldName = 'OrgForResourceObject.default' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This override super.esFieldName
as well.
.search( | ||
'bucket', | ||
JSON.stringify( | ||
this.esService.getSearchRequestBody({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No gn4 api calls should be made but in gn4 repository lib.
'bucket', | ||
JSON.stringify( | ||
this.esService.getSearchRequestBody({ | ||
contactForResource: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice payload 👍
getFiltersForValues(values: FieldValue[]): Observable<FieldFilters> { | ||
getFiltersForValues( | ||
values: FieldValue[], | ||
esFieldName: string = this.esFieldName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change the signature, then you don't correctly implements the abstract class.
BTW, implements
an abstract is javascript abusive, one should extend
a class, and implement
an interface. It would have rise a warning there.
Closing: partially done with #719 |
Allows to implement custom filters based on thesaurus and orgForResource
TODO :