-
Notifications
You must be signed in to change notification settings - Fork 2
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
More detailed file status #66
Conversation
a86e018
to
0de8a55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all makes sense. I added a few specific comments, but the overall shape and idea looks good.
def status_icon(status) | ||
# rubocop:disable Rails/OutputSafety | ||
return "<span class='glyphicon glyphicon-ok-sign text-success'></span>".html_safe if status == 'attached' | ||
"<span class='glyphicon glyphicon-question-sign'></span>".html_safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this idiom preferred (return if)? Otherwise if there are just two equal options (this or that) I find it a little easier to read if/else structures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we use icons semantically in this way, we should generally include an aria-label
see https://fontawesome.com/how-to-use/on-the-web/other-topics/accessibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-dce There's a rubocop/bixby rule we have for this: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/GuardClause
https://github.com/samvera-labs/bixby/blob/master/bixby_default.yml#L129
It will fail if you use an if / else block when you could have used a guard clause.
config/initializers/prepends.rb
Outdated
@@ -0,0 +1 @@ | |||
AttachFilesToWorkJob.prepend(AttachFilesToWorkJobPrepends) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use this same strategy to add additional logging to Hyrax background jobs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and doing that way avoids needing to override it which could be problematic if someone is already overriding a job.
spec/support/hyrax/basic_metadata.rb
Outdated
@@ -25,6 +25,9 @@ def self.included(work) | |||
work.property :related_url, predicate: ::RDF::RDFS.seeAlso | |||
work.property :bibliographic_citation, predicate: ::RDF::Vocab::DC.bibliographicCitation | |||
work.property :source, predicate: ::RDF::Vocab::DC.source | |||
|
|||
# From Zizia | |||
work.property :deduplication_key, predicate: 'http://metadata.example.com/vocab/predicates#deduplicationKey' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we just want to implement a primary_id
and find a better predicate. It feels like that's what most adopters are going to want anyway.
How about :RDF::VOCAB::BF2::identifiedBy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding a more specific predicate may ultimately be confusing because then institutions may be tempted to use it for some other purpose. Right now the the deduplication_key
is something that's only used for grouping the Work
and FileSet
s during the import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the predicate to ::RDF::VOCAB::BF2.identifiedBy
, but I really think we should keep using the name deduplication_key
since Emory is already using that.
18eed87
to
5520940
Compare
d066b75
to
661545d
Compare
fc797b1
to
86000db
Compare
This adds a status field to `PreIngestFile`s and `PreIngestWorks` that defaults to 'preingest'. The `ContentDepositEventJob` and `FileSetAttachedEventJob` classes are preprended with logic that updates their status to 'attached'. The logic requires that `deduplication_key` is present in the CSV so that field is added to the default mapper and validator. There is a helper which outputs a success icon (a green checkmark) if a `PreIngestFile` or `PreIngestWork` has an 'attached' status.
86000db
to
3004568
Compare
This adds a status field to
PreIngestFile
s thatdefaults to 'preingest'.
The
AttachFilesToWorkJob
class is preprended withlogic that updates the status to 'attached'.
The logic requires that
deduplication_key
is present in theCSV so that field is added to the default mapper and validator.
There is a helper which outputs a success icon (a green checkmark) if
the
PreIngestFile
has an 'attached' status. This is used for thePreIngestWork
if all the statuses for thePreIngestFile
are 'attached'.