To run the test runner in the interactive watch mode:
npm test
See the creat-react-app's documentation about running tests for more information.
To run the tests once:
# Bash
CI=true npm test
# Fish
env CI=true npm test
React application for Invenio deposit forms.
Home Page: https://react-invenio-deposit.readthedocs.io
License: MIT License
To run the test runner in the interactive watch mode:
npm test
See the creat-react-app's documentation about running tests for more information.
To run the tests once:
# Bash
CI=true npm test
# Fish
env CI=true npm test
DepositController.uploadDraftFiles
method to delegate the all the action to the DepositFileUploader
.uploadDraftFiles = async (record, files, { store }) => {
const recordSerializer = store.config.recordSerializer;
const payload = recordSerializer.serialize(record);
if (!this.draftAlreadyCreated(payload)) {
this.createDraft(payload, { store });
}
for (const file of files) {
this.fileUploader.upload(file, { store });
}
};
then the corresponding DepositFileUploader
methods should be created
initializeUpload
initializeUpload = async (files, {store}) => {
store.dispatch({
type: 'FILE_UPLOAD_INITIATE',
payload: { fileName: file.name, size: file.size },
});
const resp = await this.apiClient.initializeUpload(files)
// TODO: update state with response
}
startUpload
startUpload = async (file, {store}) => {
store.dispatch({
type: 'FILE_UPLOAD_EXECUTE',
payload: { fileName: file.name },
});
const resp = await this.apiClient.startUpload(file)
// TODO: update state with response
}
completeUpload
completeUpload = async (file, {store}) => {
store.dispatch({
type: 'FILE_UPLOAD_COMPLETE',
payload: { fileName: file.name },
});
const resp = await this.apiClient.completeUpload(file)
// TODO: update state with response
}
upload
upload = async (file, {store}) => {
this.initializeUpload(file)
this.startUpload(file)
this.completeUpload(file)
}
POST /api/records/12345-aaaaa/draft/files
Request Payload
POST /api/records/12345-aaaaa/draft/files HTTP/1.1
[
{
# Required
"key": "article.pdf",
# Optional
"checksum": "md5:abcdef...",
"size": 2048, # 2kB
"metadata": {
"description": "Published article PDF.",
},
}
]
Response payload
HTTP/1.1 201 OK
{
"entries": [
{
"id": "...",
"created": "2020-11-15T19:04:22",
"updated": "2020-11-15T19:04:22",
"key": "article.pdf",
"checksum": "md5:abcdef...",
"size": 2048,
"metadata": {
"description": "Published article PDF.",
},
"links": {
# To be used for the actual file "transmission"
"upload": {
"href": "/api/records/12345-aaaaa/draft/files/article.pdf/upload",
"method": "PUT"
}
"self": "/api/records/12345-aaaaa/draft/files/article.pdf",
}
},
],
}
PUT /records/:id/draft/files/:key/upload
PUT /api/records/12345-aaaaa/draft/files/article.pdf/upload HTTP/1.1
<...article.pdf raw bytes..>
Response payload
HTTP/1.1 201 OK
# Might slightly change to return a Files-REST response
{
"mimetype": "application/zip",
"checksum": "md5:2942bfabb3d05332b66eb128e0842cff",
"size": 13264,
}
POST /records/:id/draft/files/:key/commit
Request payload
POST /api/records/12345-aaaaa/draft/files/article.pdf HTTP/1.1
Response payload
HTTP/1.1 200 OK
{
"id": "...",
"created": "2020-11-15T19:04:22",
"updated": "2020-11-15T19:04:22",
"key": "article.pdf",
"checksum": "md5:abcdef...",
"size": 2048,
"metadata": {
"description": "Published article PDF.",
},
"links": {
"self": "/api/records/12345-aaaaa/draft/files/article.pdf",
}
}
Implement a upload flow when an exteral storage is used e.g S3 (M/L)
We are going to have to implement the deposit page form fields. Starting from this mockup
but simplifying things as much as we can for this first pass. Goal is to just get a sense for integration and get minimum viable form field in each case.
(extracted from #22 - this deals solely with the UI/looks)
Package version (if known): 0.12.X
Make sure all potential errors during the upload process are being handled and appropriate cleanup is done.
See #4
Data Model Question: (implications extend beyond just frontend and into backend)
Can this field be repeatable? If the record contains multiple publishers. This came up from librarians on our side: we have 105 deposits with multiple publishers (only 1.4% of our collection).
When an entry is added to an ArrayField. The UI goes from (for example):
to:
I see 2 possibilities:
This is related to making sure each of our Field component is implemented similarly so that styling and spacing affects them similarly.
We should feed the UI components as much as we can with the same objects/fields (i.e schema) that we receive from the API response. This will make easier the understanding of the data format that the components are expecting and might decomplexify the debugging of issues in the future.
Package version (if known): 0.7.8
The "Related Work" field (internally related identifiers) says "add related identifier" and then on the record landing page also says "Related Identifiers", but the field label is "Related work". The wording should be consistent everywhere.
Creators and Contributors that are people can have an affiliation. This task is about adding (back) the frontend component for it.
Package version (if known): 0.7.8
[x]
button look like other ArrayField close button[x]
button delete the entry (this applies to all other ArrayField close buttons too). Right now the onClick callback is assigned to the x
icon.Sub of #4 for creators + contributors field
This is the component side of the issue about revisiting the FundingField inveniosoftware/invenio-rdm-records#264 .
It also depends on the more general task of creating an API backend backed field: #82
When you submit a new draft without a titles
entry then the error you get back from the request response has the shape:
"errors" : [
{
"parents": [],
"field": "titles",
"message": "Missing data for required field."
},
...
]
Currently the TitlesField
component is displaying only errors in the format titles.{index}.title
thus the above errors are not handled correctly.
See #4
Data Model Question:
Can this field be repeatable? If the record contains multiple languages the https://en.wikipedia.org/wiki/ISO_639-3 code mul
can be used but it doesn't specify which languages. This came up from librarians on our side.
EDIT
Yes, multiple languages are supported.
We are getting warnings in the frontend, about using null
as an initial value for some form elements. This is because we do want null
in the formik initialValues as a way to differentiate fields that change when we submit to the backend (formik touches all fields when it validates so we can't use touched
) and if we did use ""
we would have no way of differentiating with a user inputting an empty string (or more realistically deleting some text ... unless there is a way to compare initialValue with values...)
The functionality works though, but fixing the warnings is probably a good idea.
See #4 (grouped functionality so together)
serialize
methoddeserialize
methodremoveEmptyValues
methodSee #4
PRs:
Check the final mockups in #91 and implement the different views.
Note: needed backend might not be there but we can implement all the views even as placeholders!
Style file uploader views
See #4
See #4
The file uploader holds a redux state with the current uploaded/ongoing files. This state should remain intact and the files representation from/to the backend should be handled centrally e.g de/serializer props.
See #4
See #4
The top-level form fields have the same font characteristics as the sub fields. This makes it especially hard to differentiate between top-level required fields and sub-level required fields (i.e. fields that are required only if filled).
We should make top-level fields visually different somehow.
Not in the mockup, but in the backend. Have something similar to DescriptionsField for internal notes.
Here there is an await: https://github.com/inveniosoftware/react-invenio-deposit/pull/60/files#diff-b5b3deb83dcaa18c58f0a85d23df3e40R51 but there is also in the create function that it calls (
). I wonder if it is really needed.List of mockups
See #4
Awards, keywords and licenses (those are the ones that came to mind) fields all need a way to plug into a backend API to populate options. There should be a common field to achieve this that is then customized/enhanced for each case.
See #4
See #4 . This one will need to be revisited when we settle on how access is all structured. But it is blocking the record page from rendering and having all components for needed fields covered, so it should be done in a quick simplistic manner first.
A simplistic component is tackled in this issue:
with no mechanical impact other than badge visibility.
This may be connected to #1 .
React gives a warning about some form elements being uncontrolled and then controlled. Again everything works, but this warning is probably alerting us of an edge case that would be hard to identify otherwise. We should see what can be done to remove this warning.
If I recall correctly, @lnielsen wanted to collapse the 2 dropdowns into one. This will make that field take less space and allow us to reuse it elsewhere in the form nicely (see Related Work field).
A single dropdown with resource type choices in the form of
<General> / <Subtype>
See #4 . Similar to each other.
DELETE /records/:id/draft/files/:key
From a previous discussion:
If the missing
value for a Boolean field (or other) on the backend is True, then when it is set to False on the frontend, the serialization would strip it and the backend not seeing it would set the field back to True... This is actually true for all fields...
It is not enough that we are using PUT in the end.
We need to decide how we deal with empty values on the frontend. Ideally we would do a diff of initialValues and final form.values and use a PATCH... but meanwhile we have to find a compromise that works.
We should test large file uploads e.g 20gb+
See #4 . They are similar to each other and in the same section so might as well do both at the same time. Splitting them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.