Skip to content

Commit

Permalink
Merge branch 'main' into flexible_double_combo
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkkwang committed Aug 23, 2024
2 parents bc14e4d + b02cd98 commit a94f39e
Show file tree
Hide file tree
Showing 36 changed files with 184 additions and 113 deletions.
3 changes: 3 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ changelog:
- title: Tests and CI Process
labels:
- notes-tests
- title: Accessibility Standards
labels:
- notes-accessibility
- title: Other
labels:
- "*"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Build Test Lint'
run-name: Build Test Lint of ${{ github.ref_name }} by @${{ github.actor }}
name: 'Lint Build Test'
run-name: Link Build Test of ${{ github.ref_name }} by @${{ github.actor }}
on:
push:
branches:
Expand Down Expand Up @@ -123,23 +123,12 @@ jobs:
name: spec-reports-${{ matrix.ci_test_app }}-${{ matrix.ci_node_index }}
path: '**/rspec*.xml'

report:
needs: test
event_file:
name: "Event File"
runs-on: ubuntu-latest
permissions:
checks: write
# only needed unless run with comment_mode: off
pull-requests: write
if: always()
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: "*report*"
- name: Publish Test Report
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"
action_fail_on_inconclusive: true
fail_on: "test failures"
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
40 changes: 40 additions & 0 deletions .github/workflows/test-results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test Results

on:
workflow_run:
workflows: ["Lint Build Test"]
types:
- completed
permissions: {}

jobs:
test-results:
name: Test Results Check
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'

permissions:
checks: write
# needed unless run with comment_mode: off
pull-requests: write
# required by download step to access artifacts API
actions: read

steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
name: ".*(report|Event).*"
name_is_regexp: true

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
action_fail_on_inconclusive: true
fail_on: "test failures"
8 changes: 6 additions & 2 deletions .koppie/config/initializers/1_valkyrie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
ENV.fetch('FCREPO_URL') { "http://localhost:8080/fcrepo/rest" })),
base_path: Rails.env,
schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new(Hyrax::SimpleSchemaLoader.new.permissive_schema_for_valkrie_adapter),
fedora_version: 6
fedora_version: 6.5,
fedora_pairtree_count: 4,
fedora_pairtree_length: 2
), :fedora_metadata
)

Expand Down Expand Up @@ -64,7 +66,9 @@
connection: ::Ldp::Client.new(Hyrax.config.fedora_connection_builder.call(
ENV.fetch('FCREPO_URL') { "http://localhost:8080/fcrepo/rest" })),
base_path: Rails.env,
fedora_version: 6
fedora_version: 6.5,
fedora_pairtree_count: 4,
fedora_pairtree_length: 2
), :fedora_storage
)

Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/hyrax/analytics_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function trackAnalyticsEvents(provider) {
if(provider !== 'ga4') {
window.trackingTags.analytics().push([window.trackingTags.trackEvent(), eventSpan.data('category'), eventSpan.data('action'), eventSpan.data('name')]);
} else {
gtag('event', eventspan.data('action'), { 'content_type': eventspan.data('category'), 'content_id': eventspan.data('name')})
gtag('event', eventSpan.data('action'), { 'content_type': eventSpan.data('category'), 'content_id': eventSpan.data('name')})
}
})
}
Expand All @@ -69,7 +69,7 @@ if (typeof Turbolinks !== 'undefined') {
setupTracking()
})
} else {
$(document).on('ready', function() {
$(document).ready(function() {
setupTracking()
})
}
Expand Down
5 changes: 2 additions & 3 deletions app/assets/javascripts/hyrax/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

this.init = function() {
this.$label = this.$element.find('[data-search-element="label"]');
this.$visibleLabel = this.$element.find('.dropdown-toggle').find('span[aria-hidden="true"]');
this.$items = this.$element.find('[data-search-option]');
this.setDefault();
}
Expand All @@ -12,7 +13,6 @@
this.attachEvents();
}


Hyrax.Search.prototype = {
attachEvents: function() {

Expand Down Expand Up @@ -43,6 +43,7 @@

setLabel: function(label) {
this.$label.html(label);
this.$visibleLabel.html(label);
}

}
Expand All @@ -58,8 +59,6 @@

})(jQuery);


Blacklight.onLoad(function() {
$('#search-form-header').search();
});

4 changes: 4 additions & 0 deletions app/assets/stylesheets/hyrax/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
margin-bottom: 20px;
}

#featured_works .card {
margin-bottom: 5px;
}

.card-title {
margin-top: 0;
margin-bottom: 0;
Expand Down
10 changes: 10 additions & 0 deletions app/assets/stylesheets/hyrax/_catalog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
}
}

.search-results-title-row {
.badge {
margin-bottom: 6px;
}

.search-result-title {
margin-right: 16px;
}
}

.collection-icon-search {
padding-bottom: 20px;
}
Expand Down
12 changes: 12 additions & 0 deletions app/assets/stylesheets/hyrax/_facets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
width: 100%;
}

.facet-field-heading button.collapsed::after {
transition: transform 0.25s ease;
}

.facet-field-heading button::after {
transition: transform 0.25s ease;
}

.collapsing {
transition: height 0.25s ease;
}

.facets-header > .navbar-toggler {
display: none;
}
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/hyrax/_featured.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ ol#featured_works {
padding: 1em 0;
border-bottom: 1px dotted $gray-lighter;
}

.dd-handle.dd3-handle {
z-index: 1;
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/hyrax/_forms.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
legend small {
margin-left: 0.5em;
color: #999999;
color: #595959;
font-size: 15px;
}

Expand Down
17 changes: 9 additions & 8 deletions app/assets/stylesheets/hyrax/_nestable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ tr.dd-item {

.dd-placeholder,
.dd-empty { margin: 5px 0; padding: 0; min-height: 30px; border: 1px dashed #b6bcbf; box-sizing: border-box; -moz-box-sizing: border-box; }
.dd-empty { border: 1px dashed #bbb; min-height: 100px;
background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
.dd-empty { border: 1px dashed #bbb; min-height: 100px;
background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
-webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
-moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
background-size: 60px 60px;
background-position: 0 0, 30px 30px;
Expand Down Expand Up @@ -82,7 +82,7 @@ tr.dd-item {
background: #fafafa;
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(to bottom, #fafafa 0%, #eee 100%);
-webkit-border-radius: 3px;
border-radius: 3px;
box-sizing: border-box; -moz-box-sizing: border-box;
Expand All @@ -95,15 +95,16 @@ tr.dd-item {

.dd3-item > button { margin-left: 30px; }

.dd3-handle {
.dd3-handle {
position: absolute; margin: 0; left: 0; top: 0; cursor: pointer; width: 30px;
text-indent: 100px;
white-space: nowrap; overflow: hidden;
border: 1px solid #aaa;
background: #ddd;
background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%);
background: -moz-linear-gradient(top, #ddd 0%, #bbb 100%);
background: linear-gradient(top, #ddd 0%, #bbb 100%);
background: -moz-linear-gradient(top, #ddd 0%, #bbb 100%);
background: -o-linear-gradient(to bottom, #ddd 0%, #bbb 100%);
background: linear-gradient(to bottom, #ddd 0%, #bbb 100%);
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
Expand Down
25 changes: 8 additions & 17 deletions app/models/hyrax/statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,20 @@ def statistics(object, start_date, user_id = nil)

def query_works(query)
models = Hyrax::ModelRegistry.work_rdf_representations.map { |m| "\"#{m}\"" }
Hyrax::SolrService.query("has_model_ssim:(#{models.join(' OR ')})", fl: query, rows: 100_000)
response = Hyrax::SolrService.get(fq: "has_model_ssim:(#{models.join(' OR ')})", 'facet.field': query, 'facet.missing': true, rows: 0)
Hash[*response['facet_counts']['facet_fields'][query]]
end

def work_types
results = query_works("human_readable_type_tesim")
results.group_by { |result| result['human_readable_type_tesim']&.join('') || "Unknown" }.transform_values(&:count)
types = query_works("human_readable_type_sim")
types['Unknown'] = types.delete(nil)
types
end

def resource_types
results = query_works("resource_type_tesim")
resource_types = []
results.each do |y|
if y["resource_type_tesim"].nil? || (y["resource_type_tesim"] == [""])
resource_types.push("Unknown")
elsif y["resource_type_tesim"].count > 1
y["resource_type_tesim"].each do |t|
resource_types.push(t)
end
else
resource_types.push(y["resource_type_tesim"].join(""))
end
end
resource_types.group_by { |rt| rt }.transform_values(&:count)
types = query_works("resource_type_sim")
types['Unknown'] = types.delete(nil)
types
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/hyrax/menu_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def settings_section?
def nav_link(options, also_active_for: nil, **link_html_options)
active_urls = [options, also_active_for].compact
list_options = active_urls.any? { |url| current_page?(url) } ? { class: 'active nav-item' } : { class: 'nav-item' }
tag.li(list_options) do
tag.li(**list_options) do
link_to(options, link_html_options) do
yield
end
Expand Down
21 changes: 11 additions & 10 deletions app/services/hyrax/analytics/ga4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ module Ga4
extend ActiveSupport::Concern
# rubocop:disable Metrics/BlockLength
class_methods do
def client
@client
end

def client=(value)
@client = value
end

# Loads configuration options from config/analytics.yml. You only need PRIVATE_KEY_PATH or
# PRIVATE_KEY_VALUE. VALUE takes precedence.
# Expected structure:
Expand Down Expand Up @@ -70,8 +62,17 @@ def valid?
REQUIRED_KEYS.all? { |required| @config[required].present? }
end

def base64?(value)
value.is_a?(String) && Base64.strict_encode64(Base64.decode64(value)) == value
end

def account_json_string
@account_json ||= @config['account_json'] || File.read(@config['account_json_path'])
return @account_json_string if @account_json_string
@account_json_string = if @config['account_json']
base64?(@config['account_json']) ? Base64.decode64(@config['account_json']) : @config['account_json']
else
File.read(@config['account_json_path'])
end
end

def account_info
Expand All @@ -87,7 +88,7 @@ def account_info
end

def client
self.class.client ||= ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new do |conf|
@client ||= ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new do |conf|
conf.credentials = config.account_info
end
end
Expand Down
10 changes: 10 additions & 0 deletions app/services/hyrax/analytics/ga4/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ module Ga4
class Base
attr_reader :start_date, :end_date, :dimensions, :metrics

def initialize(start_date:,
end_date:,
dimensions: [],
metrics: [])
@start_date = start_date.to_date
@end_date = end_date.to_date
@dimensions = dimensions
@metrics = metrics
end

def filters
@filters ||= {}
end
Expand Down
4 changes: 0 additions & 4 deletions app/services/hyrax/analytics/ga4/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ def initialize(start_date:,
dimensions: [{ name: 'eventName' }, { name: 'contentType' }, { name: 'contentId' }],
metrics: [{ name: 'eventCount' }])
super
@start_date = start_date.to_date
@end_date = end_date.to_date
@dimensions = dimensions
@metrics = metrics
end

def self.list(start_date, end_date, action)
Expand Down
Loading

0 comments on commit a94f39e

Please sign in to comment.