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

Upload form #754

Merged
merged 17 commits into from
May 5, 2021
Merged

Upload form #754

merged 17 commits into from
May 5, 2021

Conversation

dannylamb
Copy link

Github Issue: Islandora/documentation#919

What does this Pull Request do?

Third attempt at a better upload form for media and children.

What's new?

New forms for uploading files and having all the appropriate entities created and wired up when the form is submitted. It respects the proposed changes we're putting forth in https://docs.google.com/document/d/14Dxzz-4U4L_ICqhZge99usp-LvhWJPFsvULp_32e7P4/edit (e.g. we support all the different use cases for multiple media, etc...) Plus some test cleanup.

How should this be tested?

Upload Media Form

  • Make a repository item
  • Visit its media tab
    image
  • Click the new "Upload Media" button
    image
  • Upload one or more files, and tick some checkboxes. Hit submit.
    image
  • You should be redirected to the "Media" tab's page. All the files should now be wrapped as media, given the selected usage terms, and assigned to the node. You can do multiples here, e.g. upload multiple original files if you want. I uploaded multiple images and make them both "intermediate files" and "transcripts", just to show you that it's possible.
    image

Upload Children Form

  • Make a collection (or any repository item, really)
  • Go to its "Children" tab
    image
  • Click on the new "Upload Children" button
    image
  • Upload some files. Select the content type for the children. If you select a content type that has field_model, then another dropdown will appear to let you select that as well. Also pick a media use for the uploaded files (we'll do Original File here to trigger derivatives).
    image
  • Hit submit and you'll get thrown into a batch while all the node/media/file combos get wired up. At the end you'll get redirected back to the Children management page.
    image
  • Go see one of the children and you'll see derivatives have kicked off and everything. Pretty snazzy!
    image

Interested parties

@Islandora/8-x-committers

@mjordan
Copy link

mjordan commented Apr 29, 2020

Just testing this now. I checked out your branch, drush cred, and created a repo item. When I went to the Media tab, I got an unexpected error, with this in the apache error.log:

[Wed Apr 29 03:37:48.257143 2020] [php7:notice] [pid 25686] [client 10.0.2.2:42202] Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginNotFoundException: "The "islandora_entity_bundle" plugin does not exist. Valid plugin IDs for Drupal\\Core\\Condition\\ConditionManager are: request_path_exclusion, node_is_islandora_object, node_has_term, content_entity_type, media_is_islandora_media, media_uses_filesystem, entity_bundle, node_had_namespace, media_has_mimetype, parent_node_has_term, node_has_parent, media_has_term, file_uses_filesystem, node_is_published, language, node_type, current_theme, request_path, user_role" at /var/www/html/drupal/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php line 53, referer: http://192.168.50.111:8000/node/2

I built this VM today, but in the Playbook's dev branch. That matter?

@dannylamb
Copy link
Author

@mjordan It's my branch that's out of date. I'll update it.

@manez
Copy link
Member

manez commented Apr 30, 2020

Putting what I said in the meeting in writing for posterity: even if having this for media in general is complicated and needs more discussion, I'd love to see this happen for "children." It's just such a quality-of-life improvement for adding books, and there are already ways to add metadata after-the-fact if pages do have their own data.

@mjordan
Copy link

mjordan commented Apr 30, 2020

Note: After you check out this branch, you need to clear Drupal's cache (drush cr) or you get the following error:

[Thu Apr 30 02:49:21.897142 2020] [php7:notice] [pid 20198] [client 10.0.2.2:43766] Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\RouteNotFoundException: "Route "islandora.upload_media" does not exist." at /var/www/html/drupal/web/core/lib/Drupal/Core/Routing/RouteProvider.php line 208, referer: http://localhost:8000/node/1

@mjordan
Copy link

mjordan commented Apr 30, 2020

OMFG @dannylamb this is awesome. 👍 💯 🤯 ❤️ 😂 🆒 😆 😭 🤕

Other should test this to make sure I am not hallucinating how mindblowingly incredible this feature is.

@mjordan
Copy link

mjordan commented Apr 30, 2020

🤕

@mjordan
Copy link

mjordan commented Apr 30, 2020

For objects with multiple files, it would be awesome to have each file displayed on the node view using an EVA appropriate for each file. This is what I was getting at in Islandora/documentation#1242.

@manez
Copy link
Member

manez commented May 7, 2020

I've tried this out locally (incidentally, this is the first time I have checked out a github branch the right way and tested a PR like this and I feel like a mix of hacker and wizard 😎). Works great!

File size limits are definitely a thing, and the page order seems a little random, but as a way to quick get small batches of content in, with a little straightening up afterwards, this rocks.

For big batches of ordered content, I think it reinforces the need for some kind batch-with-CSV process, to assign those page weights ahead of time. The drag & drop ordering is awesome for smaller books or correcting a page or two in a bigger one, but it won't hold up well for a 500 page book if the whole thing needs to be ordered.

@mjordan
Copy link

mjordan commented Jun 17, 2020

@dannylamb picking up on this - tests are failing. I can merge if we can get the build to complete.

@bryjbrown
Copy link
Member

I think any time we can simplify things for users with forms, its a win. +1 to this.

@dannylamb
Copy link
Author

Dusting this thang off

@dannylamb
Copy link
Author

This is working now. Let's see what the actions say.

@Islandora/8-x-committers It would be great if we could get this quality-of-life feature in before the release.

@elizoller
Copy link
Member

Screen Shot 2021-04-29 at 12 47 51 PM

lol @dannylamb is a first time contributor?

@dannylamb
Copy link
Author

i know, right?

@dannylamb
Copy link
Author

Ugh... Ima rebase this mess

@dannylamb
Copy link
Author

Hey @Islandora/8-x-committers, this has been tested and approved, and I've updated this so tests are passing. Can we push this through so it can be documented and tested and released? It's a serious UX improvement.

@elizoller
Copy link
Member

do you want someone else to test it?

@elizoller
Copy link
Member

I pulled this into a pretty vanilla d9 instance built with the playbook and tested per your instructions above. it did all work successfully. I was slightly confused by the duplicate buttons on the media tab - "Upload Media" vs "Add Media" and on the children tab "Upload Children" vs "Add Children". I understood what to do based on your testing instructions, but if this is going to roll out, I think it'd definitely require some added user documentation.
In addition, I added multiple files from the media "Upload Media" button and it did work, but it made me question the modelling because then I had two original file medias attached to one node and I'm not sure if that's a thing (it certainly isn't how we are modelling our objects) and I don't know how it interacts (or doesn't with the whole multi-file media thing).
So I guess I would say the code seems to all work, but maybe it needs more documentation to explain the different buttons and what they do and what the implications are on the modelling aspects of it.

@rosiel
Copy link
Member

rosiel commented May 4, 2021

The multifile media model is going to be something to document, for sure. I was also confused between "Add" and "Upload" and wonder if we could add the word "Batch" -- "Batch Upload Children" / "Batch Upload Media"? It sounds (to me) to have smaller expectations than "Bulk" (which I'd expect to be able to handle thousands).

@dannylamb
Copy link
Author

I totally agree that the language is awkward. "Batch" definitely sounds like the right word for what we're doing here. I can update that.

About multifile media... in another incarnation (I think the second attempt at this form?) I actually had a drop down for the media type. If I make a media type dropdown that uses states to make the media use appear, just like we do with content type and model, then it should fully support multifile media. I'm more than happy to add that back in, pretty sure I can just scrape it out of history from one my other PRs. Like with content type and model, we'll check to see if the media has field_media_use before showing the checkboxes, since you won't have that using multifile media.

@dannylamb
Copy link
Author

Also, thank you for looking at this @rosiel and @elizoller

@ajstanley
Copy link

Multifile should work beautifully with this - with the standard model bad things happen when you ingest two or more files tagged with Original File. With mutlifle, each Original File gets its own derivatives contained within the media; once the media is created Contexts do the rest.

@dannylamb
Copy link
Author

dannylamb commented May 5, 2021

What I've pushed up should be good with multifile media. You can now select the media type, which is nice. I was guessing before based on mimetype and that was starting to get hacky. I was even forgetting PDFs 😟

If anyone wants to try, you'll need to clear your cache. I re-labeled the action links and that won't show if you don't drush cr

@elizoller elizoller merged commit 5127e7f into Islandora:8.x-1.x May 5, 2021
@dannylamb
Copy link
Author

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.

7 participants