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

Allow upload model #103

Merged
merged 14 commits into from
Apr 6, 2021
Merged

Allow upload model #103

merged 14 commits into from
Apr 6, 2021

Conversation

jvfdunkley
Copy link

@jvfdunkley jvfdunkley commented Mar 18, 2021

📌 References

📝 Implementation

  • Created a new component ModelUpload and copied over a lot of the CSS and design from the original basic HTML upload screen http://3dbionotes.cnb.csic.es/ws/submit
  • Added 2 Dropzones and validation so that only the structure file is necessary to proceed and you can only upload the correct file type (.pdb and .cif for structure file, .json for annotation file). You can click and select a file or drag and drop.
  • Added upload function to DbModelRepository, I passed the data to the endpoint but it is not fully functioning yet.

🎨 Screenshots

Screen Shot 2021-03-22 at 12 38 33 PM

🔥 How to test it? (If there is any special consideration or the reviewer does not know how to test it)

📑 Others

  • Any change in the API repo? If so, what branch/PR?
  • Any change in the GUI library? If so, what branch/PR?

@adrianq adrianq changed the base branch from feature/right-panel-contents to development March 19, 2021 13:03
@jvfdunkley jvfdunkley marked this pull request as ready for review March 23, 2021 08:51
Copy link

@tokland tokland left a comment

Choose a reason for hiding this comment

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

Comments with a couple of commits (as proposals).

Copy link
Author

@jvfdunkley jvfdunkley left a comment

Choose a reason for hiding this comment

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

changes look good!

@jvfdunkley jvfdunkley requested a review from tokland March 25, 2021 10:56
Copy link

@tokland tokland left a comment

Choose a reason for hiding this comment

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

A couple of minor comments, already commited, all good!

<label className="fileFormat">{i18n.t("Upload your annotations")}</label>
<Dropzone ref={annotationFileRef} accept={"application/json"}></Dropzone>

<button className="uploadSubmit" onClick={useCallbackEffect(onSubmitHandler)}>
Copy link

@tokland tokland Mar 25, 2021

Choose a reason for hiding this comment

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

Hook calls should be outside jsx blocks, so const submit = useCallbackEffect(onSubmitHandler). It's not only cleaner but also necessary, hooks must be executed always in the same order, and that JSX tag could be inside a conditional.

const structureFileRef = useRef<DropzoneRef>(null);
const annotationFileRef = useRef<DropzoneRef>(null);

const onSubmitHandler = useCallback(() => {
Copy link

@tokland tokland Mar 25, 2021

Choose a reason for hiding this comment

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

[good practices comment] The prop is called onSubmitHandler, that's ok, it's a generic function, but here we know what it does, so let's use a more declarative name on what it does. For example: const search = ....

@@ -47,6 +54,10 @@ export class EbiDbModelRepository implements DbModelRepository {
.value()
);
}
upload(options: UploadOptions): FutureData<unknown> {
const uploadResults = request(config.upload.searchUrl, options);
Copy link

Choose a reason for hiding this comment

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

We'll need a multipart/form-data POST to actually post these files, but let's leave this for the next PR, as here we concern ourselves mainly with the UI.

@adrianq adrianq merged commit d422701 into development Apr 6, 2021
@adrianq adrianq deleted the feature/upload-in-search branch February 17, 2022 07:39
p3rcypj pushed a commit that referenced this pull request Feb 14, 2024
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.

3 participants