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

Data seeds improvements #5056

Closed
wants to merge 384 commits into from
Closed

Data seeds improvements #5056

wants to merge 384 commits into from

Conversation

apertome
Copy link

@apertome apertome commented Jul 28, 2021

Reimplement database seeds using Valkyrie rather than ActiveFedora. Add option for multiple seed files and an environment variable to control whether they are loaded

Changes proposed in this pull request:

A few caveats:

  • First attempt at implementing this used Monograph but had some issues in dassie with that. So the work is created as a GenericWork and the valkyrie_resource is retrieved.
  • Not all the categories from the sheet are implemented yet
  • File attachment is not implemented yet
  • The script attempts to set the collections/works as public, but this doesn't seem to actually work as implemented

@samvera/hyrax-code-reviewers

@dlpierce dlpierce self-assigned this Aug 11, 2021
@jlhardes
Copy link
Contributor

Work on #4788 Hyrax::Works do not show thumbnail in Dashboard -> Works also connected to this PR work.

elrayle and others added 27 commits October 8, 2021 11:46
Co-authored-by: Chris Colvard <chris.colvard@gmail.com>
Co-authored-by: Chris Colvard <chris.colvard@gmail.com>
add basic required metadata to the pcdm collection form
Add administrative set form with minimal metadata
add config for setting admin set model
existing collections indexed as `'Collection'` and those created with `Wings`
should still turn up in queries.

probably we should be using the indexed `generic_type` for these filters instead
of a list of models, but this keeps compatibility until we can work that out.
updates metadata in the model and indexer
For some reason there were two spec files testing `Hyrax::AdministrativeSetIndexer`.  One in `hyrax/administrative_set_indexer_spec.rb`.  The other in `hyrax/valkyrie_administrative_set_indexer_spec.rb`.  The tests are the same in both spec files.  I removed the one starting with `valkyrie` because the other one follows the normal naming conventions.
we want these stubs to apply for whatever collection class is in use in the test
suite.
this partial has apparently never resolved properly; it's test was stubbed.

this fixes the reference and forces the template to resolve to pass the view spec
this presenter method was previously deprecated in favor of a helper. it looks
like this view got missed in that update.
update these expectations to be sensitive to current model class filter
considerations. use the Valkyrie test class `Monograph` as the dummy work class,
since `GenericWork` is likely to be removed from the test app at some point.
this is a case where we are doing a whole collection lookup just to then pass
the id to the collaborator service. skip this and save the DB round trip.
`Dashboard::CollectionsController` tests still have quite a few hard-coded class
expectations. this loosens a few of them up.
we want to be able to take actions (e.g. to log, or send timeseries data), when
a collection changes its membership. add a hook for this.
when using a collection class other than `::Collection`, apply Hyrax's
curation_concern permissions. (e.g. this allows `#create`).
map `Hyrax::PcdmCollection` to `Hyrax::Forms::PcdmCollectionForm` for the
factory method's purposes.
`Dashboard::CollectionsController#create` has some behavior to avoid CanCan's
load_resource hook. the reasons for avoiding this are a bit opaque, but we
definitely don't want to carry this forward. disabling it immediately does
actually fail some tests, so instead limit the skip to cases where an
ActiveFedora collection class is in use.
if a ChangeSet has a `#collection_type_gid` value, never override it with the
default.
Valkyrie models don't index automatically on save, so setting a "re-index
extent" on the model doesn't make much sense.

it's honestly not clear to me that this line does anything at all. the
collection doesn't appear to be saved (or indexed) as part of this controller's
logic.

whatever the case, it turns out that just not failing on this assignment makes
this controller's unit tests pass. we'll definitely want to look closer at
it, since the controller is doing `load_and_authorize_resource` on the whole
collection just to then pass through the id to a collaborator---do we need to
load the object, or just authorize based on id and move on?
this actor won't be updated for compatibility with Valkyrie-based collection
models. skip its tests in the case that Valkyrie is in use for Collection.
these specs stubbed ActiveFedora in unnecessary places, and just generally had
convoluted setup and expectations (one test memoized an empty array, used a
before block to populate it, and then checked its contents as the only
expectation!).

don't exercise code under test in `subject` or `before`.
query collection from Valkyrie and use it to handle PermissionsCreateService
logic.
elrayle and others added 24 commits January 27, 2022 14:15
a first hack at editing admin sets using Valkyrie
initial take on support create for valkyrie administrative sets
Valkyrized applications can't use the legacy MemberPresenterFactory, which
depends on the AF `list_source`
Valkyrized FileSets don't have a `#parent` method, but the FileSetController
provides a helper method we can use for compatibility
chart: document chart publishing process
Collection type gid is required for listing admin sets at Dashboard -> Collections.  This is what identifies this as an admin set.
add collection_type_gid attribute to Hyrax::AdministrativeSets
// Date picker on safari placeholder text was misaligned
@media screen {
@media screen and (-webkit-min-device-pixel-ratio: 0) {
input[type="date"].form-control {

Choose a reason for hiding this comment

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

Avoid qualifying attribute selectors with an element.
Avoid qualifying class selectors with an element.

@apertome
Copy link
Author

Pushed some updates to this, but I'm getting some flakiness still.

Current behavior looks like:

  • Some seed collections and works are created
  • Currently works are being created as GenericWorks. I think this is mostly working but no image attachments yet -- still need to figure out how to do that.
  • The seeds script is able to create Works and automatically assicate with Default Admin Set

generic_work_default_admin_set

  • It can also associate Works with Collections:

generic_work_in_a_collection

  • The seed script is not creating Monograph works, but when I try to add some manually via the GUI, and upload files, it seems like it recognized that there are supposed to be files but any time you try to access them (either to view, download, or edit) there are errors like this:

hyrax_objectnotfounderror

@dlpierce
Copy link
Contributor

dlpierce commented Mar 2, 2022

Closing in favor of #5472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet