From 7e4136169003afb1f6a386f78540641fadf9e0f1 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 10 Aug 2020 17:15:18 -0700 Subject: [PATCH] Updated the entires show view to include the accodian view, icon button, minimal styles. Plus a little work on importer show view to include the tabbed view for the collection versus work and the inclusion of one accordian, still need to add the accodian view to errors (#228) Co-authored-by: April Rieger Co-authored-by: Benjamin Kiah Stroud --- .gitignore | 1 + Gemfile.lock | 2 + app/assets/javascripts/bulkrax/application.js | 2 + app/assets/stylesheets/bulkrax/accordion.scss | 40 +++ .../stylesheets/bulkrax/application.css | 20 +- app/assets/stylesheets/bulkrax/coderay.scss | 264 ++++++++++++++++++ .../stylesheets/bulkrax/import_export.scss | 37 +++ .../bulkrax/entries/_parsed_metadata.html.erb | 19 ++ .../bulkrax/entries/_raw_metadata.html.erb | 19 ++ app/views/bulkrax/entries/show.html.erb | 56 +--- app/views/bulkrax/exporters/show.html.erb | 139 ++++----- app/views/bulkrax/importers/show.html.erb | 261 ++++++++--------- .../bulkrax/shared/_bulkrax_errors.html.erb | 59 ++++ .../shared/_bulkrax_field_mapping.html.erb | 46 +++ bulkrax.gemspec | 1 + 15 files changed, 685 insertions(+), 281 deletions(-) create mode 100644 app/assets/stylesheets/bulkrax/accordion.scss create mode 100644 app/assets/stylesheets/bulkrax/coderay.scss create mode 100644 app/assets/stylesheets/bulkrax/import_export.scss create mode 100644 app/views/bulkrax/entries/_parsed_metadata.html.erb create mode 100644 app/views/bulkrax/entries/_raw_metadata.html.erb create mode 100644 app/views/bulkrax/shared/_bulkrax_errors.html.erb create mode 100644 app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb diff --git a/.gitignore b/.gitignore index feeb43d3..b3199946 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ spec/test_app/log/*.log spec/test_app/tmp/ coverage/** .byebug_history +.DS_Store tmp/** .env.* \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 8bc3395c..68594864 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,6 +12,7 @@ PATH specs: bulkrax (0.1.0) bagit (~> 0.4) + coderay iso8601 (~> 0.9.0) language_list (~> 1.2, >= 1.2.1) libxml-ruby (~> 3.1.0) @@ -164,6 +165,7 @@ GEM activesupport (>= 4.0.0) mime-types (>= 1.16) clipboard-rails (1.7.1) + coderay (1.1.3) concurrent-ruby (1.1.6) connection_pool (2.2.2) crass (1.0.6) diff --git a/app/assets/javascripts/bulkrax/application.js b/app/assets/javascripts/bulkrax/application.js index dd80ecef..4890b662 100644 --- a/app/assets/javascripts/bulkrax/application.js +++ b/app/assets/javascripts/bulkrax/application.js @@ -11,4 +11,6 @@ // about supported directives. // +//= require jquery +//= require bootstrap-sprockets //= require_tree . diff --git a/app/assets/stylesheets/bulkrax/accordion.scss b/app/assets/stylesheets/bulkrax/accordion.scss new file mode 100644 index 00000000..944c2a1f --- /dev/null +++ b/app/assets/stylesheets/bulkrax/accordion.scss @@ -0,0 +1,40 @@ +.accordion-icon { + float: right; + margin: 0 auto; + font-size: 22px; + transform: rotate(45deg); + margin-top: -2px; +} + +.accordion-container { + width: 100%; + padding: 0px; + margin: 10px 0px; + border-radius: 4px; + border: 1px solid #dedede; +} + +.accordion-heading { + padding: 14px 15px; + background-color: #f5f5f5; + border-radius: 3px; +} + +.accordion-title { + font-size: 14px; + font-weight: bold; + color: #4E4A42; + &:hover { + color: #4E4A42; + } +} + +.accordion-collapse { + width: 100%; + padding: 0px; +} + +.accordion-body { + padding: 14px; + width: 100%; +} \ No newline at end of file diff --git a/app/assets/stylesheets/bulkrax/application.css b/app/assets/stylesheets/bulkrax/application.css index 7e2ed8f8..5dddbfc2 100644 --- a/app/assets/stylesheets/bulkrax/application.css +++ b/app/assets/stylesheets/bulkrax/application.css @@ -12,22 +12,4 @@ * *= require_tree . *= require_self - */ - -div.importer_parser_fields_file_style span.radio { - display: inline; - margin-right: 20px; -} - -div#file_upload, div#file_path { - display: none -} - -div.hide-required-tag .required-tag { - display: none; -} - -div#s2id_exporter_export_source_collection { - border: none; - padding: 0; -} + */ \ No newline at end of file diff --git a/app/assets/stylesheets/bulkrax/coderay.scss b/app/assets/stylesheets/bulkrax/coderay.scss new file mode 100644 index 00000000..c781bb1c --- /dev/null +++ b/app/assets/stylesheets/bulkrax/coderay.scss @@ -0,0 +1,264 @@ +#bulkrax-raw-toggle-1, #bulkrax-raw-toggle-2 { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 13px; +} + +.CodeRay { + background-color: #FFF; + border: 1px solid #CCC; + font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; + color: #000; +} + +.CodeRay pre { + margin: auto 0px; + width: 100%; +} + +span.CodeRay { + white-space: pre; + border: 0px; + padding: 2px +} + +table.CodeRay { + border-collapse: collapse; + width: 100%; + padding: 2px; +} + +table.CodeRay td { + padding: 1em 0.5em; + vertical-align: top; +} + +.CodeRay .line-numbers, .CodeRay .no { + background-color: #ECECEC; + color: #AAA; + text-align: right; +} + +.CodeRay .line-numbers a { + color: #AAA; +} + +.CodeRay .line-numbers tt { font-weight: bold; } +.CodeRay .line-numbers .highlighted { color: red; } + +.CodeRay .line { + display: block; + float: left; + width: 100%; +} + +.CodeRay span.line-numbers { padding: 0px 4px; } +.CodeRay .code { width: 100%; } + +ol.CodeRay { font-size: 10pt; } +ol.CodeRay li { white-space: pre; } + +.CodeRay .code pre { overflow: auto; } + +.CodeRay .annotation { color: #007; } +.CodeRay .attribute-name { color: #f08; } +.CodeRay .attribute-value { color: #700; } + +.CodeRay .binary { + color: #509; + font-weight: bold; +} + +.CodeRay .comment { + color: #998; + font-style: italic; +} + +.CodeRay .char { color: #04D; } +.CodeRay .char .content { color: #04D; } +.CodeRay .char .delimiter { color: #039; } + +.CodeRay .class { + color: #458; + font-weight: bold; +} + +.CodeRay .complex { + color: #A08; + font-weight: bold; +} + +.CodeRay .constant { color: teal; } +.CodeRay .color { color: #0A0; } +.CodeRay .class-variable { color: #369; } +.CodeRay .decorator { color: #B0B; } + +.CodeRay .definition { + color: #099; + font-weight: bold; +} + +.CodeRay .directive { + color: #088; + font-weight: bold; +} + +.CodeRay .delimiter { color: black; } +.CodeRay .doc { color: #970; } +.CodeRay .doctype { color: #34b; } + +.CodeRay .doc-string { + color: #D42; + font-weight: bold; +} + +.CodeRay .escape { + color: #666; + font-weight: bold; +} + +.CodeRay .entity { + color: #800; + font-weight: bold; +} + +.CodeRay .error { + color: #F00; + background-color: #FAA; +} + +.CodeRay .exception { + color: #C00; + font-weight: bold; +} + +.CodeRay .filename { color: #099; } + +.CodeRay .function { + color: #900; + font-weight: bold; +} + +.CodeRay .global-variable { + color: teal; + font-weight: bold; +} + +.CodeRay .hex { + color: #058; + font-weight: bold; +} + +.CodeRay .integer { color: #099; } + +.CodeRay .include { + color: #B44; + font-weight: bold; +} + +.CodeRay .inline { color: #000; } +.CodeRay .inline .inline { background: #ccc; } +.CodeRay .inline .inline .inline { background: #bbb; } +.CodeRay .inline .inline-delimiter { color: #D14; } +.CodeRay .inline-delimiter { color: #D14; } +.CodeRay .important { color: #f00; } + +.CodeRay .interpreted { + color: #B2B; + font-weight: bold; +} + +.CodeRay .instance-variable { color: teal; } + +.CodeRay .label { + color: #970; + font-weight: bold; +} + +.CodeRay .local-variable { color: #963; } + +.CodeRay .octal { + color: #40E; + font-weight: bold; +} + +.CodeRay .predefined-constant { font-weight: bold; } + +.CodeRay .predefined { + color: #369; + font-weight: bold; +} +.CodeRay .preprocessor { color: #579; } + +.CodeRay .pseudo-class { + color: #00C; + font-weight: bold; +} +.CodeRay .predefined-type { color: #074; font-weight: bold; } +.CodeRay .reserved, .keyword { color: #000; font-weight: bold; } + +.CodeRay .key { color: #808; } +.CodeRay .key .delimiter { color: #606; } +.CodeRay .key .char { color: #80f; } +.CodeRay .value { color: #088; } + +.CodeRay .regexp { background-color: #fff0ff; } +.CodeRay .regexp .content { color: #808; } +.CodeRay .regexp .delimiter { color: #404; } +.CodeRay .regexp .modifier { color: #C2C; } + +.CodeRay .regexp .function { + color: #404; + font-weight: bold; +} + +.CodeRay .string { color: #D20; } +.CodeRay .string .string .string { background-color: #ffd0d0; } +.CodeRay .string .content { color: #D14; } +.CodeRay .string .char { color: #D14; } +.CodeRay .string .delimiter { color: #D14; } + +.CodeRay .shell { color: #D14; } +.CodeRay .shell .delimiter { color: #D14; } + +.CodeRay .symbol { color: #990073; } +.CodeRay .symbol .content { color: #A60; } +.CodeRay .symbol .delimiter { color: #630; } + +.CodeRay .tag { color: #070; } + +.CodeRay .tag-special { + color: #D70; + font-weight: bold; +} + +.CodeRay .type { + color: #339; + font-weight: bold; +} + +.CodeRay .variable { color: #036; } +.CodeRay .insert { background: #afa; } +.CodeRay .delete { background: #faa; } + +.CodeRay .change { + color: #aaf; + background: #007; +} + +.CodeRay .head { + color: #f8f; + background: #505; +} + +.CodeRay .insert .insert { + color: #080; + font-weight: bold; +} + +.CodeRay .delete .delete { + color: #800; + font-weight: bold; +} + +.CodeRay .change .change { color: #66f; } +.CodeRay .head .head { color: #f4f; } \ No newline at end of file diff --git a/app/assets/stylesheets/bulkrax/import_export.scss b/app/assets/stylesheets/bulkrax/import_export.scss new file mode 100644 index 00000000..1834840a --- /dev/null +++ b/app/assets/stylesheets/bulkrax/import_export.scss @@ -0,0 +1,37 @@ +div.importer_parser_fields_file_style span.radio { + display: inline; + margin-right: 20px; +} + +div#file_upload, div#file_path { + display: none; +} + +div.hide-required-tag .required-tag { + display: none; +} + +div#s2id_exporter_export_source_collection { + border: none; + padding: 0; +} + +.bulkrax-nav-tab-top-margin { + margin-top: 20px !important; +} + +.bulkrax-nav-tab-bottom-margin { + margin-bottom: 20px; +} + +.bulkrax-nav-tab-table-left-align { + margin-left: 10px; +} + +.bulkrax-p-align { + margin: 15px 0 10px 15px; +} + +.bulkrax-clear-toggles { + clear: both; +} \ No newline at end of file diff --git a/app/views/bulkrax/entries/_parsed_metadata.html.erb b/app/views/bulkrax/entries/_parsed_metadata.html.erb new file mode 100644 index 00000000..f7598450 --- /dev/null +++ b/app/views/bulkrax/entries/_parsed_metadata.html.erb @@ -0,0 +1,19 @@ +<% if @entry.parsed_metadata.present? %> +
+ +
+
+ <% @entry.parsed_metadata.each do |k, v| %> + <%= k %>: <%= v %>
+ <% end %> +
+
+
+<% end %> \ No newline at end of file diff --git a/app/views/bulkrax/entries/_raw_metadata.html.erb b/app/views/bulkrax/entries/_raw_metadata.html.erb new file mode 100644 index 00000000..3728816d --- /dev/null +++ b/app/views/bulkrax/entries/_raw_metadata.html.erb @@ -0,0 +1,19 @@ +<% if @entry.raw_metadata.present? %> +
+ +
+
+ <% @entry.raw_metadata.each do |k, v| %> + <%= k %>: <%= v %>
+ <% end %> +
+
+
+<% end %> \ No newline at end of file diff --git a/app/views/bulkrax/entries/show.html.erb b/app/views/bulkrax/entries/show.html.erb index 2426cf15..f95a3682 100644 --- a/app/views/bulkrax/entries/show.html.erb +++ b/app/views/bulkrax/entries/show.html.erb @@ -1,64 +1,29 @@

<%= notice %>

-
- <%# TODO: i18n %> -

+ +

Identifier: <%= @entry.identifier %>

-

+

Entry ID: <%= @entry.id %>

-

+

Type: <%= @entry.factory_class %>

+ <%= render partial: 'raw_metadata'%> -

- Raw Metadata: - <% if @entry.raw_metadata.present? %> -
- - <% end %> -

+ <%= render partial: 'parsed_metadata'%> -

- Parsed Metadata: - <% if @entry.parsed_metadata.present? %> -
- - <% end %> -

- - <%# Consider spliting dynamic fields into two partials %> + <%= render partial: 'bulkrax/shared/bulkrax_errors', locals: {item: @entry} %> -

- <% if @entry.last_error.present? %> - Errored at: <%= @entry.last_error_at %>
- Error: <%= @entry.last_error['error_class'] %> - <%= @entry.last_error['error_message'] %>
- Error Trace: -

- <% elsif @entry.last_succeeded_at != nil %> - Succeeded At: <%= @entry.last_succeeded_at %> - <% else %> - Succeeded At: Item has not yet been <%= @importer.present? ? 'imported' : 'exported' %> successfully - <% end %> -

- -

+

<% if @importer.present? %> Importer: <%= link_to @importer.name, importer_path(@importer) %> @@ -68,7 +33,7 @@ <% end %>

-

+

<% if @importer.present? %> <% factory_record = @entry.factory.find %> <% if @entry.last_succeeded_at != nil && factory_record.present? %> @@ -95,5 +60,6 @@ <% end %> <% end %>

+
-
+ \ No newline at end of file diff --git a/app/views/bulkrax/exporters/show.html.erb b/app/views/bulkrax/exporters/show.html.erb index 23078cc6..93ddf225 100644 --- a/app/views/bulkrax/exporters/show.html.erb +++ b/app/views/bulkrax/exporters/show.html.erb @@ -6,27 +6,28 @@
-

+ +

<%= t('bulkrax.exporter.labels.name') %>: <%= @exporter.name %>

-

+

<%= t('bulkrax.exporter.labels.user') %>: <%= @exporter.user %>

-

+

<%= t('bulkrax.exporter.labels.export_type') %>: <%= @exporter.export_type %>

-

+

<%= t('bulkrax.exporter.labels.export_from') %>: <%= @exporter.export_from %>

-

+

<%= t('bulkrax.exporter.labels.export_source') %>: <% case @exporter.export_from %> <% when 'collection' %> @@ -40,31 +41,22 @@ <% end %>

-

+

<%= t('bulkrax.exporter.labels.parser_klass') %>: <%= @exporter.parser_klass %>

-

+

<%= t('bulkrax.exporter.labels.limit') %>: <%= @exporter.limit %>

-

- <% if @exporter.last_error.present? %> - Errored at: <%= @exporter.last_error_at %>
- Error: <%= @exporter.last_error['error_class'] %> - <%= @exporter.last_error['error_message'] %>
- Error Trace:
- - <% elsif @exporter.last_succeeded_at.present? %> - Succeeded At: <%= @exporter.last_succeeded_at %> - <% end %> -

+ <%= render partial: 'bulkrax/shared/bulkrax_field_mapping', locals: {item: @exporter} %> <%# Currently, no parser-specific fields exist on Exporter, thus there's no real reason to always show this field %> <% if @exporter.parser_fields.present? %> -

+

<%= t('bulkrax.exporter.labels.parser_fields') %>:
<% @exporter.parser_fields.each do |k, v| %> <%= k %>: <%= v %>
@@ -72,74 +64,61 @@

<% end %> -

- <%= t('bulkrax.exporter.labels.field_mapping') %>: - <% if @exporter.field_mapping.present? %> -
- - <% end %> -

+

<%= t('bulkrax.exporter.labels.field_mapping') %>:

-

+

<%= t('bulkrax.exporter.labels.total_work_entries') %>: <%= @exporter.exporter_runs.last&.total_work_entries %>

-
- -

Entries

- - - - - - - - - - - - - - - <% @work_entries.each do |e| %> +
+

Entries

+
IdentifierCollectionEntry IDStatusErrorsStatus Set AtActions
+ - - <% if e.parsed_metadata.present? && e.parsed_metadata.dig('collections').present? %> - - <% elsif e.raw_metadata.present? %> - - <% else %> - - <% end %> - - <% if e.status == 'succeeded' %> - + + + + + + + + + + + <% @work_entries.each do |e| %> + + + <% if e.parsed_metadata.present? && e.parsed_metadata.dig('collections').present? %> + + <% elsif e.raw_metadata.present? %> + <% else %> - - <% end %> - <% if e.last_error.present? %> - - <% else %> - <% end %> - - - - <% end %> - -
<%= link_to e.identifier, bulkrax.exporter_entry_path(@exporter.id, e.id) %><%= e.parsed_metadata.dig('collections').map {|c| c['id'] }.join('; ') %><%= Array.wrap(e.raw_metadata.dig('collection')).join(';') %><%= e.id %> <%= e.status %>IdentifierCollectionEntry IDStatusErrorsStatus Set AtActions
<%= link_to e.identifier, bulkrax.exporter_entry_path(@exporter.id, e.id) %><%= e.parsed_metadata.dig('collections').map {|c| c['id'] }.join('; ') %><%= Array.wrap(e.raw_metadata.dig('collection')).join(';') %> <%= e.status %><%= link_to e.last_error.dig('error_class'), bulkrax.exporter_entry_path(@exporter.id, e.id) %><%= e.status_at %><%= link_to raw(""), bulkrax.exporter_entry_path(@exporter.id, e.id) %>
- <%= page_entries_info(@work_entries) %>
- <%= paginate(@work_entries, param_name: :work_entries_page) %> - -
- - <%= link_to 'Edit', edit_exporter_path(@exporter) %> - | - <%= link_to 'Back', exporters_path %> + <% end %> + <%= e.id %> + <% if e.status == 'succeeded' %> + <%= e.status %> + <% else %> + <%= e.status %> + <% end %> + <% if e.last_error.present? %> + <%= link_to e.last_error.dig('error_class'), bulkrax.exporter_entry_path(@exporter.id, e.id) %> + <% else %> + + <% end %> + <%= e.status_at %> + <%= link_to raw(""), bulkrax.exporter_entry_path(@exporter.id, e.id) %> + + <% end %> + + + <%= page_entries_info(@work_entries) %>
+ <%= paginate(@work_entries, param_name: :work_entries_page) %> +
+ <%= link_to 'Edit', edit_exporter_path(@exporter) %> + | + <%= link_to 'Back', exporters_path %> +
- + \ No newline at end of file diff --git a/app/views/bulkrax/importers/show.html.erb b/app/views/bulkrax/importers/show.html.erb index 6d007938..0e48be81 100644 --- a/app/views/bulkrax/importers/show.html.erb +++ b/app/views/bulkrax/importers/show.html.erb @@ -7,174 +7,161 @@ <% end %> - -
+
- -

+

Name: <%= @importer.name %>

- -

+

Admin set: <%= @importer.admin_set_id %>

- -

+

User: <%= @importer.user %>

- -

+

Frequency: <%= @importer.frequency %>

- -

+

Parser klass: <%= @importer.parser_klass %>

- -

+

Limit: <%= @importer.limit %>

-

- <% if @importer.last_error.present? %> - Errored at: <%= @importer.last_error_at %>
- Error: <%= @importer.last_error['error_class'] %> - <%= @importer.last_error['error_message'] %>
- Error Trace:
- - <% elsif @importer.importer_runs.last&.invalid_records&.present? %> - Error Trace:
- - <% elsif @importer.last_succeeded_at.present? %> - Succeeded At: <%= @importer.last_succeeded_at %> - <% end %> -

- -

- Parser fields:
- <% @importer.parser_fields.each do |key,value| %> - <%= key %>: <%= value %>
- <% end %> -

+ <%= render partial: 'bulkrax/shared/bulkrax_errors', locals: {item: @importer} %> -

- Field mapping: - <% if @importer.field_mapping.present? %> -
-

+ +
+
+ <% @importer.parser_fields.each do |key,value| %> + <%= key %>: <%= value %>
<% end %> - - <% end %> -

+
+
+
+ + <%= render partial: 'bulkrax/shared/bulkrax_field_mapping', locals: {item: @importer} %> -

+

Total Works: <%= @importer.importer_runs.last&.total_work_entries %>

-

+

Total Collections: <%= @importer.importer_runs.last&.total_collection_entries %>

-
- -

Collection Entries

- - - - - - - - - - - - - - <% @collection_entries.each do |e| %> - - - - <% if e.status == "succeeded" %> - - <% else %> - - <% end %> - <% if e.last_error.present? %> - - <% else %> - - <% end %> - - - - <% end %> - -
IdentifierEntry IDStatusErrorsStatus Set AtActions
<%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.id %> <%= e.status %> <%= e.status %><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.status_at %><%= link_to raw(''), bulkrax.importer_entry_path(@importer.id, e.id) %>
- <%= page_entries_info(@collection_entries) %>
- <%= paginate(@collection_entries, param_name: :collections_entries_page) %> - -
- -

Work Entries

- - - - - - - - - - - - - - - <% @work_entries.each do |e| %> - - - <% if e.parsed_metadata.present? && e.parsed_metadata.dig("collections").present? %> - - <% elsif e.raw_metadata.present? %> - - <% else %> - - <% end %> - - <% if e.status == "succeeded" %> - - <% else %> - - <% end %> - <% if e.last_error.present? %> - - <% else %> - - <% end %> - - - - <% end %> - -
IdentifierCollectionEntry IDStatusErrorsStatus Set AtActions
<%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.parsed_metadata.dig("collections").map {|c| c['id'] }.join('; ') %><%= Array.wrap(e.raw_metadata.dig("collection")).join(';') %><%= e.id %> <%= e.status %> <%= e.status %><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.status_at %><%= link_to raw(''), bulkrax.importer_entry_path(@importer.id, e.id) %>
- <%= page_entries_info(@work_entries) %>
- <%= paginate(@work_entries, param_name: :work_entries_page) %> - -
+
+ + + +
+
+ + + + + + + + + + + + + <% @collection_entries.each do |e| %> + + + + <% if e.status == "succeeded" %> + + <% else %> + + <% end %> + <% if e.last_error.present? %> + + <% else %> + + <% end %> + + + + <% end %> + +
IdentifierEntry IDStatusErrorsStatus Set AtActions
<%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.id %> <%= e.status %> <%= e.status %><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.status_at %><%= link_to raw(''), bulkrax.importer_entry_path(@importer.id, e.id) %>
+ <%= page_entries_info(@collection_entries) %>
+ <%= paginate(@collection_entries, param_name: :collections_entries_page) %> +
+
+ + + + + + + + + + + + + + <% @work_entries.each do |e| %> + + + <% if e.parsed_metadata.present? && e.parsed_metadata.dig("collections").present? %> + + <% elsif e.raw_metadata.present? %> + + <% else %> + + <% end %> + + <% if e.status == "succeeded" %> + + <% else %> + + <% end %> + <% if e.last_error.present? %> + + <% else %> + + <% end %> + + + + <% end %> + +
IdentifierCollectionEntry IDStatusErrorsStatus Set AtActions
<%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.parsed_metadata.dig("collections").map {|c| c['id'] }.join('; ') %><%= Array.wrap(e.raw_metadata.dig("collection")).join(';') %><%= e.id %> <%= e.status %> <%= e.status %><%= link_to e.last_error.dig("error_class"), bulkrax.importer_entry_path(@importer.id, e.id) %><%= e.status_at %><%= link_to raw(''), bulkrax.importer_entry_path(@importer.id, e.id) %>
+ <%= page_entries_info(@work_entries) %>
+ <%= paginate(@work_entries, param_name: :work_entries_page) %> +
+
+
- <%= link_to 'Edit', edit_importer_path(@importer) %> - | - <%= link_to 'Back', importers_path %>

+

+ <%= link_to 'Edit', edit_importer_path(@importer) %> + | + <%= link_to 'Back', importers_path %>

+

<% if @importer.validate_only == true %>
@@ -185,4 +172,4 @@
<% end %>
-
+
\ No newline at end of file diff --git a/app/views/bulkrax/shared/_bulkrax_errors.html.erb b/app/views/bulkrax/shared/_bulkrax_errors.html.erb new file mode 100644 index 00000000..331b031e --- /dev/null +++ b/app/views/bulkrax/shared/_bulkrax_errors.html.erb @@ -0,0 +1,59 @@ +<% if item.last_error.present? %> +
+ +
+
+
+ +
+ + +
+ +
+
+ Errored at: <%= item.last_error_at %>

+ Error: <%= item.last_error['error_class'] %> - <%= item.last_error['error_message'] %>

+ Error Trace:

+ <% item.last_error['error_trace'].each do |v| %> + <%= CodeRay.scan(v, :ruby).html( + :wrap => :page, + :css => :class, + :tab_width => 200, + :break_lines => true + ).html_safe %>
+ <% end %> +
+
+ Errored at: <%= item.last_error_at %>

+ Error: <%= item.last_error['error_class'] %> - <%= item.last_error['error_message'] %>

+ Error Trace:

+ <% item.last_error['error_trace'].each do |v| %> + <%= CodeRay.scan(v, :ruby).html( + :css => :class, + :tab_width => 0, + :break_lines => false, + ).html_safe %>
+ <% end %> +
+
+
+
+
+
+<% elsif item.last_succeeded_at != nil %> +

+ Succeeded At: <%= item.last_succeeded_at %> +

+<% else %> +

+ Succeeded At: Item has not yet been <%= @importer.present? ? 'imported' : 'exported' %> successfully +

+<% end %> diff --git a/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb b/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb new file mode 100644 index 00000000..12dd02d7 --- /dev/null +++ b/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb @@ -0,0 +1,46 @@ +<% if item.field_mapping.present? %> +
+ +
+
+
+ +
+ + +
+ +
+
+ <% item.field_mapping.each do |k, v| %> + <%= k %>: + <%= CodeRay.scan(v, :ruby).html( + :wrap => :page, + :css => :class, + :tab_width => 200, + :break_lines => true + ).html_safe %>
+ <% end %> +
+
+ <% item.field_mapping.each do |k, v| %> + <%= CodeRay.scan(v, :ruby).html( + :css => :class, + :tab_width => 0, + :break_lines => false, + ).html_safe %>
+ <% end %> +
+
+
+
+
+
+<% end %> \ No newline at end of file diff --git a/bulkrax.gemspec b/bulkrax.gemspec index 8bcf3d54..eacd36bd 100644 --- a/bulkrax.gemspec +++ b/bulkrax.gemspec @@ -28,6 +28,7 @@ Gem::Specification.new do |s| s.add_dependency 'language_list', '~> 1.2', '>= 1.2.1' s.add_dependency 'rdf', '>= 2.0.2', '< 4.0' s.add_dependency 'bagit', '~> 0.4' + s.add_dependency 'coderay' s.add_development_dependency 'sqlite3', '~> 1.3.13' s.add_development_dependency 'simplecov'