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

Back-Office UI: 67 loan details #97

Closed
wants to merge 13 commits into from

Conversation

topless
Copy link
Member

@topless topless commented Jan 10, 2019

No description provided.

@zzacharo
Copy link
Member

@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))`;
Copy link
Member

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?

Copy link
Member Author

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.

invenio_app_ils/ui/src/invenio_app_ils/common/api/loan.js Outdated Show resolved Hide resolved

export default class ItemMetadata extends Component {
render() {
switch (this.props.view) {
Copy link
Member

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?

Copy link
Member Author

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.

payload: newSortBy,
});

await dispatch(fetchDocumentItems(documentPid));
Copy link
Member

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...

Copy link
Member Author

@topless topless Jan 14, 2019

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.

Copy link
Member

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 => {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Gone.

@@ -32,6 +32,28 @@ export const fetchLoanDetails = loanPid => {
};
};

export const assignLoanItem = (loanId, itemId) => {
Copy link
Member

Choose a reason for hiding this comment

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

assignItemToLoan?

Copy link
Member Author

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

setup.py Show resolved Hide resolved
* 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`;
Copy link
Contributor

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

@@ -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}`,
Copy link
Contributor

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?

});

export const AvailableItems = compose(
withRouter,
Copy link
Member

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",
Copy link
Member

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 :)

@topless
Copy link
Member Author

topless commented Jan 16, 2019

I have opened a new clean one #109

@topless topless closed this Jan 16, 2019
@topless topless removed the review label Jan 16, 2019
@topless topless deleted the 67-loan-details branch February 27, 2019 14:50
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.

None yet

3 participants