paper_trail_viewer 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ const App = () => {
44
44
  const submit = handleSubmit(submitHandler)
45
45
  const config = useConfig({initialParams, setValue, submit})
46
46
 
47
- useEffect(() => submitHandler(initialParams), [initialParams])
47
+ useEffect(() => void submitHandler(initialParams), [initialParams])
48
48
 
49
49
  return (
50
50
  <div className="p-2" onClick={() => ContextMenu.closeAll()}>
@@ -92,7 +92,7 @@ const useConfig = ({
92
92
  submit: Function
93
93
  }) => {
94
94
  const el = document.getElementById("mount-paper-trail-viewer")
95
- const allowRollback = el && el.dataset.allowRollback === "1"
95
+ const allowRollback = !!el && el.dataset.allowRollback === "1"
96
96
 
97
97
  const [columns, setColumns] = useState({
98
98
  actions: true,
@@ -105,7 +105,7 @@ const useConfig = ({
105
105
  whodunnit: true,
106
106
  } as ColumnPicks)
107
107
 
108
- const [viewed, setViewed] = useState([])
108
+ const [viewed, setViewed] = useState(new Array<number>())
109
109
 
110
110
  return {allowRollback, columns, setColumns, viewed, setViewed}
111
111
  }
@@ -5,7 +5,7 @@ import {ConfigModal} from "./config_modal"
5
5
  export const Controls: React.FC<{
6
6
  register: (
7
7
  x: "page" | "filter" | "event" | "item_id" | "item_type" | "per_page"
8
- ) => void
8
+ ) => object
9
9
  onSubmit: React.FormEventHandler<HTMLFormElement>
10
10
  config: Config
11
11
  }> = ({register, onSubmit, config}) => (
@@ -1,4 +1,5 @@
1
1
  require 'kaminari'
2
+ require 'ostruct'
2
3
 
3
4
  module PaperTrailViewer
4
5
  module DataSource
@@ -1,3 +1,3 @@
1
1
  module PaperTrailViewer
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -16,18 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.required_ruby_version = '>= 2.7'
19
+ spec.required_ruby_version = '>= 3.0'
20
20
 
21
21
  spec.add_dependency 'kaminari'
22
+ spec.add_dependency 'ostruct'
22
23
  spec.add_dependency 'paper_trail', ['>= 11.1']
23
- spec.add_dependency 'rails', ['>= 6.0', '< 8.0']
24
-
25
- spec.add_development_dependency 'appraisal', '~> 1.0'
26
- spec.add_development_dependency 'capybara', '~> 3.0'
27
- spec.add_development_dependency 'factory_bot_rails', '~> 6.0'
28
- spec.add_development_dependency 'puma', '~> 5.0'
29
- spec.add_development_dependency 'rake', '~> 13.0'
30
- spec.add_development_dependency 'rspec-rails', '~> 5.0'
31
- spec.add_development_dependency 'sqlite3', '>= 1.3.6'
32
- spec.add_development_dependency 'webdrivers', '~> 5.0'
24
+ spec.add_dependency 'rails', ['>= 6.0', '< 9.0']
33
25
  end
data/spec/app_template.rb CHANGED
@@ -1,10 +1,12 @@
1
- gem 'paper_trail_viewer', path: __FILE__ + '/../../../'
1
+ gem 'paper_trail_viewer', path: __dir__ + '/../'
2
2
 
3
3
  generate 'paper_trail:install'
4
4
  generate 'resource', 'entity name:string status:string --no-test-framework'
5
5
  generate 'resource', 'platform name:string status:string --no-test-framework'
6
6
 
7
7
  model_body = <<-RUBY
8
+ ::ActiveRecord.try(:use_yaml_unsafe_load=, true)
9
+
8
10
  has_paper_trail
9
11
 
10
12
  validates_presence_of :name
data/spec/rails_helper.rb CHANGED
@@ -2,8 +2,8 @@ ENV['RAILS_ENV'] ||= 'test'
2
2
  require File.expand_path('dummy/config/environment', __dir__)
3
3
  require 'rspec/rails'
4
4
 
5
+ require 'capybara/rspec'
5
6
  require 'selenium/webdriver'
6
- require 'webdrivers/chromedriver'
7
7
 
8
8
  Capybara.server = :puma, { Silent: true }
9
9
 
@@ -13,6 +13,14 @@ RSpec.configure do |config|
13
13
  config.use_transactional_fixtures = true
14
14
  config.infer_spec_type_from_file_location!
15
15
  config.before(:each, type: :system) do
16
- driven_by :selenium_chrome_headless
16
+ driven_by :selenium, using: :headless_chrome, screen_size: [1600, 900] do |opts|
17
+ # https://github.com/SeleniumHQ/selenium/issues/14453
18
+ opts.add_argument('--disable-search-engine-choice-screen')
19
+ # various fixes for GH actions
20
+ opts.add_argument('--disable-dev-shm-usage')
21
+ opts.add_argument('--disable-extensions')
22
+ opts.add_argument('--disable-site-isolation-trials')
23
+ opts.add_argument('--remote-debugging-pipe')
24
+ end
17
25
  end
18
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail_viewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janosch Müller
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-03-27 00:00:00.000000000 Z
12
+ date: 2024-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: kaminari
@@ -26,151 +26,53 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: paper_trail
29
+ name: ostruct
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '11.1'
34
+ version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '11.1'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rails
43
+ name: paper_trail
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '6.0'
49
- - - "<"
50
- - !ruby/object:Gem::Version
51
- version: '8.0'
48
+ version: '11.1'
52
49
  type: :runtime
53
50
  prerelease: false
54
51
  version_requirements: !ruby/object:Gem::Requirement
55
52
  requirements:
56
53
  - - ">="
57
54
  - !ruby/object:Gem::Version
58
- version: '6.0'
59
- - - "<"
60
- - !ruby/object:Gem::Version
61
- version: '8.0'
62
- - !ruby/object:Gem::Dependency
63
- name: appraisal
64
- requirement: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- type: :development
70
- prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.0'
76
- - !ruby/object:Gem::Dependency
77
- name: capybara
78
- requirement: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
- type: :development
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.0'
55
+ version: '11.1'
90
56
  - !ruby/object:Gem::Dependency
91
- name: factory_bot_rails
57
+ name: rails
92
58
  requirement: !ruby/object:Gem::Requirement
93
59
  requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '6.0'
97
- type: :development
98
- prerelease: false
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
60
+ - - ">="
102
61
  - !ruby/object:Gem::Version
103
62
  version: '6.0'
104
- - !ruby/object:Gem::Dependency
105
- name: puma
106
- requirement: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '5.0'
111
- type: :development
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '5.0'
118
- - !ruby/object:Gem::Dependency
119
- name: rake
120
- requirement: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '13.0'
125
- type: :development
126
- prerelease: false
127
- version_requirements: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '13.0'
132
- - !ruby/object:Gem::Dependency
133
- name: rspec-rails
134
- requirement: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '5.0'
139
- type: :development
140
- prerelease: false
141
- version_requirements: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '5.0'
146
- - !ruby/object:Gem::Dependency
147
- name: sqlite3
148
- requirement: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
63
+ - - "<"
151
64
  - !ruby/object:Gem::Version
152
- version: 1.3.6
153
- type: :development
65
+ version: '9.0'
66
+ type: :runtime
154
67
  prerelease: false
155
68
  version_requirements: !ruby/object:Gem::Requirement
156
69
  requirements:
157
70
  - - ">="
158
71
  - !ruby/object:Gem::Version
159
- version: 1.3.6
160
- - !ruby/object:Gem::Dependency
161
- name: webdrivers
162
- requirement: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '5.0'
167
- type: :development
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
72
+ version: '6.0'
73
+ - - "<"
172
74
  - !ruby/object:Gem::Version
173
- version: '5.0'
75
+ version: '9.0'
174
76
  description: Browse, view and revert changes to records when using Ruby on Rails and
175
77
  the `paper_trail` gem.
176
78
  email:
@@ -180,7 +82,6 @@ extra_rdoc_files: []
180
82
  files:
181
83
  - ".github/workflows/tests.yml"
182
84
  - ".gitignore"
183
- - Appraisals
184
85
  - CHANGELOG.md
185
86
  - Gemfile
186
87
  - LICENSE.txt
@@ -192,9 +93,6 @@ files:
192
93
  - app/views/paper_trail_viewer/viewer/index.html.erb
193
94
  - bin/setup
194
95
  - config/routes.rb
195
- - gemfiles/rails_6.0_paper_trail_11.1.gemfile
196
- - gemfiles/rails_6.0_paper_trail_12.2.gemfile
197
- - gemfiles/rails_7.0_paper_trail_12.2.gemfile
198
96
  - javascript/compiled.js
199
97
  - javascript/src/app.tsx
200
98
  - javascript/src/components/change_diff.tsx
@@ -237,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
135
  requirements:
238
136
  - - ">="
239
137
  - !ruby/object:Gem::Version
240
- version: '2.7'
138
+ version: '3.0'
241
139
  required_rubygems_version: !ruby/object:Gem::Requirement
242
140
  requirements:
243
141
  - - ">="
data/Appraisals DELETED
@@ -1,13 +0,0 @@
1
- {
2
- '6.0' => %w[11.1 12.2],
3
- '7.0' => %w[12.2],
4
- }.each do |rails_version, paper_trail_versions|
5
- paper_trail_versions.each do |paper_trail_version|
6
- appraise "rails-#{rails_version}-paper_trail-#{paper_trail_version}" do
7
- gem 'rails', "~> #{rails_version}"
8
- gem 'sqlite3', '~> 1.4'
9
- gem 'paper_trail', "~> #{paper_trail_version}"
10
- gem 'kaminari'
11
- end
12
- end
13
- end
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 6.0"
6
- gem "sqlite3", "~> 1.4"
7
- gem "paper_trail", "~> 11.1"
8
- gem "kaminari"
9
-
10
- gemspec :path => "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 6.0"
6
- gem "sqlite3", "~> 1.4"
7
- gem "paper_trail", "~> 12.2"
8
- gem "kaminari"
9
-
10
- gemspec :path => "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 7.0"
6
- gem "sqlite3", "~> 1.4"
7
- gem "paper_trail", "~> 12.2"
8
- gem "kaminari"
9
-
10
- gemspec :path => "../"