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

Rails hyrax upgrade #318

Merged
merged 14 commits into from
Jan 23, 2024
Merged

Rails hyrax upgrade #318

merged 14 commits into from
Jan 23, 2024

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Jan 22, 2024

Note: The baseline logic for IiifPrint does not change with this PR. We introduce a Valkyrie and ActiveFedora adapter and default to the ActiveFedora adapter, thus preserving prior implementation behavior.

Were someone to use the Valkyrie adapter, there would likely be bugs. But that would require someone configuring an as of yet undocumented feature.

All told, this is a non-breaking PR that is more of a refactor than a feature add.

🎁 Override Hyku::WorksControllerBehavior

cad2cf3

This commit will account for a proposed Hyku::WorksControllerBehavior
in the Hyku/Hyrax 5 upgrade branch.

🚧 WIP to work with Valkyrie objects

cc105d0

Changed the #iiif_print_config? to a class_attribute so we don't have to
instantiate the object to check if it's configured. Added a next to the
indexer so if a curation concern does not have IIIF Print configured,
then we won't index the SetChildFlag onto it.

♻️ Favor explicit method over class attribute

f0d50f2

The class_attribute best serves cases where we might adjust
configuration at run-time or during initialization. In the case of of
the class method I am removing, it's subtly different than the ideal use
case for class_attribute.

The difference is such:

We include the configuration module into a model; this is the run time
configuration. And because we've "configured IIIF Print" for that
model, we always will have a .iiif_print_config? of true.

🧹 Add indexing paths for Valkyrie resource

5ab4c2a

This commit will add indexing paths for Valkyrie resources. The
IiifPrint::SimpleSchemaLoaderDecorator is introduced here to add the
IiifPrint::Engine.root path to the schema load path so we can keep the
yaml in the gem and not have to copy it over to the host app.

Remove instance variable declaration

8066b7e

This is not necessary and will keep an instance around
in memory for longer than we need

🎁 Add listener for handling file set attachment

e21cd78

Why a listener and not a transaction? In part because the moment I want
to perform the conditional enqueuing is at the point where the
Hyrax::WorkUploadsHandler does it's job. That is when we have:

  • the parent work
  • the file set
  • the original file
  • the user

The Hyrax::WorkUploadsHandler is most analogous to the behavior in
Hyrax::Actors::FileSetActor#attach_to_work and
Hyrax::Actors::FileSetActor#create_content. Fortunately, Hyrax's
transaction and upload handler remove the conditional handling we needed
between uploading a remote file and directly uploading a file.

Related to:

🧹 Avoid mutating super's array

321613e

Prior to this commit, each time we called config_search_paths we would
append IiifPrint::Engine.root to the instances array. This mean that
we could continue to prepend many times resulting in many entries of
IiifPrint::Engine.root in the instance's array.

With this change we avoid mutating the array in super.

Move towards adapter logic

ff11975

🧹 Switch fetching objects based on persistence layer

7cde6af

Fundamental assumption, based on the double_combo branch of Hyrax is
that we will be able to use Valkyrie queries to Solr and Fedora for all
objects in the repository.

See samvera/hyrax#6221 (comment)

♻️ Restore decoration based on work types

fc96714

Adding safe constantize to handle new-ish object that we decorate

48053b4

kirkkwang and others added 13 commits January 2, 2024 10:53
This commit will account for a proposed `Hyku::WorksControllerBehavior`
in the Hyku/Hyrax 5 upgrade branch.
Changed the #iiif_print_config? to a class_attribute so we don't have to
instantiate the object to check if it's configured.  Added a next to the
indexer so if a curation concern does not have IIIF Print configured,
then we won't index the SetChildFlag onto it.
The `class_attribute` best serves cases where we might adjust
configuration at run-time or during initialization.  In the case of of
the class method I am removing, it's subtly different than the ideal use
case for `class_attribute`.

The difference is such:

We include the configuration module into a model; this is the run time
configuration.  And because we've "configured IIIF Print" for that
model, we always will have a `.iiif_print_config?` of true.
This commit will add indexing paths for Valkyrie resources.  The
`IiifPrint::SimpleSchemaLoaderDecorator` is introduced here to add the
`IiifPrint::Engine.root` path to the schema load path so we can keep the
yaml in the gem and not have to copy it over to the host app.
This is not necessary and will keep an instance around
in memory for longer than we need
* main:
  🎁 Add Transaction for Cleaning Up Split Pages
  ♻️ Extract direct ActiveFedora calls to adapter
Why a listener and not a transaction?  In part because the moment I want
to perform the conditional enqueuing is at the point where the
`Hyrax::WorkUploadsHandler` does it's job.  That is when we have:

- the parent work
- the file set
- the original file
- the user

The `Hyrax::WorkUploadsHandler` is most analogous to the behavior in
`Hyrax::Actors::FileSetActor#attach_to_work` and
`Hyrax::Actors::FileSetActor#create_content`.  Fortunately, Hyrax's
transaction and upload handler remove the conditional handling we needed
between uploading a remote file and directly uploading a file.

Related to:

- scientist-softserv/hykuup_knapsack#35
- scientist-softserv/hykuup_knapsack#99
- #312
Prior to this commit, each time we called `config_search_paths` we would
append `IiifPrint::Engine.root` to the instances array.  This mean that
we could continue to prepend many times resulting in many entries of
`IiifPrint::Engine.root` in the instance's array.

With this change we avoid mutating the array in `super`.
* main:
  🎁 Add listener for handling file set attachment
Fundamental assumption, based on the `double_combo` branch of Hyrax is
that we will be able to use Valkyrie queries to Solr and Fedora for all
objects in the repository.

See samvera/hyrax#6221 (comment)
Copy link
Contributor

@laritakr laritakr left a comment

Choose a reason for hiding this comment

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

Other than the lint error, looks reasonable

The indexer logic fix is based on #319
@jeremyf jeremyf merged commit 2f6efa2 into main Jan 23, 2024
8 checks passed
@jeremyf jeremyf deleted the rails_hyrax_upgrade branch January 23, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants