marty 2.5.2 → 2.5.4

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.
Files changed (181) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +4 -0
  3. data/.rubocop.yml +7 -0
  4. data/.rubocop_todo.yml +11 -589
  5. data/Gemfile +9 -9
  6. data/Gemfile.lock +1 -1
  7. data/Rakefile +1 -3
  8. data/app/components/marty/api_auth_view.rb +3 -3
  9. data/app/components/marty/api_config_view.rb +8 -8
  10. data/app/components/marty/api_log_view.rb +16 -20
  11. data/app/components/marty/auth_app.rb +6 -6
  12. data/app/components/marty/base_rule_view.rb +27 -19
  13. data/app/components/marty/config_view.rb +12 -9
  14. data/app/components/marty/data_grid_view.rb +26 -26
  15. data/app/components/marty/delorean_rule_view.rb +0 -1
  16. data/app/components/marty/event_view.rb +27 -27
  17. data/app/components/marty/extras/layout.rb +26 -26
  18. data/app/components/marty/extras/misc.rb +2 -2
  19. data/app/components/marty/grid.rb +13 -13
  20. data/app/components/marty/grid_append_only.rb +0 -1
  21. data/app/components/marty/import_type_view.rb +13 -13
  22. data/app/components/marty/import_view.rb +17 -16
  23. data/app/components/marty/log_view.rb +16 -14
  24. data/app/components/marty/main_auth_app.rb +59 -59
  25. data/app/components/marty/main_auth_app/client/main_auth_app.js +3 -3
  26. data/app/components/marty/mcfly_grid_panel.rb +10 -10
  27. data/app/components/marty/new_posting_form.rb +11 -11
  28. data/app/components/marty/new_posting_window.rb +0 -1
  29. data/app/components/marty/posting_grid.rb +12 -13
  30. data/app/components/marty/promise_view.rb +6 -6
  31. data/app/components/marty/report_form.rb +50 -53
  32. data/app/components/marty/report_select.rb +27 -27
  33. data/app/components/marty/reporting.rb +4 -4
  34. data/app/components/marty/script_form.rb +40 -42
  35. data/app/components/marty/script_grid.rb +24 -24
  36. data/app/components/marty/script_tester.rb +40 -42
  37. data/app/components/marty/scripting.rb +25 -27
  38. data/app/components/marty/simple_app.rb +24 -9
  39. data/app/components/marty/tag_grid.rb +12 -13
  40. data/app/components/marty/user_view.rb +35 -35
  41. data/app/controllers/marty/application_controller.rb +3 -4
  42. data/app/controllers/marty/components_controller.rb +1 -1
  43. data/app/controllers/marty/delayed_job_controller.rb +1 -0
  44. data/app/controllers/marty/diagnostic/controller.rb +4 -6
  45. data/app/controllers/marty/job_controller.rb +6 -6
  46. data/app/controllers/marty/report_controller.rb +11 -11
  47. data/app/controllers/marty/rpc_controller.rb +15 -16
  48. data/app/helpers/marty/script_set.rb +4 -4
  49. data/app/models/marty/api_auth.rb +4 -5
  50. data/app/models/marty/api_config.rb +1 -1
  51. data/app/models/marty/base.rb +9 -8
  52. data/app/models/marty/base_rule.rb +18 -13
  53. data/app/models/marty/config.rb +4 -5
  54. data/app/models/marty/data_grid.rb +157 -181
  55. data/app/models/marty/delorean_rule.rb +63 -62
  56. data/app/models/marty/enum.rb +1 -1
  57. data/app/models/marty/event.rb +56 -59
  58. data/app/models/marty/helper.rb +38 -6
  59. data/app/models/marty/import_type.rb +6 -6
  60. data/app/models/marty/log.rb +3 -2
  61. data/app/models/marty/name_validator.rb +3 -2
  62. data/app/models/marty/pg_enum.rb +3 -4
  63. data/app/models/marty/posting.rb +20 -24
  64. data/app/models/marty/promise.rb +28 -30
  65. data/app/models/marty/script.rb +30 -28
  66. data/app/models/marty/tag.rb +8 -8
  67. data/app/models/marty/token.rb +2 -2
  68. data/app/models/marty/user.rb +24 -23
  69. data/app/models/marty/vw_promise.rb +10 -11
  70. data/config/routes.rb +2 -2
  71. data/delorean/blame_report.dl +268 -0
  72. data/{spec/dummy/delorean/fields.dl → delorean/marty_fields.dl} +8 -0
  73. data/delorean/table_report.dl +34 -0
  74. data/docker-compose.dummy.yml +2 -3
  75. data/lib/marty/aws/base.rb +8 -8
  76. data/lib/marty/aws/request.rb +4 -4
  77. data/lib/marty/cache_adapters/mcfly_ruby_cache.rb +1 -0
  78. data/lib/marty/content_handler.rb +25 -25
  79. data/lib/marty/data_change.rb +49 -71
  80. data/lib/marty/data_conversion.rb +20 -28
  81. data/lib/marty/data_exporter.rb +25 -28
  82. data/lib/marty/data_importer.rb +25 -27
  83. data/lib/marty/engine.rb +1 -2
  84. data/lib/marty/json_schema.rb +22 -24
  85. data/lib/marty/logger.rb +6 -9
  86. data/lib/marty/mcfly_model.rb +20 -24
  87. data/lib/marty/migrations.rb +37 -35
  88. data/lib/marty/monkey.rb +33 -33
  89. data/lib/marty/permissions.rb +18 -18
  90. data/lib/marty/promise_job.rb +17 -17
  91. data/lib/marty/promise_proxy.rb +6 -6
  92. data/lib/marty/relation.rb +6 -7
  93. data/lib/marty/rpc_call.rb +13 -12
  94. data/lib/marty/rule_script_set.rb +32 -28
  95. data/lib/marty/schema_helper.rb +37 -51
  96. data/lib/marty/util.rb +25 -24
  97. data/lib/marty/version.rb +1 -1
  98. data/lib/marty/xl.rb +121 -115
  99. data/make-dummy.mk +3 -0
  100. data/marty.gemspec +21 -21
  101. data/other/marty/api/base.rb +34 -35
  102. data/other/marty/diagnostic/aws/ec2_instance.rb +8 -8
  103. data/other/marty/diagnostic/base.rb +13 -14
  104. data/other/marty/diagnostic/collection.rb +2 -1
  105. data/other/marty/diagnostic/connections.rb +8 -6
  106. data/other/marty/diagnostic/database.rb +1 -0
  107. data/other/marty/diagnostic/delayed_job_version.rb +7 -9
  108. data/other/marty/diagnostic/delayed_job_worker_total_count.rb +1 -1
  109. data/other/marty/diagnostic/delayed_job_workers.rb +1 -1
  110. data/other/marty/diagnostic/environment_variables.rb +17 -15
  111. data/other/marty/diagnostic/fatal.rb +1 -1
  112. data/other/marty/diagnostic/node.rb +5 -9
  113. data/other/marty/diagnostic/nodes.rb +7 -5
  114. data/other/marty/diagnostic/packer.rb +7 -7
  115. data/other/marty/diagnostic/reporter.rb +24 -27
  116. data/other/marty/diagnostic/version.rb +3 -5
  117. data/script/rails +2 -1
  118. data/spec/controllers/application_controller_spec.rb +6 -6
  119. data/spec/controllers/delayed_job_controller_spec.rb +4 -4
  120. data/spec/controllers/diagnostic/controller_spec.rb +59 -60
  121. data/spec/controllers/job_controller_spec.rb +68 -69
  122. data/spec/controllers/rpc_controller_spec.rb +353 -359
  123. data/spec/controllers/rpc_import_spec.rb +15 -16
  124. data/spec/dummy/delorean/blame_report.dl +110 -15
  125. data/spec/dummy/delorean/data_report.dl +4 -4
  126. data/spec/dummy/delorean/marty_fields.dl +63 -0
  127. data/spec/dummy/delorean/table_report.dl +34 -0
  128. data/spec/features/auth_app_spec.rb +1 -2
  129. data/spec/features/data_import_spec.rb +2 -3
  130. data/spec/features/enum_spec.rb +42 -46
  131. data/spec/features/jobs_dashboard_spec.rb +14 -8
  132. data/spec/features/log_view_spec.rb +40 -43
  133. data/spec/features/reporting_spec.rb +15 -15
  134. data/spec/features/rule_spec.rb +195 -190
  135. data/spec/features/scripting_spec.rb +17 -20
  136. data/spec/features/scripting_test_spec.rb +32 -33
  137. data/spec/features/user_view_spec.rb +15 -17
  138. data/spec/job_helper.rb +11 -11
  139. data/spec/lib/data_blame_spec.rb +82 -0
  140. data/spec/lib/data_exporter_spec.rb +31 -32
  141. data/spec/lib/data_importer_spec.rb +382 -395
  142. data/spec/lib/delorean_query_spec.rb +117 -119
  143. data/spec/lib/json_schema_spec.rb +382 -392
  144. data/spec/lib/logger_spec.rb +23 -24
  145. data/spec/lib/mcfly_model_spec.rb +112 -109
  146. data/spec/lib/migrations_spec.rb +10 -10
  147. data/spec/lib/struct_compare_spec.rb +6 -6
  148. data/spec/lib/table_report_spec.rb +90 -0
  149. data/spec/lib/xl_spec.rb +63 -65
  150. data/spec/lib/xl_styles_spec.rb +16 -19
  151. data/spec/models/api_auth_spec.rb +30 -30
  152. data/spec/models/config_spec.rb +32 -32
  153. data/spec/models/data_grid_spec.rb +642 -655
  154. data/spec/models/event_spec.rb +96 -88
  155. data/spec/models/import_type_spec.rb +20 -20
  156. data/spec/models/posting_spec.rb +35 -35
  157. data/spec/models/promise_spec.rb +5 -5
  158. data/spec/models/rule_spec.rb +280 -269
  159. data/spec/models/script_spec.rb +27 -18
  160. data/spec/models/user_spec.rb +9 -9
  161. data/spec/other/diagnostic/base_spec.rb +20 -19
  162. data/spec/other/diagnostic/collection_spec.rb +6 -5
  163. data/spec/other/diagnostic/delayed_job_version_spec.rb +1 -1
  164. data/spec/other/diagnostic/delayed_job_workers_spec.rb +8 -8
  165. data/spec/other/diagnostic/reporter_spec.rb +31 -33
  166. data/spec/spec_helper.rb +5 -5
  167. data/spec/support/chromedriver.rb +3 -5
  168. data/spec/support/components/netzke_combobox.rb +1 -1
  169. data/spec/support/components/netzke_grid.rb +17 -17
  170. data/spec/support/custom_matchers.rb +2 -2
  171. data/spec/support/download_helper.rb +1 -1
  172. data/spec/support/helper.rb +1 -2
  173. data/spec/support/netzke.rb +31 -31
  174. data/spec/support/performance_helper.rb +8 -8
  175. data/spec/support/post_run_logger.rb +1 -2
  176. data/spec/support/setup.rb +1 -4
  177. data/spec/support/shared_connection.rb +2 -2
  178. data/spec/support/structure_compare.rb +21 -22
  179. data/spec/support/suite.rb +1 -2
  180. data/spec/support/users.rb +5 -6
  181. metadata +32 -26
@@ -10,7 +10,7 @@ module Marty; class DataGridView < McflyGridPanel
10
10
  # handles so they can be used by various other components
11
11
  # FIXME: add the ability to pull specific functions
12
12
  # from other component javascripts or add a base to pull from
13
- def self.show_grid_js(options={})
13
+ def self.show_grid_js(options = {})
14
14
  dg = options[:data_grid] || 'data_grid'
15
15
  title_str = options[:title_str] || 'Data Grid'
16
16
 
@@ -71,18 +71,18 @@ module Marty; class DataGridView < McflyGridPanel
71
71
  super
72
72
 
73
73
  c.title = I18n.t('data_grid')
74
- c.model = "Marty::DataGrid"
74
+ c.model = 'Marty::DataGrid'
75
75
  c.attributes =
76
76
  [
77
- :name,
78
- :vcols,
79
- :hcols,
80
- :lenient,
81
- :data_type,
82
- :created_dt,
77
+ :name,
78
+ :vcols,
79
+ :hcols,
80
+ :lenient,
81
+ :data_type,
82
+ :created_dt,
83
83
  ]
84
84
 
85
- c.store_config.merge!({sorters: [{property: :name, direction: 'ASC'}]})
85
+ c.store_config.merge!(sorters: [{ property: :name, direction: 'ASC' }])
86
86
  c.editing = :in_form
87
87
  c.paging = :pagination
88
88
  c.multi_select = false
@@ -91,14 +91,14 @@ module Marty; class DataGridView < McflyGridPanel
91
91
  endpoint :add_window__add_form__submit do |params|
92
92
  data = ActiveSupport::JSON.decode(params[:data])
93
93
 
94
- return client.netzke_notify("Permission Denied") if
94
+ return client.netzke_notify('Permission Denied') if
95
95
  !config[:permissions][:create]
96
96
 
97
97
  begin
98
- DataGrid.create_from_import(data["name"], data["export"])
98
+ DataGrid.create_from_import(data['name'], data['export'])
99
99
  client.success = true
100
100
  client.netzke_on_submit_success
101
- rescue => exc
101
+ rescue StandardError => exc
102
102
  client.netzke_notify(exc.to_s)
103
103
  end
104
104
  end
@@ -106,20 +106,20 @@ module Marty; class DataGridView < McflyGridPanel
106
106
  endpoint :edit_window__edit_form__submit do |params|
107
107
  data = ActiveSupport::JSON.decode(params[:data])
108
108
 
109
- dg = DataGrid.find_by_id(data["id"])
109
+ dg = DataGrid.find_by_id(data['id'])
110
110
 
111
111
  begin
112
- dg.update_from_import(data["name"], data["export"])
112
+ dg.update_from_import(data['name'], data['export'])
113
113
  client.success = true
114
114
  client.netzke_on_submit_success
115
- rescue => exc
115
+ rescue StandardError => exc
116
116
  client.netzke_notify(exc.to_s)
117
117
  end
118
118
  end
119
119
 
120
120
  action :show_grid do |a|
121
- a.text = "Show Grid"
122
- a.icon_cls = "fa fa-th-large glyph"
121
+ a.text = 'Show Grid'
122
+ a.icon_cls = 'fa fa-th-large glyph'
123
123
  a.handler = :netzke_show_grid
124
124
  end
125
125
 
@@ -128,7 +128,7 @@ module Marty; class DataGridView < McflyGridPanel
128
128
 
129
129
  dg = DataGrid.find_by_id(record_id)
130
130
 
131
- return client.netzke_notify("No data grid.") unless dg
131
+ return client.netzke_notify('No data grid.') unless dg
132
132
 
133
133
  meta_rows_raw, h_key_rows, data_rows = dg.export_array
134
134
  meta_rows = meta_rows_raw.map do |row|
@@ -153,8 +153,8 @@ module Marty; class DataGridView < McflyGridPanel
153
153
 
154
154
  def default_form_items
155
155
  [
156
- :name,
157
- textarea_field(:export, height: 300, hide_label: true),
156
+ :name,
157
+ textarea_field(:export, height: 300, hide_label: true),
158
158
  ]
159
159
  end
160
160
 
@@ -173,18 +173,18 @@ module Marty; class DataGridView < McflyGridPanel
173
173
  end
174
174
 
175
175
  attribute :hcols do |c|
176
- c.label = "Horizontal Attrs"
176
+ c.label = 'Horizontal Attrs'
177
177
  c.width = 200
178
178
  c.getter = lambda { |r|
179
- r.dir_infos("h").map {|inf| inf["attr"]}.join(', ')
179
+ r.dir_infos('h').map { |inf| inf['attr'] }.join(', ')
180
180
  }
181
181
  end
182
182
 
183
183
  attribute :vcols do |c|
184
- c.label = "Vertical Attrs"
184
+ c.label = 'Vertical Attrs'
185
185
  c.width = 200
186
186
  c.getter = lambda { |r|
187
- r.dir_infos("v").map {|inf| inf["attr"]}.join(', ')
187
+ r.dir_infos('v').map { |inf| inf['attr'] }.join(', ')
188
188
  }
189
189
  end
190
190
 
@@ -193,13 +193,13 @@ module Marty; class DataGridView < McflyGridPanel
193
193
  end
194
194
 
195
195
  attribute :data_type do |c|
196
- c.label = "Data Type"
196
+ c.label = 'Data Type'
197
197
  c.width = 200
198
198
  end
199
199
 
200
200
  attribute :created_dt do |c|
201
201
  c.label = I18n.t('updated_at')
202
- c.format = "Y-m-d H:i"
202
+ c.format = 'Y-m-d H:i'
203
203
  c.read_only = true
204
204
  end
205
205
  end; end
@@ -22,5 +22,4 @@ class Marty::DeloreanRuleView < Marty::BaseRuleView
22
22
  attribute :rule_type do |c|
23
23
  c.width = 200
24
24
  end
25
-
26
25
  end
@@ -1,14 +1,14 @@
1
1
  class Marty::EventView < Marty::Grid
2
2
  has_marty_permissions \
3
- read: :any,
4
- update: [:admin],
5
- delete: [:admin]
3
+ read: :any,
4
+ update: [:admin],
5
+ delete: [:admin]
6
6
 
7
7
  def configure(c)
8
8
  super
9
9
 
10
- c.title ||= I18n.t('events', default: "Events")
11
- c.model = "Marty::Event"
10
+ c.title ||= I18n.t('events', default: 'Events')
11
+ c.model = 'Marty::Event'
12
12
  c.paging = :buffered
13
13
  c.editing = :in_form
14
14
  c.attributes = [
@@ -27,9 +27,9 @@ class Marty::EventView < Marty::Grid
27
27
  :comment,
28
28
  ]
29
29
 
30
- c.store_config.merge!({sorters: [{property: :id,
30
+ c.store_config.merge!(sorters: [{ property: :id,
31
31
  direction: 'DESC',
32
- }]})
32
+ }])
33
33
  Marty::Event.cleanup
34
34
  end
35
35
 
@@ -38,56 +38,56 @@ class Marty::EventView < Marty::Grid
38
38
  end
39
39
 
40
40
  attribute :klass do |c|
41
- c.text = I18n.t("event_grid.klass")
41
+ c.text = I18n.t('event_grid.klass')
42
42
  c.width = 100
43
43
  c.read_only = true
44
44
  end
45
45
 
46
46
  attribute :subject_id do |c|
47
- c.text = I18n.t("event_grid.subject_id")
47
+ c.text = I18n.t('event_grid.subject_id')
48
48
  c.width = 50
49
49
  c.read_only = true
50
50
  end
51
51
 
52
52
  attribute :enum_event_operation do |c|
53
- c.text = I18n.t("event_grid.enum_event_operation")
53
+ c.text = I18n.t('event_grid.enum_event_operation')
54
54
  c.width = 100
55
55
  c.read_only = true
56
56
  end
57
57
 
58
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"
59
+ c.text = I18n.t('event_grid.start_dt')
60
+ c.format = 'Y-m-d H:i:s'
61
61
  end
62
62
 
63
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"
64
+ c.text = I18n.t('event_grid.end_dt')
65
+ c.format = 'Y-m-d H:i:s'
66
66
  end
67
67
 
68
68
  attribute :error do |c|
69
69
  error_map = {
70
- nil => "",
71
- true => "Error",
72
- false => "Success",
70
+ nil => '',
71
+ true => 'Error',
72
+ false => 'Success',
73
73
  }
74
74
  map_error = error_map.each_with_object({}) { |(k, v), h| h[v] = k }
75
75
  editor_config = {
76
76
  trigger_action: :all,
77
77
  xtype: :combo,
78
- store: ["Success", "Error", ""],
78
+ store: ['Success', 'Error', ''],
79
79
  }
80
80
  c.column_config = { editor: editor_config }
81
81
  c.field_config = editor_config
82
- c.text = I18n.t("event_grid.error")
82
+ c.text = I18n.t('event_grid.error')
83
83
  c.type = :string
84
84
  c.width = 150
85
- c.getter = lambda {|r| error_map[r.error]}
86
- c.setter = lambda {|r, v| r.error = map_error[v]}
85
+ c.getter = lambda { |r| error_map[r.error] }
86
+ c.setter = lambda { |r, v| r.error = map_error[v] }
87
87
  end
88
88
 
89
89
  attribute :comment do |c|
90
- c.text = I18n.t("event_grid.comment")
90
+ c.text = I18n.t('event_grid.comment')
91
91
  c.width = 400
92
92
  end
93
93
 
@@ -95,35 +95,35 @@ class Marty::EventView < Marty::Grid
95
95
  lambda { |r|
96
96
  return nil unless r.promise_id
97
97
  return nil unless p = Marty::Promise.where(id: r.promise_id).first
98
+
98
99
  p.send(field)
99
100
  }
100
101
  end
101
102
  attribute :promise_job_id do |c|
102
- c.text = I18n.t("event_grid.promise_job_id")
103
+ c.text = I18n.t('event_grid.promise_job_id')
103
104
  c.getter = promise_getter(:job_id)
104
105
  c.read_only = true
105
106
  end
106
107
 
107
108
  attribute :promise_start_dt do |c|
108
- c.text = I18n.t("event_grid.promise_start_dt")
109
+ c.text = I18n.t('event_grid.promise_start_dt')
109
110
  c.width = 150
110
111
  c.getter = promise_getter(:start_dt)
111
112
  c.read_only = true
112
113
  end
113
114
 
114
115
  attribute :promise_end_dt do |c|
115
- c.text = I18n.t("event_grid.promise_end_dt")
116
+ c.text = I18n.t('event_grid.promise_end_dt')
116
117
  c.width = 150
117
118
  c.getter = promise_getter(:end_dt)
118
119
  c.read_only = true
119
120
  end
120
121
 
121
122
  attribute :promise_status do |c|
122
- c.text = I18n.t("event_grid.promise_status")
123
+ c.text = I18n.t('event_grid.promise_status')
123
124
  c.getter = promise_getter(:status)
124
125
  c.read_only = true
125
126
  end
126
-
127
127
  end
128
128
 
129
129
  EventView = Marty::EventView
@@ -23,7 +23,7 @@ module Layout
23
23
  )
24
24
  end
25
25
 
26
- def dispfield(params={})
26
+ def dispfield(params = {})
27
27
  {
28
28
  attr_type: :displayfield,
29
29
  hide_label: !params[:field_label],
@@ -31,18 +31,18 @@ module Layout
31
31
  }.merge(params)
32
32
  end
33
33
 
34
- def vspacer(params={})
35
- vbox({flex: 1, border: false}.merge(params))
34
+ def vspacer(params = {})
35
+ vbox({ flex: 1, border: false }.merge(params))
36
36
  end
37
37
 
38
- def hspacer(params={})
39
- hbox({flex: 1, border: false}.merge(params))
38
+ def hspacer(params = {})
39
+ hbox({ flex: 1, border: false }.merge(params))
40
40
  end
41
41
 
42
- def textarea_field(name, options={})
42
+ def textarea_field(name, options = {})
43
43
  {
44
44
  name: name,
45
- width: "100%",
45
+ width: '100%',
46
46
  height: 150,
47
47
  xtype: :textareafield,
48
48
  auto_scroll: true,
@@ -54,10 +54,10 @@ module Layout
54
54
  } + options
55
55
  end
56
56
 
57
- def jsonb_field(name, options={})
57
+ def jsonb_field(name, options = {})
58
58
  {
59
59
  name: name,
60
- width: "100%",
60
+ width: '100%',
61
61
  height: 150,
62
62
  xtype: :textareafield,
63
63
  auto_scroll: true,
@@ -73,7 +73,7 @@ module Layout
73
73
  ######################################################################
74
74
  # PG ENUM field handling
75
75
 
76
- def enum_column(c, class_or_array, col=nil)
76
+ def enum_column(c, class_or_array, col = nil)
77
77
  col ||= c.name.demodulize.tableize.singularize
78
78
  vals = class_or_array.is_a?(Array) ? class_or_array : class_or_array::VALUES
79
79
  editor_config = {
@@ -111,11 +111,11 @@ module Layout
111
111
  end
112
112
 
113
113
  def enum_setter(name)
114
- lambda {|r, v| r.send("#{name}=", v.blank? || v == '---' ? nil : v)}
114
+ lambda { |r, v| r.send("#{name}=", v.blank? || v == '---' ? nil : v) }
115
115
  end
116
116
 
117
117
  def get_sorter(col)
118
- lambda {|rel, dir| rel.order("#{col}::text #{dir.to_s}")}
118
+ lambda { |rel, dir| rel.order("#{col}::text #{dir.to_s}") }
119
119
  end
120
120
 
121
121
  ######################################################################
@@ -123,31 +123,31 @@ module Layout
123
123
  # Netzke 8.x.
124
124
 
125
125
  BOOL_MAP = {
126
- nil => "---",
127
- true => "True",
128
- false => "False",
126
+ nil => '---',
127
+ true => 'True',
128
+ false => 'False',
129
129
  }
130
130
 
131
131
  MAP_BOOL = {
132
- "---" => nil,
133
- "" => nil,
134
- "True" => true,
135
- "False" => false,
132
+ '---' => nil,
133
+ '' => nil,
134
+ 'True' => true,
135
+ 'False' => false,
136
136
  }
137
137
 
138
138
  def bool_getter(name)
139
- lambda {|r| BOOL_MAP[r.send(name)]}
139
+ lambda { |r| BOOL_MAP[r.send(name)] }
140
140
  end
141
141
 
142
142
  def bool_setter(name)
143
- lambda {|r, v| r.send("#{name}=", MAP_BOOL[v])}
143
+ lambda { |r, v| r.send("#{name}=", MAP_BOOL[v]) }
144
144
  end
145
145
 
146
146
  def nullable_bool_column(name)
147
147
  editor_config = {
148
148
  trigger_action: :all,
149
149
  xtype: :combo,
150
- store: ["True", "False", "---"],
150
+ store: ['True', 'False', '---'],
151
151
  }
152
152
  {
153
153
  column_config: { editor: editor_config },
@@ -161,7 +161,7 @@ module Layout
161
161
  ######################################################################
162
162
  # make sure to validate range vals on the model (e.g. see rule.rb)
163
163
 
164
- def range_getter(name, json_field=nil)
164
+ def range_getter(name, json_field = nil)
165
165
  if json_field
166
166
  lambda { |r| Marty::Util.pg_range_to_human(r.send(json_field)[name]) }
167
167
  else
@@ -169,13 +169,13 @@ module Layout
169
169
  end
170
170
  end
171
171
 
172
- def range_setter(name, json_field=nil)
172
+ def range_setter(name, json_field = nil)
173
173
  if json_field
174
174
  lambda do |r, v|
175
175
  cookedv = v && v.present? && (Marty::Util.human_to_pg_range(v) rescue v)
176
- h = r.send(json_field)
176
+ h = r.send(json_field)
177
177
  if cookedv
178
- r.send("#{json_field}=", h + {name=>cookedv})
178
+ r.send("#{json_field}=", h + { name => cookedv })
179
179
  else
180
180
  h.delete(name)
181
181
  r.send("#{json_field}=", h)
@@ -3,7 +3,7 @@ module Marty::Extras::Misc
3
3
  editor_config: {
4
4
  trigger_action: :all,
5
5
  xtype: :combo,
6
- store: (1..12).map {|x| [x, "%02d" % x]},
6
+ store: (1..12).map { |x| [x, '%02d' % x] },
7
7
  # FIXME: for some reason, with Netzke 0.8.2, the label show
8
8
  # up in the grid editor. This hack seems to fix the
9
9
  # problem. However, the label in the add-in-form now looks
@@ -17,7 +17,7 @@ module Marty::Extras::Misc
17
17
  }
18
18
  def self.numberfield_cfg(decimal_places)
19
19
  {
20
- format: "0." + "0"*decimal_places,
20
+ format: '0.' + '0' * decimal_places,
21
21
  xtype: 'numbercolumn',
22
22
  editor_config: { hide_trigger: true,
23
23
  decimal_precision: decimal_places },
@@ -6,7 +6,7 @@ class Marty::Grid < ::Netzke::Grid::Base
6
6
  # parent grid is the grid in which child/linked_components is defined
7
7
  # child components are components dependent on the selected parent row
8
8
  # linked components will update whenever the parent is updated
9
- def initialize args, kwargs=nil
9
+ def initialize args, kwargs = nil
10
10
  super(args, kwargs)
11
11
  client_config[:child_components] = child_components || []
12
12
  client_config[:linked_components] = linked_components || []
@@ -33,8 +33,8 @@ class Marty::Grid < ::Netzke::Grid::Base
33
33
  }
34
34
 
35
35
  c.editing = :both
36
- c.store_config = {page_size: 30}
37
- c.view_config = {preserve_scroll_on_reload: true}
36
+ c.store_config = { page_size: 30 }
37
+ c.view_config = { preserve_scroll_on_reload: true }
38
38
 
39
39
  # disable buffered renderer plugin to avoid white space on reload
40
40
  c.buffered_renderer = false
@@ -45,8 +45,8 @@ class Marty::Grid < ::Netzke::Grid::Base
45
45
  end
46
46
 
47
47
  action :clear_filters do |a|
48
- a.text = "X"
49
- a.tooltip = "Clear filters"
48
+ a.text = 'X'
49
+ a.tooltip = 'Clear filters'
50
50
  a.handler = :clear_filters
51
51
  end
52
52
 
@@ -57,8 +57,8 @@ class Marty::Grid < ::Netzke::Grid::Base
57
57
  end
58
58
 
59
59
  action :clear_filters do |a|
60
- a.text = "X"
61
- a.tooltip = "Clear filters"
60
+ a.text = 'X'
61
+ a.tooltip = 'Clear filters'
62
62
  a.handler = :clear_filters
63
63
  end
64
64
 
@@ -67,37 +67,37 @@ class Marty::Grid < ::Netzke::Grid::Base
67
67
  action :add do |a|
68
68
  super(a)
69
69
  a.icon = nil
70
- a.icon_cls = "fa fa-plus glyph"
70
+ a.icon_cls = 'fa fa-plus glyph'
71
71
  end
72
72
 
73
73
  action :add_in_form do |a|
74
74
  super(a)
75
75
  a.icon = nil
76
- a.icon_cls = "fa fa-plus-square glyph"
76
+ a.icon_cls = 'fa fa-plus-square glyph'
77
77
  end
78
78
 
79
79
  action :edit do |a|
80
80
  super(a)
81
81
  a.icon = nil
82
- a.icon_cls = "fa fa-edit glyph"
82
+ a.icon_cls = 'fa fa-edit glyph'
83
83
  end
84
84
 
85
85
  action :edit_in_form do |a|
86
86
  super(a)
87
87
  a.icon = nil
88
- a.icon_cls = "fa fa-pen-square glyph"
88
+ a.icon_cls = 'fa fa-pen-square glyph'
89
89
  end
90
90
 
91
91
  action :delete do |a|
92
92
  super(a)
93
93
  a.icon = nil
94
- a.icon_cls = "fa fa-trash glyph"
94
+ a.icon_cls = 'fa fa-trash glyph'
95
95
  end
96
96
 
97
97
  action :apply do |a|
98
98
  super(a)
99
99
  a.icon = nil
100
- a.icon_cls = "fa fa-check glyph"
100
+ a.icon_cls = 'fa fa-check glyph'
101
101
  end
102
102
 
103
103
  def child_components