-
Notifications
You must be signed in to change notification settings - Fork 7
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
UITEN-278 - create reading room from tenant settings #393
Conversation
}); | ||
}); | ||
|
||
const options = []; |
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 you please use reduce, I know it's the same but as for me looks more clear
const options = servicePoints.reduce((acc, s) => {
if (!sps.includes(s.id) || s.name === 'None') {
acc.push({ value: s.id, label: s.name });
}
return acc;
}, []);
* A reading room can have more than one service points assigned to it. | ||
* but a servicepoint cannot be mapped to more than one reading room | ||
*/ | ||
const sps = []; |
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.
What about to handle it with base array methods to avoid this tracking of closures?
Maybe like this:
const sps = rrs.reduce((acc, rr) => {
acc.push(...(rr.servicePoints || []).map((s) => s.value));
return [...new Set(acc)];
}, []);
Or maybe
const sps = rrs
.map((rr) => rr.servicePoints || [])
.map((s) => s.value)
.flat();
const uniqSps = [...new Set(spss)];
Note: I didn't check it live with your code, just as an example
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.
Quickly check, but it seems not equivalent. I prefer to retain my implementation.
import { readingRoomAccessColumns } from './constant'; | ||
|
||
const validators = { | ||
[readingRoomAccessColumns.NAME]: function validateName(item) { |
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 there is any reason use name function instead of just arrow? Looks like it calls by key and this name is visible only here.
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.
updated to anonymous arrow functions
}, []); | ||
|
||
const validate = (item, index, items) => { | ||
const itemErrors = validateItem(item, items) || {}; |
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.
Items errors looks like redundant, could you please just change to
return validateItem(item, items) || {}
Quality Gate passedIssues Measures |
* UITEN-276 - Reading Room Access settings page basic layout implementation (#389) * UITEN-276 - Reading Room Access settings page basic layout implementation * UITEN-276 - fix review comments * UITEN-278 - create reading room from tenant settings (#393) * UITEN-278 - create reading room from tenant settings * UITEN-278 - update package.json * UITEN-278 - Add prop type validation * UITEN-278 - update jest config * UITEN-278 - add unit test * UITEN-278 - update to final form * UITEN-278 - update uni test * UITEN-278 - refinement * UITEN-278 - add validators, refine code * UITEN-278 - refine * UITEN-278 - disable lint rule * UITEN-278 - refine * UITEN-278 - fix prop types sonar problem * UITEN-278 - update permission check on reading room access * UITEN-278 - fix review comments * UIU-282, UIU-283 - Implementation for Update and Delete of Reading Room Access (#398) * UITEN-278 - create reading room from tenant settings * UITEN-278 - update package.json * UITEN-278 - Add prop type validation * UITEN-278 - update jest config * UITEN-278 - add unit test * UITEN-278 - update to final form * UITEN-278 - update uni test * UITEN-278 - refinement * UITEN-278 - add validators, refine code * UITEN-278 - refine * UITEN-278 - disable lint rule * UITEN-278 - refine * UITEN-278 - fix prop types sonar problem * UITEN-278 - update permission check on reading room access * UITEN-282, UITEN-283 - Implementation for update and delete reading room access.
…ent value (follow up) (#400) * UITEN-276 - Reading Room Access settings page basic layout implementation (#389) * UITEN-276 - Reading Room Access settings page basic layout implementation * UITEN-276 - fix review comments * UITEN-278 - create reading room from tenant settings * UITEN-278 - update package.json * UITEN-278 - Add prop type validation * UITEN-278 - update jest config * UITEN-278 - add unit test * UITEN-278 - update to final form * UITEN-278 - update uni test * UITEN-278 - refinement * UITEN-278 - add validators, refine code * UITEN-278 - refine * UITEN-278 - disable lint rule * UITEN-278 - refine * UITEN-278 - fix prop types sonar problem * UITEN-278 - update permission check on reading room access * UITEN-278 - create reading room from tenant settings (#393) * UITEN-278 - create reading room from tenant settings * UITEN-278 - update package.json * UITEN-278 - Add prop type validation * UITEN-278 - update jest config * UITEN-278 - add unit test * UITEN-278 - update to final form * UITEN-278 - update uni test * UITEN-278 - refinement * UITEN-278 - add validators, refine code * UITEN-278 - refine * UITEN-278 - disable lint rule * UITEN-278 - refine * UITEN-278 - fix prop types sonar problem * UITEN-278 - update permission check on reading room access * UITEN-278 - fix review comments * UITEN-282, UITEN-283 - Implementation for update and delete reading room access. * UITEN-282 - fix the default value of Public checkbox to pick the current value
…ow-up) (#401) * UITEN-276 - Reading Room Access settings page basic layout implementation (#389) * UITEN-276 - Reading Room Access settings page basic layout implementation * UITEN-276 - fix review comments * UITEN-278 - create reading room from tenant settings * UITEN-278 - update package.json * UITEN-278 - Add prop type validation * UITEN-278 - update jest config * UITEN-278 - add unit test * UITEN-278 - update to final form * UITEN-278 - update uni test * UITEN-278 - refinement * UITEN-278 - add validators, refine code * UITEN-278 - refine * UITEN-278 - disable lint rule * UITEN-278 - refine * UITEN-278 - fix prop types sonar problem * UITEN-278 - update permission check on reading room access * UITEN-278 - create reading room from tenant settings (#393) * UITEN-278 - create reading room from tenant settings * UITEN-278 - update package.json * UITEN-278 - Add prop type validation * UITEN-278 - update jest config * UITEN-278 - add unit test * UITEN-278 - update to final form * UITEN-278 - update uni test * UITEN-278 - refinement * UITEN-278 - add validators, refine code * UITEN-278 - refine * UITEN-278 - disable lint rule * UITEN-278 - refine * UITEN-278 - fix prop types sonar problem * UITEN-278 - update permission check on reading room access * UITEN-278 - fix review comments * UITEN-282, UITEN-283 - Implementation for update and delete reading room access. * UITEN-282 - fix the default value of Public checkbox to pick the current value * UITEN-282 - add null checks for isPublic field value and also have a default value in case it is not available. * UITEN-282 - refine code * UITEN-282 - refine the validation for service points * UITEN-282 - refine the validation for service points
Purpose
https://folio-org.atlassian.net/browse/UITEN-278 - Reading Room Access (settings): Create new reading room
Note
The base branch for this PR is not master. Volaris will merge this feature branch for ui-tenant-settings module at a little later point in time. Also, base branch is always maintained equivalent to master.
Screencast
chrome_iC8SY6pYmJ.mp4
Pre-Merge Checklist
Before merging this PR, please go through the following list and take appropriate actions.
If there are breaking changes, please STOP and consider the following:
Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.
While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.