marty 6.1.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.gitlab-ci.yml +17 -3
  4. data/.rubocop.yml +5 -0
  5. data/.rubocop_todo.yml +3 -2
  6. data/Gemfile +2 -1
  7. data/app/assets/javascripts/marty/extjs/extensions/marty.js +23 -1
  8. data/app/assets/stylesheets/marty/application.css +4 -1
  9. data/app/assets/stylesheets/marty/dark_mode.css +17 -0
  10. data/app/components/marty/auth_app.rb +10 -1
  11. data/app/components/marty/auth_app/client/auth_app.js +4 -0
  12. data/app/components/marty/extras/layout.rb +2 -2
  13. data/app/components/marty/extras/misc.rb +1 -1
  14. data/app/components/marty/log_view.rb +0 -1
  15. data/app/components/marty/main_auth_app.rb +9 -12
  16. data/app/components/marty/promise_view.rb +5 -0
  17. data/app/components/marty/promise_view/client/promise_view.js +11 -0
  18. data/app/components/marty/schedule_jobs_dashboard.rb +30 -96
  19. data/app/components/marty/schedule_jobs_grid.rb +118 -0
  20. data/app/controllers/marty/application_controller.rb +6 -2
  21. data/app/models/marty/base.rb +48 -48
  22. data/app/models/marty/config.rb +14 -2
  23. data/app/models/marty/user.rb +12 -0
  24. data/app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb +19 -0
  25. data/app/services/marty/enums/report.rb +18 -0
  26. data/app/services/marty/promises/delorean/create.rb +16 -27
  27. data/app/services/marty/promises/ruby/create.rb +10 -1
  28. data/app/views/layouts/marty/application.html.erb +4 -1
  29. data/app/views/marty/diagnostic/op.html.erb +3 -1
  30. data/config/locales/en.yml +2 -0
  31. data/db/migrate/512_add_promise_priority.rb +9 -0
  32. data/db/migrate/513_add_priority_to_promise_view.rb +44 -0
  33. data/db/migrate/514_remove_marty_events.rb +13 -0
  34. data/delorean/enum_report.dl +11 -0
  35. data/delorean/table_report.dl +7 -0
  36. data/docker-compose.dummy.yml +7 -4
  37. data/lib/marty.rb +5 -2
  38. data/lib/marty/api/base.rb +15 -9
  39. data/lib/marty/cache_adapters.rb +2 -0
  40. data/lib/marty/cache_adapters/mcfly_ruby_cache.rb +1 -5
  41. data/lib/marty/cache_adapters/memory_and_redis.rb +93 -0
  42. data/lib/marty/cache_adapters/redis.rb +63 -0
  43. data/lib/marty/delayed_job/scheduled_job_plugin.rb +33 -0
  44. data/lib/marty/diagnostic/database.rb +1 -2
  45. data/lib/marty/logger.rb +50 -17
  46. data/lib/marty/monkey.rb +26 -6
  47. data/lib/marty/promise_ruby_job.rb +2 -0
  48. data/lib/marty/rails_app.rb +29 -0
  49. data/lib/marty/railtie.rb +1 -0
  50. data/lib/marty/version.rb +1 -1
  51. data/marty.gemspec +1 -0
  52. data/spec/controllers/job_controller_spec.rb +2 -2
  53. data/spec/dummy/app/components/gemini/cm_auth_app.rb +12 -0
  54. data/spec/dummy/app/components/gemini/simple_view.rb +17 -0
  55. data/spec/dummy/app/jobs/test_failing_job.rb +14 -0
  56. data/spec/dummy/app/models/gemini/helper.rb +90 -1
  57. data/spec/dummy/config/application.rb +1 -0
  58. data/spec/dummy/db/migrate/20191101132729_add_activity_flag_to_simple.rb +10 -0
  59. data/spec/dummy/delorean/blame_report.dl +1 -0
  60. data/spec/dummy/delorean/enum_report.dl +1 -0
  61. data/spec/dummy/delorean/marty_fields.dl +1 -0
  62. data/spec/dummy/delorean/table_report.dl +1 -0
  63. data/spec/features/data_blame_report_spec.rb +66 -0
  64. data/spec/features/data_grid_spec.rb +1 -1
  65. data/spec/features/enum_values_report_spec.rb +76 -0
  66. data/spec/features/inline_editing_spec.rb +33 -0
  67. data/spec/features/rule_spec.rb +1 -1
  68. data/spec/features/schedule_jobs_dashboard_spec.rb +1 -1
  69. data/spec/features/scripting_spec.rb +1 -1
  70. data/spec/features/user_list_report_spec.rb +74 -0
  71. data/spec/fixtures/misc/struct_compare_tests.txt +15 -5
  72. data/spec/job_helper.rb +39 -0
  73. data/spec/jobs/cron_job_spec.rb +91 -0
  74. data/spec/lib/mcfly_model_spec.rb +9 -0
  75. data/spec/models/promise_spec.rb +168 -1
  76. data/spec/other/diagnostic/delayed_job_workers_spec.rb +1 -1
  77. data/spec/performance/caching_spec.rb +99 -0
  78. data/spec/services/background_job/fetch_missing_in_schedule_cron_jobs_spec.rb +34 -0
  79. data/spec/support/delayed_job_helpers.rb +3 -3
  80. data/spec/support/shared_connection.rb +9 -1
  81. data/spec/support/structure_compare.rb +19 -3
  82. metadata +39 -6
  83. data/app/components/marty/event_view.rb +0 -129
  84. data/app/models/marty/event.rb +0 -317
  85. data/spec/dummy/db/migrate/20160923183516_add_bulk_pricing_event_ops.rb +0 -8
  86. data/spec/dummy/delorean/blame_report.dl +0 -268
  87. data/spec/dummy/delorean/marty_fields.dl +0 -63
  88. data/spec/dummy/delorean/table_report.dl +0 -34
  89. data/spec/models/event_spec.rb +0 -272
@@ -7,7 +7,7 @@ describe Marty::Diagnostic::DelayedJobWorkers do
7
7
  {
8
8
  ip || Marty::Helper.my_ip => {
9
9
  'Delayed Workers / Node' => {
10
- 'description' => error ? '3' : '4',
10
+ 'description' => error ? '7' : '8',
11
11
  'status' => status.nil? ? true : status,
12
12
  'consistent' => nil
13
13
  },
@@ -0,0 +1,99 @@
1
+ require 'benchmark/ips'
2
+ require 'spec_helper'
3
+
4
+ describe 'Caching Performance' do
5
+ def check_cache(adapter:)
6
+ ::Delorean::Cache.adapter = adapter
7
+ ::Delorean::Cache.adapter.clear_all!
8
+
9
+ expect(Math).to receive(:gamma).once.and_call_original
10
+ 2.times { Gemini::Helper.cached_factorial(10) }
11
+
12
+ ::Delorean::Cache.adapter.clear_all!
13
+ end
14
+
15
+ let(:mcfly_adapter) do
16
+ ::Marty::CacheAdapters::McflyRubyCache.new(size_per_class: 1000)
17
+ end
18
+
19
+ let(:redis_adapter) do
20
+ ::Marty::CacheAdapters::Redis.new
21
+ end
22
+
23
+ let(:memory_and_redis_adapter) do
24
+ ::Marty::CacheAdapters::MemoryAndRedis.new(
25
+ size_per_class: 1000
26
+ )
27
+ end
28
+
29
+ it 'cache works as expected' do
30
+ check_cache(adapter: mcfly_adapter)
31
+ check_cache(adapter: redis_adapter)
32
+ check_cache(adapter: memory_and_redis_adapter)
33
+ end
34
+
35
+ it 'performs fast enough' do
36
+ bm = Benchmark.ips do |x|
37
+ x.config(
38
+ suite: CacheSuite.new(
39
+ adapters: [
40
+ mcfly_adapter,
41
+ redis_adapter,
42
+ memory_and_redis_adapter
43
+ ]
44
+ )
45
+ )
46
+
47
+ x.report('redis_adapter') do |_t|
48
+ ::Delorean::Cache.adapter = redis_adapter
49
+ 10.times { |n| Gemini::Helper.cached_factorial(n) }
50
+ end
51
+
52
+ x.report('memory_and_redis_adapter') do |_t|
53
+ ::Delorean::Cache.adapter = memory_and_redis_adapter
54
+ 10.times { |n| Gemini::Helper.cached_factorial(n) }
55
+ end
56
+
57
+ x.report('mcfly_adapter') do |_t|
58
+ ::Delorean::Cache.adapter = mcfly_adapter
59
+ 10.times { |n| Gemini::Helper.cached_factorial(n) }
60
+ end
61
+
62
+ x.compare!
63
+ end
64
+
65
+ h = bm.entries.each_with_object({}) do |e, hh|
66
+ hh[e.label] = e.stats.central_tendency
67
+ end
68
+
69
+ memory_and_redis_vs_memory_factor = h['mcfly_adapter'] / h['memory_and_redis_adapter']
70
+ redis_vs_memory_and_redis_factor = h['memory_and_redis_adapter'] / h['redis_adapter']
71
+
72
+ expect(memory_and_redis_vs_memory_factor).to be < 3
73
+ expect(redis_vs_memory_and_redis_factor).to be > 100
74
+ end
75
+ end
76
+
77
+ class CacheSuite
78
+ def initialize(adapters:)
79
+ @adapters = adapters
80
+ end
81
+
82
+ def warming(*)
83
+ clear_cache
84
+ end
85
+
86
+ def running(*)
87
+ clear_cache
88
+ end
89
+
90
+ def warmup_stats(*); end
91
+
92
+ def add_report(*); end
93
+
94
+ private
95
+
96
+ def clear_cache
97
+ @adapters.map(&:clear_all!)
98
+ end
99
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ module Marty
4
+ describe BackgroundJob::FetchMissingInScheduleCronJobs do
5
+ before do
6
+ schedule = Marty::BackgroundJob::Schedule.create!(
7
+ job_class: 'TestJob',
8
+ cron: '0 0 * * *',
9
+ state: 'on'
10
+ )
11
+
12
+ Marty::Jobs::Schedule.call
13
+
14
+ dj = TestJob.delayed_job
15
+
16
+ TestJob.delayed_job.dup.tap do |new_dj|
17
+ new_dj.handler = new_dj.handler.gsub('TestJob', 'Test2Job')
18
+ new_dj.cron = nil
19
+ new_dj.save!
20
+ end
21
+
22
+ TestJob.delayed_job.dup.tap do |new_dj|
23
+ new_dj.handler = new_dj.handler.gsub('TestJob', 'MissingJob')
24
+ new_dj.save!
25
+ end
26
+ end
27
+
28
+ it 'fetchs only jobs that have cron and are not present in the dashboard' do
29
+ result = described_class.call
30
+ expect(result.size).to eq 1
31
+ expect(result.first.handler).to include('MissingJob')
32
+ end
33
+ end
34
+ end
@@ -1,11 +1,11 @@
1
1
  module Marty::RSpec::DelayedJobHelpers
2
2
  def start_delayed_job
3
- `RAILS_ENV=test #{Rails.root}/script/delayed_job -n 4 stop | cat`
4
- `RAILS_ENV=test #{Rails.root}/script/delayed_job -n 4 start | cat`
3
+ `RAILS_ENV=test #{Rails.root}/script/delayed_job -n 8 stop | cat`
4
+ `RAILS_ENV=test #{Rails.root}/script/delayed_job -n 8 start | cat`
5
5
  sleep 5
6
6
  end
7
7
 
8
8
  def stop_delayed_job
9
- `RAILS_ENV=test #{Rails.root}/script/delayed_job -n 4 stop | cat`
9
+ `RAILS_ENV=test #{Rails.root}/script/delayed_job -n 8 stop | cat`
10
10
  end
11
11
  end
@@ -18,7 +18,15 @@ module Marty; module RSpec; module SharedConnection
18
18
  clear_connection
19
19
 
20
20
  def self.connection
21
- EXCL_LAMBDA.call.include?(model_name) ? orig_connection :
21
+ # Workaround to fix a bug in Rails 6 with shared connections
22
+ # https://github.com/rails/rails/issues/36757
23
+ model_name_str = if name == 'primary::SchemaMigration'
24
+ name
25
+ else
26
+ model_name
27
+ end
28
+
29
+ EXCL_LAMBDA.call.include?(model_name_str) ? orig_connection :
22
30
  @@shared_connection ||
23
31
  ConnectionPool::Wrapper.new(size: 1) { retrieve_connection }
24
32
  end
@@ -12,9 +12,18 @@ module Marty::RSpec::StructureCompare
12
12
  return errs + [v2['error']] if
13
13
  v1.class != v2.class && v2.class == Hash && v2['error']
14
14
 
15
- return errs + ["path=#{pathstr} class mismatch #{v1.class} #{v2.class}"] unless
15
+ errst = "path=#{pathstr} class mismatch "\
16
+ "#{v1.class}#{show_value(v1)} != "\
17
+ "#{v2.class}#{show_value(v2)}"
18
+
19
+ return if (cmp_opts['float_str_match'] ||
20
+ ENV['FLOAT_STR_MATCH'] == 'true') &&
21
+ v1.to_s == v2.to_s &&
22
+ [v1, v2].map(&:class).to_set == Set.new([String, Float])
23
+
24
+ return errs + [errst] unless
16
25
  v1.class == v2.class ||
17
- (!cmp_opts['float_int_nomatch'] &&
26
+ (!(cmp_opts['float_int_nomatch'] || ENV['FLOAT_INT_NOMATCH'] == 'true') &&
18
27
  [v1, v2].map(&:class).to_set == Set.new([Integer, Float]))
19
28
 
20
29
  override = (cmp_opts['ignore'] || []).include?(key)
@@ -25,7 +34,7 @@ module Marty::RSpec::StructureCompare
25
34
  Regexp.new('\A' + v1 + '\z').match(v2) ||
26
35
  Regexp.new('\A' + v2 + '\z').match(v1) ||
27
36
  override
28
- when Integer, DateTime, TrueClass, FalseClass, NilClass
37
+ when Integer, DateTime, TrueClass, FalseClass, NilClass, Time, Date
29
38
  return errs + ["path=#{pathstr} #{v1} != #{v2}"] if v1 != v2 && !override
30
39
  when Float
31
40
  return errs + ["path=#{pathstr} #{v1} != #{v2}"] if
@@ -53,6 +62,13 @@ module Marty::RSpec::StructureCompare
53
62
  end
54
63
  errs
55
64
  end
65
+
66
+ def self.show_value(val)
67
+ return '' if [Array, Hash, TrueClass, FalseClass, NilClass].
68
+ include?(val.class)
69
+
70
+ format(' (%<val>s)', val: val)
71
+ end
56
72
  end
57
73
 
58
74
  def struct_compare(v1raw, v2raw, cmp_opts = {})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marty
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-10-14 00:00:00.000000000 Z
17
+ date: 2019-11-08 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: aws-sigv4
@@ -184,6 +184,20 @@ dependencies:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
+ - !ruby/object:Gem::Dependency
188
+ name: redis
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ type: :runtime
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
187
201
  - !ruby/object:Gem::Dependency
188
202
  name: rubyzip
189
203
  requirement: !ruby/object:Gem::Requirement
@@ -243,6 +257,7 @@ files:
243
257
  - app/assets/stylesheets/marty/application.css
244
258
  - app/assets/stylesheets/marty/codemirror/codemirror.css
245
259
  - app/assets/stylesheets/marty/codemirror/delorean.css
260
+ - app/assets/stylesheets/marty/dark_mode.css
246
261
  - app/components/marty/api_auth_view.rb
247
262
  - app/components/marty/api_config_view.rb
248
263
  - app/components/marty/api_log_view.rb
@@ -255,7 +270,6 @@ files:
255
270
  - app/components/marty/data_grid_view.rb
256
271
  - app/components/marty/data_grid_view/client/data_grid_edit.js
257
272
  - app/components/marty/delorean_rule_view.rb
258
- - app/components/marty/event_view.rb
259
273
  - app/components/marty/extras/layout.rb
260
274
  - app/components/marty/extras/misc.rb
261
275
  - app/components/marty/form.rb
@@ -293,6 +307,7 @@ files:
293
307
  - app/components/marty/reporting/client/reporting.js
294
308
  - app/components/marty/schedule_jobs_dashboard.rb
295
309
  - app/components/marty/schedule_jobs_dashboard/client/schedule_jobs_dashboard.js
310
+ - app/components/marty/schedule_jobs_grid.rb
296
311
  - app/components/marty/schedule_jobs_logs.rb
297
312
  - app/components/marty/schedule_jobs_logs/client/schedule_jobs_logs.js
298
313
  - app/components/marty/script_form.rb
@@ -332,7 +347,6 @@ files:
332
347
  - app/models/marty/enum.rb
333
348
  - app/models/marty/enum_event_operation.rb
334
349
  - app/models/marty/enum_promise_type.rb
335
- - app/models/marty/event.rb
336
350
  - app/models/marty/grid_index_boolean.rb
337
351
  - app/models/marty/grid_index_int4range.rb
338
352
  - app/models/marty/grid_index_integer.rb
@@ -353,9 +367,11 @@ files:
353
367
  - app/models/marty/user.rb
354
368
  - app/models/marty/user_role.rb
355
369
  - app/models/marty/vw_promise.rb
370
+ - app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
356
371
  - app/services/marty/background_job/update_schedule.rb
357
372
  - app/services/marty/data_grid/constraint.rb
358
373
  - app/services/marty/data_grid_view/save_grid.rb
374
+ - app/services/marty/enums/report.rb
359
375
  - app/services/marty/jobs/schedule.rb
360
376
  - app/services/marty/promises/delorean.rb
361
377
  - app/services/marty/promises/delorean/create.rb
@@ -418,11 +434,15 @@ files:
418
434
  - db/migrate/509_update_dg_plpgsql_v1_fns.rb
419
435
  - db/migrate/510_schedule_job_to_remove_old_promises.rb
420
436
  - db/migrate/511_create_marty_delayed_job_logs.rb
437
+ - db/migrate/512_add_promise_priority.rb
438
+ - db/migrate/513_add_priority_to_promise_view.rb
439
+ - db/migrate/514_remove_marty_events.rb
421
440
  - db/seeds.rb
422
441
  - db/sql/lookup_grid_distinct_v1.sql
423
442
  - db/sql/query_grid_dir_v1.sql
424
443
  - delorean/blame_report.dl
425
444
  - delorean/diagnostics.dl
445
+ - delorean/enum_report.dl
426
446
  - delorean/marty_fields.dl
427
447
  - delorean/promises.dl
428
448
  - delorean/script_report.dl
@@ -435,11 +455,14 @@ files:
435
455
  - lib/marty/aws/request.rb
436
456
  - lib/marty/cache_adapters.rb
437
457
  - lib/marty/cache_adapters/mcfly_ruby_cache.rb
458
+ - lib/marty/cache_adapters/memory_and_redis.rb
459
+ - lib/marty/cache_adapters/redis.rb
438
460
  - lib/marty/content_handler.rb
439
461
  - lib/marty/data_change.rb
440
462
  - lib/marty/data_conversion.rb
441
463
  - lib/marty/data_exporter.rb
442
464
  - lib/marty/data_importer.rb
465
+ - lib/marty/delayed_job/scheduled_job_plugin.rb
443
466
  - lib/marty/diagnostic/aws/ec2_instance.rb
444
467
  - lib/marty/diagnostic/aws/error.rb
445
468
  - lib/marty/diagnostic/base.rb
@@ -467,6 +490,7 @@ files:
467
490
  - lib/marty/promise_job.rb
468
491
  - lib/marty/promise_proxy.rb
469
492
  - lib/marty/promise_ruby_job.rb
493
+ - lib/marty/rails_app.rb
470
494
  - lib/marty/railtie.rb
471
495
  - lib/marty/relation.rb
472
496
  - lib/marty/rpc_call.rb
@@ -497,11 +521,13 @@ files:
497
521
  - spec/dummy/app/components/gemini/cm_auth_app.rb
498
522
  - spec/dummy/app/components/gemini/loan_program_view.rb
499
523
  - spec/dummy/app/components/gemini/my_rule_view.rb
524
+ - spec/dummy/app/components/gemini/simple_view.rb
500
525
  - spec/dummy/app/components/gemini/xyz_rule_view.rb
501
526
  - spec/dummy/app/controllers/application_controller.rb
502
527
  - spec/dummy/app/controllers/components_controller.rb
503
528
  - spec/dummy/app/helpers/application_helper.rb
504
529
  - spec/dummy/app/jobs/test2_job.rb
530
+ - spec/dummy/app/jobs/test_failing_job.rb
505
531
  - spec/dummy/app/jobs/test_job.rb
506
532
  - spec/dummy/app/mailers/.gitkeep
507
533
  - spec/dummy/app/models/.gitkeep
@@ -562,7 +588,6 @@ files:
562
588
  - spec/dummy/db/migrate/20150420000003_create_grouping_head_versions.rb
563
589
  - spec/dummy/db/migrate/20151023000001_create_simple.rb
564
590
  - spec/dummy/db/migrate/20160100000038_create_gemini_states.rb
565
- - spec/dummy/db/migrate/20160923183516_add_bulk_pricing_event_ops.rb
566
591
  - spec/dummy/db/migrate/20170706081300_add_state_array_to_lp.rb
567
592
  - spec/dummy/db/migrate/20170725160000_add_misc_arrays_to_lp.rb
568
593
  - spec/dummy/db/migrate/20171220150101_add_rule_type_enums.rb
@@ -570,11 +595,13 @@ files:
570
595
  - spec/dummy/db/migrate/20171221095359_create_gemini_xyz_rules.rb
571
596
  - spec/dummy/db/migrate/20171222150100_add_rule_indices.rb
572
597
  - spec/dummy/db/migrate/20190702115241_add_simple_guards_options_to_rules.rb
598
+ - spec/dummy/db/migrate/20191101132729_add_activity_flag_to_simple.rb
573
599
  - spec/dummy/db/seeds.rb
574
600
  - spec/dummy/delorean/base_code.dl
575
601
  - spec/dummy/delorean/blame_report.dl
576
602
  - spec/dummy/delorean/data_report.dl
577
603
  - spec/dummy/delorean/delorean_fn.dl
604
+ - spec/dummy/delorean/enum_report.dl
578
605
  - spec/dummy/delorean/marty_fields.dl
579
606
  - spec/dummy/delorean/styles.dl
580
607
  - spec/dummy/delorean/table_report.dl
@@ -1597,11 +1624,14 @@ files:
1597
1624
  - spec/dummy/spec/features/javascripts
1598
1625
  - spec/dummy/tmp/.gitkeep
1599
1626
  - spec/features/auth_app_spec.rb
1627
+ - spec/features/data_blame_report_spec.rb
1600
1628
  - spec/features/data_grid_spec.rb
1601
1629
  - spec/features/data_import_spec.rb
1602
1630
  - spec/features/endpoint_access.rb
1603
1631
  - spec/features/enum_spec.rb
1632
+ - spec/features/enum_values_report_spec.rb
1604
1633
  - spec/features/extjs_spec.rb
1634
+ - spec/features/inline_editing_spec.rb
1605
1635
  - spec/features/javascripts/job_dashboard_live_search.js.coffee
1606
1636
  - spec/features/javascripts/login.js.coffee
1607
1637
  - spec/features/jobs_dashboard_spec.rb
@@ -1612,6 +1642,7 @@ files:
1612
1642
  - spec/features/schedule_jobs_logs_spec.rb
1613
1643
  - spec/features/scripting_spec.rb
1614
1644
  - spec/features/scripting_test_spec.rb
1645
+ - spec/features/user_list_report_spec.rb
1615
1646
  - spec/features/user_view_spec.rb
1616
1647
  - spec/fixtures/csv/rule/DataGrid.csv
1617
1648
  - spec/fixtures/csv/rule/MyRule.csv
@@ -1635,6 +1666,7 @@ files:
1635
1666
  - spec/fixtures/scripts/load_tests/script1.dl
1636
1667
  - spec/fixtures/scripts/load_tests/script2.dl
1637
1668
  - spec/job_helper.rb
1669
+ - spec/jobs/cron_job_spec.rb
1638
1670
  - spec/lib/data_blame_spec.rb
1639
1671
  - spec/lib/data_exporter_spec.rb
1640
1672
  - spec/lib/data_importer_spec.rb
@@ -1652,7 +1684,6 @@ files:
1652
1684
  - spec/models/background_job/schedule.rb
1653
1685
  - spec/models/config_spec.rb
1654
1686
  - spec/models/data_grid_spec.rb
1655
- - spec/models/event_spec.rb
1656
1687
  - spec/models/import_type_spec.rb
1657
1688
  - spec/models/posting_spec.rb
1658
1689
  - spec/models/promise_spec.rb
@@ -1665,7 +1696,9 @@ files:
1665
1696
  - spec/other/diagnostic/delayed_job_version_spec.rb
1666
1697
  - spec/other/diagnostic/delayed_job_workers_spec.rb
1667
1698
  - spec/other/diagnostic/reporter_spec.rb
1699
+ - spec/performance/caching_spec.rb
1668
1700
  - spec/requests/routes_spec.rb
1701
+ - spec/services/background_job/fetch_missing_in_schedule_cron_jobs_spec.rb
1669
1702
  - spec/services/jobs/schedule_spec.rb
1670
1703
  - spec/spec_helper.rb
1671
1704
  - spec/support/chromedriver.rb
@@ -1,129 +0,0 @@
1
- class Marty::EventView < Marty::Grid
2
- has_marty_permissions \
3
- read: :any,
4
- update: [:admin],
5
- delete: [:admin]
6
-
7
- def configure(c)
8
- super
9
-
10
- c.title ||= I18n.t('events', default: 'Events')
11
- c.model = 'Marty::Event'
12
- c.paging = :buffered
13
- c.editing = :in_form
14
- c.attributes = [
15
- :id,
16
- :klass,
17
- :subject_id,
18
- :enum_event_operation,
19
- :start_dt,
20
- :end_dt,
21
- :expire_secs,
22
- :promise_job_id,
23
- :promise_start_dt,
24
- :promise_end_dt,
25
- :promise_status,
26
- :error,
27
- :comment,
28
- ]
29
-
30
- c.store_config.merge!(sorters: [{ property: :id,
31
- direction: 'DESC',
32
- }])
33
- Marty::Event.cleanup
34
- end
35
-
36
- def default_context_menu
37
- []
38
- end
39
-
40
- attribute :klass do |c|
41
- c.text = I18n.t('event_grid.klass')
42
- c.width = 100
43
- c.read_only = true
44
- end
45
-
46
- attribute :subject_id do |c|
47
- c.text = I18n.t('event_grid.subject_id')
48
- c.width = 50
49
- c.read_only = true
50
- end
51
-
52
- attribute :enum_event_operation do |c|
53
- c.text = I18n.t('event_grid.enum_event_operation')
54
- c.width = 100
55
- c.read_only = true
56
- end
57
-
58
- attribute :start_dt_dt do |c|
59
- c.text = I18n.t('event_grid.start_dt')
60
- c.format = 'Y-m-d H:i:s'
61
- end
62
-
63
- attribute :end_dt_dt do |c|
64
- c.text = I18n.t('event_grid.end_dt')
65
- c.format = 'Y-m-d H:i:s'
66
- end
67
-
68
- attribute :error do |c|
69
- error_map = {
70
- nil => '',
71
- true => 'Error',
72
- false => 'Success',
73
- }
74
- map_error = error_map.each_with_object({}) { |(k, v), h| h[v] = k }
75
- editor_config = {
76
- trigger_action: :all,
77
- xtype: :combo,
78
- store: ['Success', 'Error', ''],
79
- }
80
- c.column_config = { editor: editor_config }
81
- c.field_config = editor_config
82
- c.text = I18n.t('event_grid.error')
83
- c.type = :string
84
- c.width = 150
85
- c.getter = lambda { |r| error_map[r.error] }
86
- c.setter = lambda { |r, v| r.error = map_error[v] }
87
- end
88
-
89
- attribute :comment do |c|
90
- c.text = I18n.t('event_grid.comment')
91
- c.width = 400
92
- end
93
-
94
- def promise_getter(field)
95
- lambda { |r|
96
- return nil unless r.promise_id
97
- return nil unless p = Marty::Promise.where(id: r.promise_id).first
98
-
99
- p.send(field)
100
- }
101
- end
102
- attribute :promise_job_id do |c|
103
- c.text = I18n.t('event_grid.promise_job_id')
104
- c.getter = promise_getter(:job_id)
105
- c.read_only = true
106
- end
107
-
108
- attribute :promise_start_dt do |c|
109
- c.text = I18n.t('event_grid.promise_start_dt')
110
- c.width = 150
111
- c.getter = promise_getter(:start_dt)
112
- c.read_only = true
113
- end
114
-
115
- attribute :promise_end_dt do |c|
116
- c.text = I18n.t('event_grid.promise_end_dt')
117
- c.width = 150
118
- c.getter = promise_getter(:end_dt)
119
- c.read_only = true
120
- end
121
-
122
- attribute :promise_status do |c|
123
- c.text = I18n.t('event_grid.promise_status')
124
- c.getter = promise_getter(:status)
125
- c.read_only = true
126
- end
127
- end
128
-
129
- EventView = Marty::EventView