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
Back-Office UI: 67 loan details #97
Conversation
b7a80e0
to
85c3aae
Compare
@topless can you squash the commits before reviewing because we are gonna forget after? |
@@ -6,7 +6,13 @@ const get = itemPid => { | |||
return http.get(`${itemURL}${itemPid}`); | |||
}; | |||
|
|||
const fetchItemsByDocPid = documentPid => { | |||
const qs = `(document_pid:${documentPid} AND NOT(status:MISSING))`; |
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.
Shouldn't this status:MISSING
be retrieved from the invenioConfig instead of being hardcoded?
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.
I submitted a first attempt.
|
||
export default class ItemMetadata extends Component { | ||
render() { | ||
switch (this.props.view) { |
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.
I am not sure this is the correct way to go for this one. Why you don't extract the common part in a reusable component and just use it in the two different cases. Eitherway you could just use the two components ItemView
, LoanView
directly. I think that is component is redundant no?
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.
I agree, this one requires further discussion, I implemented it this way in order to demonstrate one for the possible solutions.
invenio_app_ils/ui/src/invenio_app_ils/pages/backoffice/ItemsSearch/ItemsSearch.js
Outdated
Show resolved
Hide resolved
...i/src/invenio_app_ils/pages/backoffice/LoanDetails/components/DocumentItems/DocumentItems.js
Outdated
Show resolved
Hide resolved
payload: newSortBy, | ||
}); | ||
|
||
await dispatch(fetchDocumentItems(documentPid)); |
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? You are not waiting for something after...
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.
There is no sorting any longer so its removed. But this one was copied from ItemPendingLoans, where we have to actually address the issue.
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.
I think we should remove also there then!
}; | ||
}; | ||
|
||
export const documentItemsChangeSortOrder = documentPid => { |
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 as in the previous action name.
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.
Gone.
.../ui/src/invenio_app_ils/pages/backoffice/LoanDetails/components/LoanMetadata/LoanMetadata.js
Outdated
Show resolved
Hide resolved
@@ -32,6 +32,28 @@ export const fetchLoanDetails = loanPid => { | |||
}; | |||
}; | |||
|
|||
export const assignLoanItem = (loanId, itemId) => { |
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.
assignItemToLoan
?
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.
Yeap, and also flipped the arguments to match the naming
* Item metadata is a common component, accepts a view param and renders the relevant view for available item data. * Loan actions display a message when there is no action available.
* Extended existing item search in the loan view
* Adjusted sample data to match real life logic for pending loans * Conditional rendering of item list in loan details, when a loan has an item assigned or when we want to change it.
* Loans now get a document id from available documents * Integrated search component and configured it to search items by documents id. * Adjusted layout to accommodate changes
* removed sort from items * filtered items so only LOANABLE show up * removed cursor when hovering over table row * #resolves 67
@@ -44,6 +44,20 @@ const buildPendingQuery = (documentPid, itemPid) => { | |||
return `${qsDocItem} AND state:PENDING`; |
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.
And probably even here we should think about avoid harcoding, my mistake
18aa0f8
to
622b33c
Compare
@@ -44,6 +44,20 @@ const buildPendingQuery = (documentPid, itemPid) => { | |||
return `${qsDocItem} AND state:PENDING`; | |||
}; | |||
|
|||
const assignLoanItem = (loanPid, itemPid) => { | |||
const newItemRef = { | |||
$ref: `https://127.0.0.1:5000/api/resolver/circulation/items/${itemPid}`, |
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.
I think we should re-think how we do this... we cannot hardcode this ref here.
Probably, instead of doing a patch, we need to create a new API endpoint, let's say /loan/changeItem
, passing the itemPid
, and server side it performs a patch.
WDYT?
7487020
to
84609a8
Compare
}); | ||
|
||
export const AvailableItems = compose( | ||
withRouter, |
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 this one where do we need it?
@@ -59,6 +59,7 @@ | |||
# because of https://github.com/requests/requests-oauthlib/commit/1b9fe1a630eb1c91bf12fd70aa2e10ca74ffc0b6 | |||
"oauthlib>=2.1.0,<3.0.0", | |||
# https://github.com/inveniosoftware/invenio-indexer/commit/9749c2fe4e2cbaabc167ad7fb12ade945a2d580c | |||
"oauthlib==2.1.0", |
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 need of this anymore :)
I have opened a new clean one #109 |
No description provided.