-
Notifications
You must be signed in to change notification settings - Fork 13
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
patron profile: add sort by due date #774
patron profile: add sort by due date #774
Conversation
971b6ba
to
dbbfa2d
Compare
dbbfa2d
to
f8e0abb
Compare
/** Initial records load and sort */ | ||
private _initialLoadSorted(): void { | ||
const pgr = this._paginator; | ||
this._loanQueryAll().subscribe((response: Record) => { |
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.
It is not a good idea to load all the loans at once, because if there are a lot of them, it will make the thing explode. The pager is there to avoid this.
You really need to use the pager.
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.
+1. You should update the "_loanApiService.getOnLoan()" method to accept a sorting option. This options could be use into
rero-ils-ui/projects/public-search/src/app/api/loan-api.service.ts
Lines 54 to 56 in f8e0abb
return this._recordService.getRecords( | |
'loans', this._patronStateQuery(patronPid, loanStates), page, itemsPerPage, | |
undefined, undefined, headers |
to sort result.
Any time a user change the sort criteria clicking on column header, the records must be reloaded on page 1 (even if user is on page 3 at click time)
...ublic-search/src/app/patron-profile/patron-profile-loans/patron-profile-loans.component.html
Outdated
Show resolved
Hide resolved
I continue about thinking at this problem during this weekend. About technical it should be test with an account with a lot of loans (~100 loans) to check performance. |
a955266
to
b5d9e96
Compare
@@ -29,14 +29,17 @@ import { PatronProfileMenuService } from '../patron-profile-menu.service'; | |||
export class PatronProfileLoansComponent implements OnInit, OnDestroy { | |||
|
|||
/** Observable subscription */ | |||
private _subscription = new Subscription(); | |||
_subscription: Subscription; |
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.
Why this change ? Especially if you create an subscription into ngOnInit
this.ngOnDestroy(); | ||
this.ngOnInit(); |
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.
Arggh. Is it really a good idea to call life cycle hook function like that ? What's the feeling of @Garfield-fr and/or @jma.
color: white; | ||
} | ||
select#sort-criteria.custom-select { | ||
background-color:#343a40; |
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.
is it possible to use bootstrap variable here ? maybe $table-dark-color
?
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 changes in this file are to overwrite the style of the sort-list ng-core widget.
I'm not sure how to use bootstrap in this case.
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.
You can check https://github.com/rero/rero-ils-ui/blob/staging/projects/admin/src/app/acquisition/acquisition.scss (and some other files)
@import '~bootstrap/scss/_functions';
@import '~bootstrap/scss/_variables';
@import '/projects/admin/src/app/scss/variables';
allows to use bootstrap variables, bootstrap functions and project variables.
margin-bottom: map-get($spacers, 1);
you can use 1 (small gap space) to 5 (big gap space)
If you can't use a bootstrap variable for the background color ; define a project variable into variables.scss
and use this variable in this file
background-color:#343a40; | ||
} | ||
.input-group-text { | ||
background-color:#343a40; |
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.
same here
.input-group-text { | ||
background-color:#343a40; | ||
border: none; | ||
padding: 1px; |
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.
use bootstrap function map-get
if possible :: map-get($spacers, 1)
3bbe84a
to
1a95a13
Compare
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.
still some changes into SCSS file ;-)
color: white; | ||
} | ||
select#sort-criteria.custom-select { | ||
background-color:#343a40; |
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.
You can check https://github.com/rero/rero-ils-ui/blob/staging/projects/admin/src/app/acquisition/acquisition.scss (and some other files)
@import '~bootstrap/scss/_functions';
@import '~bootstrap/scss/_variables';
@import '/projects/admin/src/app/scss/variables';
allows to use bootstrap variables, bootstrap functions and project variables.
margin-bottom: map-get($spacers, 1);
you can use 1 (small gap space) to 5 (big gap space)
If you can't use a bootstrap variable for the background color ; define a project variable into variables.scss
and use this variable in this file
/** OnDestroy hook */ | ||
ngOnDestroy(): void { | ||
this._subscription.unsubscribe(); | ||
} |
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.
Do not delete this code
selectingSortCriteria(sortCriteria: string) { | ||
this.sortCriteria = sortCriteria; | ||
this._subscription.unsubscribe(); | ||
this._initialisePaginatorAndSubscription(); |
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.
Use le current paginator and change only le value. Not necessary to reinitialize the paginator.
*/ | ||
selectingSortCriteria(sortCriteria: string) { | ||
this.sortCriteria = sortCriteria; | ||
this._subscription.unsubscribe(); |
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.
Remove this code and change with comment below
1a95a13
to
2eab456
Compare
7085bb5
to
65c98d0
Compare
e3c2c9f
to
caa954f
Compare
caa954f
to
6d4587f
Compare
6d4587f
to
a4ceabb
Compare
a4ceabb
to
a5bff64
Compare
a5bff64
to
f09b5f4
Compare
Co-Authored-by: Valeria Granata <valeria@chaw.com>
f09b5f4
to
de05524
Compare
Add sort for due date in patron profile view.
Co-Authored-by: Valeria Granata valeria@chaw.com
Why are you opening this PR?
Closes: rero/rero-ils#2263
Code review check list