data_porter 1.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/README.md +7 -14
- data/ROADMAP.md +84 -74
- data/app/assets/javascripts/data_porter/progress_controller.js +3 -3
- data/app/controllers/data_porter/concerns/import_validation.rb +5 -5
- data/app/controllers/data_porter/concerns/mapping_management.rb +8 -1
- data/app/controllers/data_porter/imports_controller.rb +7 -1
- data/app/models/data_porter/data_import.rb +9 -0
- data/app/views/data_porter/imports/index.html.erb +23 -23
- data/app/views/data_porter/imports/new.html.erb +11 -11
- data/app/views/data_porter/imports/show.html.erb +22 -18
- data/app/views/data_porter/mapping_templates/_form.html.erb +10 -10
- data/app/views/data_porter/mapping_templates/edit.html.erb +2 -2
- data/app/views/data_porter/mapping_templates/index.html.erb +10 -10
- data/app/views/data_porter/mapping_templates/new.html.erb +2 -2
- data/config/locales/en.yml +123 -0
- data/config/locales/fr.yml +123 -0
- data/config/routes.rb +4 -3
- data/lib/data_porter/components/mapping/column_row.rb +1 -1
- data/lib/data_porter/components/mapping/form.rb +4 -4
- data/lib/data_porter/components/mapping/template_select.rb +1 -1
- data/lib/data_porter/components/preview/results_summary.rb +13 -5
- data/lib/data_porter/components/preview/summary_cards.rb +5 -4
- data/lib/data_porter/components/preview/table.rb +3 -3
- data/lib/data_porter/components/progress/bar.rb +9 -2
- data/lib/data_porter/components/shared/pagination.rb +9 -5
- data/lib/data_porter/components/shared/status_badge.rb +3 -1
- data/lib/data_porter/configuration.rb +2 -2
- data/lib/data_porter/engine.rb +4 -0
- data/lib/data_porter/orchestrator/record_builder.rb +1 -1
- data/lib/data_porter/record_validator.rb +2 -2
- data/lib/data_porter/version.rb +1 -1
- data/lib/generators/data_porter/install/templates/initializer.rb +3 -2
- data/lib/generators/data_porter/locale/locale_generator.rb +42 -0
- data/mkdocs.yml +98 -0
- metadata +6 -2
|
@@ -24,22 +24,26 @@ module DataPorter
|
|
|
24
24
|
private
|
|
25
25
|
|
|
26
26
|
def render_prev
|
|
27
|
+
label = "\u2190 #{I18n.t("data_porter.components.pagination.previous")}"
|
|
27
28
|
if @page > 1
|
|
28
|
-
a(href: page_url(@page - 1), class: "dp-pagination__btn") {
|
|
29
|
+
a(href: page_url(@page - 1), class: "dp-pagination__btn") { label }
|
|
29
30
|
else
|
|
30
|
-
span(class: "dp-pagination__btn dp-pagination__btn--disabled") {
|
|
31
|
+
span(class: "dp-pagination__btn dp-pagination__btn--disabled") { label }
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def render_indicator
|
|
35
|
-
span(class: "dp-pagination__info")
|
|
36
|
+
span(class: "dp-pagination__info") do
|
|
37
|
+
I18n.t("data_porter.components.pagination.page_info", page: @page, total: @total_pages)
|
|
38
|
+
end
|
|
36
39
|
end
|
|
37
40
|
|
|
38
41
|
def render_next
|
|
42
|
+
label = "#{I18n.t("data_porter.components.pagination.next")} \u2192"
|
|
39
43
|
if @page < @total_pages
|
|
40
|
-
a(href: page_url(@page + 1), class: "dp-pagination__btn") {
|
|
44
|
+
a(href: page_url(@page + 1), class: "dp-pagination__btn") { label }
|
|
41
45
|
else
|
|
42
|
-
span(class: "dp-pagination__btn dp-pagination__btn--disabled") {
|
|
46
|
+
span(class: "dp-pagination__btn dp-pagination__btn--disabled") { label }
|
|
43
47
|
end
|
|
44
48
|
end
|
|
45
49
|
|
|
@@ -10,7 +10,9 @@ module DataPorter
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def view_template
|
|
13
|
-
span(class: "dp-badge dp-badge--#{@status}")
|
|
13
|
+
span(class: "dp-badge dp-badge--#{@status}") do
|
|
14
|
+
I18n.t("data_porter.components.status_badge.#{@status}", default: @status.capitalize)
|
|
15
|
+
end
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -16,8 +16,8 @@ module DataPorter
|
|
|
16
16
|
:transaction_mode
|
|
17
17
|
|
|
18
18
|
def initialize
|
|
19
|
-
@parent_controller = "
|
|
20
|
-
@queue_name = :
|
|
19
|
+
@parent_controller = "ActionController::Base"
|
|
20
|
+
@queue_name = :default
|
|
21
21
|
@storage_service = :local
|
|
22
22
|
@cable_channel_prefix = "data_porter"
|
|
23
23
|
@context_builder = nil
|
data/lib/data_porter/engine.rb
CHANGED
|
@@ -4,6 +4,10 @@ module DataPorter
|
|
|
4
4
|
class Engine < ::Rails::Engine
|
|
5
5
|
isolate_namespace DataPorter
|
|
6
6
|
|
|
7
|
+
initializer "data_porter.i18n" do
|
|
8
|
+
config.i18n.load_path += Dir[root.join("config/locales/**/*.yml")]
|
|
9
|
+
end
|
|
10
|
+
|
|
7
11
|
initializer "data_porter.assets.precompile" do |app|
|
|
8
12
|
if app.config.respond_to?(:assets)
|
|
9
13
|
app.config.assets.precompile += %w[
|
|
@@ -22,7 +22,7 @@ module DataPorter
|
|
|
22
22
|
return unless max
|
|
23
23
|
return if count <= max
|
|
24
24
|
|
|
25
|
-
raise Error, "
|
|
25
|
+
raise Error, I18n.t("data_porter.errors.max_records", count: count, max: max)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def build_record(row, index, columns, validator)
|
|
@@ -19,14 +19,14 @@ module DataPorter
|
|
|
19
19
|
def validate_required(record, col, value)
|
|
20
20
|
return unless col.required && value.to_s.strip.empty?
|
|
21
21
|
|
|
22
|
-
record.add_error("
|
|
22
|
+
record.add_error(I18n.t("data_porter.errors.required", label: col.label))
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def validate_type(record, col, value)
|
|
26
26
|
return if value.to_s.strip.empty?
|
|
27
27
|
return if TypeValidator.valid?(value, col.type, col.options)
|
|
28
28
|
|
|
29
|
-
record.add_error("
|
|
29
|
+
record.add_error(I18n.t("data_porter.errors.invalid_type", label: col.label, type: col.type))
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
data/lib/data_porter/version.rb
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
DataPorter.configure do |config|
|
|
4
4
|
# Parent controller for the engine's controllers to inherit from.
|
|
5
|
-
#
|
|
5
|
+
# Defaults to ActionController::Base. Set to "ApplicationController" to inherit
|
|
6
|
+
# authentication, layouts, and helpers from your app.
|
|
6
7
|
# config.parent_controller = "ApplicationController"
|
|
7
8
|
|
|
8
9
|
# ActiveJob queue name for import jobs.
|
|
9
|
-
# config.queue_name = :
|
|
10
|
+
# config.queue_name = :default
|
|
10
11
|
|
|
11
12
|
# ActiveStorage service for uploaded files.
|
|
12
13
|
# config.storage_service = :local
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module DataPorter
|
|
6
|
+
module Generators
|
|
7
|
+
class LocaleGenerator < Rails::Generators::Base
|
|
8
|
+
source_root File.expand_path("../../../../config/locales", __dir__)
|
|
9
|
+
|
|
10
|
+
argument :locale, type: :string, default: "en"
|
|
11
|
+
|
|
12
|
+
def copy_locale_file
|
|
13
|
+
source = source_file
|
|
14
|
+
destination = "config/locales/data_porter.#{locale}.yml"
|
|
15
|
+
|
|
16
|
+
copy_file(source, destination)
|
|
17
|
+
gsub_file(destination, /^#{source_locale}:/, "#{locale}:") unless locale == source_locale
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def show_instructions
|
|
21
|
+
say ""
|
|
22
|
+
say "DataPorter locale file created: config/locales/data_porter.#{locale}.yml", :green
|
|
23
|
+
say ""
|
|
24
|
+
say "Next steps:"
|
|
25
|
+
say " 1. Translate the values in the generated file"
|
|
26
|
+
say " 2. Set your default locale in config/application.rb:"
|
|
27
|
+
say " config.i18n.default_locale = :#{locale}"
|
|
28
|
+
say ""
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def source_file
|
|
34
|
+
File.exist?(File.join(self.class.source_root, "#{locale}.yml")) ? "#{locale}.yml" : "en.yml"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def source_locale
|
|
38
|
+
source_file.delete_suffix(".yml")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/mkdocs.yml
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
site_name: DataPorter
|
|
2
|
+
site_description: A mountable Rails engine for data import workflows
|
|
3
|
+
site_url: https://seryllns.github.io/data_porter
|
|
4
|
+
repo_url: https://github.com/SerylLns/data_porter
|
|
5
|
+
repo_name: SerylLns/data_porter
|
|
6
|
+
edit_uri: edit/main/docs/
|
|
7
|
+
|
|
8
|
+
theme:
|
|
9
|
+
name: material
|
|
10
|
+
palette:
|
|
11
|
+
- media: "(prefers-color-scheme: light)"
|
|
12
|
+
scheme: default
|
|
13
|
+
primary: indigo
|
|
14
|
+
accent: indigo
|
|
15
|
+
toggle:
|
|
16
|
+
icon: material/brightness-7
|
|
17
|
+
name: Switch to dark mode
|
|
18
|
+
- media: "(prefers-color-scheme: dark)"
|
|
19
|
+
scheme: slate
|
|
20
|
+
primary: indigo
|
|
21
|
+
accent: indigo
|
|
22
|
+
toggle:
|
|
23
|
+
icon: material/brightness-4
|
|
24
|
+
name: Switch to light mode
|
|
25
|
+
font:
|
|
26
|
+
text: Inter
|
|
27
|
+
code: JetBrains Mono
|
|
28
|
+
icon:
|
|
29
|
+
repo: fontawesome/brands/github
|
|
30
|
+
logo: material/database-import
|
|
31
|
+
features:
|
|
32
|
+
- navigation.sections
|
|
33
|
+
- navigation.expand
|
|
34
|
+
- navigation.top
|
|
35
|
+
- navigation.indexes
|
|
36
|
+
- navigation.footer
|
|
37
|
+
- search.highlight
|
|
38
|
+
- search.suggest
|
|
39
|
+
- content.code.copy
|
|
40
|
+
- content.code.annotate
|
|
41
|
+
- content.tabs.link
|
|
42
|
+
- toc.follow
|
|
43
|
+
|
|
44
|
+
plugins:
|
|
45
|
+
- search
|
|
46
|
+
- exclude:
|
|
47
|
+
glob:
|
|
48
|
+
- blog/*
|
|
49
|
+
- blog_part_2/*
|
|
50
|
+
- V1_PLAN.md
|
|
51
|
+
- dev_to.md
|
|
52
|
+
- reddit_post.md
|
|
53
|
+
|
|
54
|
+
markdown_extensions:
|
|
55
|
+
- admonition
|
|
56
|
+
- pymdownx.details
|
|
57
|
+
- pymdownx.superfences
|
|
58
|
+
- pymdownx.highlight:
|
|
59
|
+
anchor_linenums: true
|
|
60
|
+
line_spans: __span
|
|
61
|
+
pygments_lang_class: true
|
|
62
|
+
- pymdownx.inlinehilite
|
|
63
|
+
- pymdownx.tabbed:
|
|
64
|
+
alternate_style: true
|
|
65
|
+
- pymdownx.emoji:
|
|
66
|
+
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
|
67
|
+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
|
68
|
+
- pymdownx.snippets:
|
|
69
|
+
base_path: ["."]
|
|
70
|
+
- attr_list
|
|
71
|
+
- md_in_html
|
|
72
|
+
- tables
|
|
73
|
+
- toc:
|
|
74
|
+
permalink: true
|
|
75
|
+
|
|
76
|
+
extra:
|
|
77
|
+
social:
|
|
78
|
+
- icon: fontawesome/brands/github
|
|
79
|
+
link: https://github.com/SerylLns/data_porter
|
|
80
|
+
- icon: fontawesome/brands/dev
|
|
81
|
+
link: https://dev.to/seryllns
|
|
82
|
+
generator: false
|
|
83
|
+
|
|
84
|
+
extra_css:
|
|
85
|
+
- stylesheets/extra.css
|
|
86
|
+
|
|
87
|
+
nav:
|
|
88
|
+
- Home: index.md
|
|
89
|
+
- Getting Started: getting-started.md
|
|
90
|
+
- Reference:
|
|
91
|
+
- Configuration: CONFIGURATION.md
|
|
92
|
+
- Targets: TARGETS.md
|
|
93
|
+
- Sources: SOURCES.md
|
|
94
|
+
- Column Mapping: MAPPING.md
|
|
95
|
+
- Routes: routes.md
|
|
96
|
+
- Roadmap: ROADMAP.md
|
|
97
|
+
- Changelog: changelog.md
|
|
98
|
+
- Contributing: contributing.md
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: data_porter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Seryl Lounis
|
|
@@ -139,6 +139,8 @@ files:
|
|
|
139
139
|
- app/views/data_porter/mapping_templates/index.html.erb
|
|
140
140
|
- app/views/data_porter/mapping_templates/new.html.erb
|
|
141
141
|
- app/views/layouts/data_porter/application.html.erb
|
|
142
|
+
- config/locales/en.yml
|
|
143
|
+
- config/locales/fr.yml
|
|
142
144
|
- config/routes.rb
|
|
143
145
|
- lib/data_porter.rb
|
|
144
146
|
- lib/data_porter/broadcaster.rb
|
|
@@ -182,9 +184,11 @@ files:
|
|
|
182
184
|
- lib/generators/data_porter/install/templates/create_data_porter_imports.rb.erb
|
|
183
185
|
- lib/generators/data_porter/install/templates/create_data_porter_mapping_templates.rb.erb
|
|
184
186
|
- lib/generators/data_porter/install/templates/initializer.rb
|
|
187
|
+
- lib/generators/data_porter/locale/locale_generator.rb
|
|
185
188
|
- lib/generators/data_porter/target/target_generator.rb
|
|
186
189
|
- lib/generators/data_porter/target/templates/target.rb.tt
|
|
187
190
|
- lib/tasks/data_porter.rake
|
|
191
|
+
- mkdocs.yml
|
|
188
192
|
- sig/data_porter.rbs
|
|
189
193
|
homepage: https://github.com/SerylLns/data_porter
|
|
190
194
|
licenses:
|
|
@@ -193,7 +197,7 @@ metadata:
|
|
|
193
197
|
homepage_uri: https://github.com/SerylLns/data_porter
|
|
194
198
|
source_code_uri: https://github.com/SerylLns/data_porter
|
|
195
199
|
changelog_uri: https://github.com/SerylLns/data_porter/blob/main/CHANGELOG.md
|
|
196
|
-
documentation_uri: https://github.
|
|
200
|
+
documentation_uri: https://seryllns.github.io/data_porter/
|
|
197
201
|
bug_tracker_uri: https://github.com/SerylLns/data_porter/issues
|
|
198
202
|
rubygems_mcp_server_uri: https://rubygems.org/gems/data_porter
|
|
199
203
|
rubygems_mfa_required: 'true'
|