collections: improve service and resource apis#110
collections: improve service and resource apis#110zzacharo merged 8 commits intoinveniosoftware:masterfrom
Conversation
1ba3ad8 to
091ea25
Compare
|
@jrcastro2, I am pretty biased on this one 😂 Probably somebody from the CDS/Zenodo team should look into it. |
| ctree=tree, | ||
| ) | ||
|
|
||
| # Try to delete without cascade should fail |
There was a problem hiding this comment.
Do we allow users to try to delete without cascade if there are children in the UI?
There was a problem hiding this comment.
Yes, the test there is for the service, the func requires the cascade param, the tests are meant so that if not passed it doesn't allow to delete the collection if there are children.
| path=path, | ||
| title=title, | ||
| search_query=query, | ||
| search_query=search_query, |
There was a problem hiding this comment.
What is the thinking behind renaming query to search_query?
Does it break backwards-compatibility?
There was a problem hiding this comment.
The reason for the rename is that IMHO it was wrong from before. In the Collection API obj we do have both, query property and the search_query, they are different things and at some point we are calling self.query and self.search_query, which could lead to confusion and it was actually causing issues for me so I decided to align things. The backwards compatibility would break if there is external code calling the Collection.create() (which I don't think should be the case). Other than that should be fine specially since it was a feature that was not fully used, but let me know if I am missing something.
e4b7426 to
7a43162
Compare
13442e0 to
b567c6e
Compare
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "3c1b8d0e7f52" | ||
| down_revision = "d2f434c0ac92" |
There was a problem hiding this comment.
@palkerecsenyi @jrcastro2 is this the correct revision?
There was a problem hiding this comment.
Thanks for checking, this looks correct. This is the latest revision
| import DeleteCollectionAction from "./actions/DeleteCollectionAction"; | ||
| import DeleteCollectionTreeAction from "./actions/DeleteCollectionTreeAction"; | ||
|
|
||
| class CollectionTreeCardGroup extends Component { |
There was a problem hiding this comment.
this component also needs responsibilities separation. Some of the states of the forms are belonging to child forms components, it is not entirely understandable to me why this parent component is evaluating these internal "children states"?
The component is very complex and needs simplifications in my opinion
There was a problem hiding this comment.
The reason the parent holds the form state is cuz of the change to use modal actions (on the demo it was suggested to use them), this means that the Save button lives in Modal.Actions but Formik is in the child, so we lift just { isValid, isSubmitting, handleSubmit } via onFormReady. I believe that the same approach used in other places.
In any case I moved each modal to single cmp so that the state of each is not in the parent and like that it might be a bit more understandable but still each parent modal holds the stat.
Still this cmp is quite complex since it has the darg logic as well, let me know if this is good enough or if we should try to move this away as well.
5890b4f to
a1bd862
Compare
slint
left a comment
There was a problem hiding this comment.
Minor comments on the backend parts, some shelveable.
* Complete resource layer with missing collections features * Enhance service layer * Add tests * Improve schema Co-Authored-By: egabancho <me@egabancho.com>
…y_id to namespace_id
| collection_tree_cls = CollectionTree | ||
| tree_schema = CollectionTreeSchema | ||
|
|
||
| links_item = { |
There was a problem hiding this comment.
Are there no other links?
There was a problem hiding this comment.
Good catch! I intentionally left just search for now because adding self_html requires the community slug, which isn't directly on the Collection model anymore (only namespace_id). I think this should be tackled when there is more work done on abstracting invenio-collections.
| ) | ||
| .scalar() | ||
| ) | ||
| data["order"] = (max_order or 0) + 10 |
There was a problem hiding this comment.
The reason to use 10 comes from the initial implementation where the order was a form field and the user could input it. It would be easier to insert a new value in a middle position if we use tens, otherwise we would need to update all the other values. Right now we mostly insert at the end by default and let the user reorder the values which ends up reassigning the order to all the values. So this is not that much needed still I believe is a nice addition to keep then separated by tens.
620e531 to
a22152c
Compare
a22152c to
4ad4366
Compare
4ad4366 to
2324fae
Compare
Uh oh!
There was an error while loading. Please reload this page.