marty 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/components/marty/base_rule_view.rb +6 -0
- data/app/components/marty/grid.rb +25 -0
- data/app/components/marty/record_form_window.rb +12 -0
- data/app/models/marty/data_grid.rb +5 -2
- data/app/models/marty/delorean_rule.rb +0 -8
- data/app/models/marty/promise.rb +15 -1
- data/config/locales/en.yml +5 -0
- data/lib/marty.rb +0 -1
- data/lib/marty/javascript/overrides.js +14 -0
- data/lib/marty/monkey.rb +28 -2
- data/lib/marty/version.rb +1 -1
- data/spec/dummy/config/application.rb +6 -0
- metadata +4 -3
- data/lib/marty/lazy_column_loader.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb8e6c31b7c3d069f58ef86fa901ac18df05c7a0
|
4
|
+
data.tar.gz: 9208a3fcbab2e2e42a01c9a4c84ce59c05391aab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72de58e1116dd97de068be07a05a91f8c7e08cf9ae80be8edb2e2043b0ebb8b8f88de09a93b957e16bc8377ec1b207cdb6e37c21074cf904cf9548b90b8c844e
|
7
|
+
data.tar.gz: 202dd1ea697678aa730e02801b76fb4ffe68a93a75f343b77402317e6dc238ed7d7e14dfd3019c8813b36729bae05c793f1fd63d4ce017be503bb36fda36e65e
|
data/Gemfile.lock
CHANGED
@@ -6,6 +6,9 @@ class Marty::Grid < ::Netzke::Grid::Base
|
|
6
6
|
|
7
7
|
def configure_form_window(c)
|
8
8
|
super
|
9
|
+
|
10
|
+
c.klass = Marty::RecordFormWindow
|
11
|
+
|
9
12
|
# Fix Add in form/Edit in form modal popup width
|
10
13
|
# Netzke 0.10.1 defaults width to 80% of screen which is too wide
|
11
14
|
# for a form where the fields are stacked top to bottom
|
@@ -22,6 +25,28 @@ class Marty::Grid < ::Netzke::Grid::Base
|
|
22
25
|
}
|
23
26
|
JS
|
24
27
|
|
28
|
+
c.do_view_in_form = l(<<-JS)
|
29
|
+
function(record){
|
30
|
+
this.netzkeLoadComponent("view_window", {
|
31
|
+
serverConfig: {record_id: record.id},
|
32
|
+
callback: function(w){
|
33
|
+
w.show();
|
34
|
+
w.on('close', function(){
|
35
|
+
if (w.closeRes === "ok") {
|
36
|
+
this.netzkeReloadStore();
|
37
|
+
}
|
38
|
+
}, this);
|
39
|
+
}});
|
40
|
+
}
|
41
|
+
JS
|
42
|
+
end
|
43
|
+
|
44
|
+
component :view_window do |c|
|
45
|
+
configure_form_window(c)
|
46
|
+
c.excluded = !allowed_to?(:read)
|
47
|
+
c.items = [:view_form]
|
48
|
+
c.title = I18n.t('netzke.grid.base.view_record',
|
49
|
+
model: model.model_name.human)
|
25
50
|
end
|
26
51
|
|
27
52
|
def class_can?(op)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Marty::RecordFormWindow < Netzke::Basepack::RecordFormWindow
|
2
|
+
def configure(c)
|
3
|
+
super c
|
4
|
+
c.fbar = [] if c.item_id == 'view_window'
|
5
|
+
end
|
6
|
+
|
7
|
+
component :view_form do |c|
|
8
|
+
preconfigure_form(c)
|
9
|
+
c.record_id = config.client_config[:record_id]
|
10
|
+
c.mode = :lockable
|
11
|
+
end
|
12
|
+
end
|
@@ -87,8 +87,11 @@ class Marty::DataGrid < Marty::Base
|
|
87
87
|
gen_mcfly_lookup :lookup, [:name], cache: true
|
88
88
|
gen_mcfly_lookup :get_all, [], mode: nil
|
89
89
|
|
90
|
-
|
91
|
-
|
90
|
+
# FIXME: if the caller requests data as part of fields, there could
|
91
|
+
# be memory concerns with caching since some data_grids have massive data
|
92
|
+
cached_delorean_fn :lookup_h, sig: [2, 3] do
|
93
|
+
|pt, name, fields = nil|
|
94
|
+
fields ||= %w(id group_id created_dt metadata data_type name)
|
92
95
|
dga = mcfly_pt(pt).where(name: name).pluck(*fields).first
|
93
96
|
dga && Hash[fields.zip(dga)]
|
94
97
|
end
|
@@ -124,14 +124,6 @@ class Marty::DeloreanRule < Marty::BaseRule
|
|
124
124
|
kl = ruleh["classname"].constantize
|
125
125
|
kl.compute(ruleh, metadata_opts, pt, params, grid_names_p)
|
126
126
|
end
|
127
|
-
delorean_fn :reporting_metadata, sig: 2 do
|
128
|
-
|ruleh, metadata_opts|
|
129
|
-
rmdkeys = metadata_opts.select{|_, v| v["reporting_metadata"]}.keys
|
130
|
-
rmdkeys.each_with_object({}) do |k, h|
|
131
|
-
fr = ruleh['fixed_results']
|
132
|
-
h[k] = fr[k] if fr.include?(k)
|
133
|
-
end
|
134
|
-
end
|
135
127
|
delorean_fn :route_compute_rs, sig: 3 do
|
136
128
|
|ruleh, pt, features|
|
137
129
|
kl = ruleh["classname"].constantize
|
data/app/models/marty/promise.rb
CHANGED
@@ -16,7 +16,21 @@ class Marty::Promise < Marty::Base
|
|
16
16
|
# default timeout (seconds) to wait for jobs to start
|
17
17
|
DEFAULT_JOB_TIMEOUT = Rails.configuration.marty.job_timeout || 10
|
18
18
|
|
19
|
-
|
19
|
+
SELECT_COLS = columns.map(&:name)-["result"]
|
20
|
+
default_scope {
|
21
|
+
select(*SELECT_COLS)
|
22
|
+
}
|
23
|
+
def result
|
24
|
+
unless has_attribute?(:result)
|
25
|
+
changes_before_reload = self.changes.clone
|
26
|
+
self.reload
|
27
|
+
changes_before_reload.each{
|
28
|
+
|attribute_name, values|
|
29
|
+
self.send("#{attribute_name}=", values[1])
|
30
|
+
}
|
31
|
+
end
|
32
|
+
read_attribute :result
|
33
|
+
end
|
20
34
|
|
21
35
|
serialize :result, MarshalResult.new
|
22
36
|
|
data/config/locales/en.yml
CHANGED
data/lib/marty.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
Ext.define('Netzke.Grid.EventHandlers', {
|
2
|
+
override: 'Netzke.Grid.EventHandlers',
|
3
|
+
netzkeHandleItemdblclick: function(view, record){
|
4
|
+
if (this.editsInline) return; // inline editing is handled elsewhere
|
5
|
+
|
6
|
+
var has_perm = (this.permissions || {});
|
7
|
+
if (has_perm.read !== false && !has_perm.update) {
|
8
|
+
this.doViewInForm(record);
|
9
|
+
}
|
10
|
+
else if (has_perm.update !== false) {
|
11
|
+
this.doEditInForm(record);
|
12
|
+
}
|
13
|
+
},
|
14
|
+
});
|
data/lib/marty/monkey.rb
CHANGED
@@ -119,7 +119,7 @@ module Netzke::Basepack::DataAdapters
|
|
119
119
|
relation = relation.includes(assoc.to_sym).references(assoc.to_sym) if method
|
120
120
|
end
|
121
121
|
|
122
|
-
@model.const_defined?(:
|
122
|
+
@model.const_defined?(:SELECT_COLS) ? relation.count(columns.first.name) :
|
123
123
|
relation.count
|
124
124
|
end
|
125
125
|
|
@@ -130,7 +130,7 @@ module Netzke::Basepack::DataAdapters
|
|
130
130
|
return nil if conditions.empty?
|
131
131
|
|
132
132
|
predicates = conditions.map do |q|
|
133
|
-
q = HashWithIndifferentAccess.new(q)
|
133
|
+
q = HashWithIndifferentAccess.new(Netzke::Support.permit_hash_params(q))
|
134
134
|
|
135
135
|
attr = q[:attr]
|
136
136
|
method, assoc = method_and_assoc(attr)
|
@@ -310,3 +310,29 @@ class OpenStruct
|
|
310
310
|
# super
|
311
311
|
#end
|
312
312
|
end
|
313
|
+
|
314
|
+
######################################################################
|
315
|
+
|
316
|
+
module Netzke
|
317
|
+
module Core
|
318
|
+
module DynamicAssets
|
319
|
+
class << self
|
320
|
+
def ext_js(form_authenticity_token)
|
321
|
+
res = initial_dynamic_javascript(form_authenticity_token) << "\n"
|
322
|
+
|
323
|
+
include_core_js(res)
|
324
|
+
|
325
|
+
# load javascript overrides
|
326
|
+
overrides = ["#{File.dirname(__FILE__)}/javascript/overrides.js"]
|
327
|
+
|
328
|
+
(Netzke::Core.ext_javascripts + overrides).each do |path|
|
329
|
+
f = File.new(path)
|
330
|
+
res << f.read
|
331
|
+
end
|
332
|
+
|
333
|
+
minify_js(res)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
data/lib/marty/version.rb
CHANGED
@@ -45,6 +45,12 @@ module Dummy
|
|
45
45
|
# Enable escaping HTML in JSON.
|
46
46
|
config.active_support.escape_html_entities_in_json = true
|
47
47
|
|
48
|
+
# eager load paths instead of autoload paths
|
49
|
+
config.eager_load_paths += ['lib', 'other'].map do
|
50
|
+
|dir|
|
51
|
+
File.expand_path("../../#{dir}", __FILE__)
|
52
|
+
end
|
53
|
+
|
48
54
|
# Use SQL instead of Active Record's schema dumper when creating the database.
|
49
55
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
50
56
|
# like if you have constraints or database-specific column types
|
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: 2.0.
|
4
|
+
version: 2.0.7
|
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: 2018-
|
17
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: pg
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- app/components/marty/posting_window.rb
|
203
203
|
- app/components/marty/promise_view.rb
|
204
204
|
- app/components/marty/promise_view/client/promise_view.css
|
205
|
+
- app/components/marty/record_form_window.rb
|
205
206
|
- app/components/marty/report_form.rb
|
206
207
|
- app/components/marty/report_select.rb
|
207
208
|
- app/components/marty/reporting.rb
|
@@ -470,8 +471,8 @@ files:
|
|
470
471
|
- lib/marty/data_exporter.rb
|
471
472
|
- lib/marty/data_importer.rb
|
472
473
|
- lib/marty/engine.rb
|
474
|
+
- lib/marty/javascript/overrides.js
|
473
475
|
- lib/marty/json_schema.rb
|
474
|
-
- lib/marty/lazy_column_loader.rb
|
475
476
|
- lib/marty/logger.rb
|
476
477
|
- lib/marty/mcfly_model.rb
|
477
478
|
- lib/marty/migrations.rb
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# ATTRIBUTION NOTE: This module has been mostly copied from the
|
2
|
-
# lazy_columns gem. The original code can be found at:
|
3
|
-
# https://github.com/jorgemanrubia/lazy_columns
|
4
|
-
|
5
|
-
module Marty
|
6
|
-
module LazyColumnLoader
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
def lazy_load(*columns)
|
11
|
-
return unless table_exists?
|
12
|
-
columns = columns.collect(&:to_s)
|
13
|
-
exclude_columns_from_default_scope columns
|
14
|
-
define_lazy_accessors_for columns
|
15
|
-
|
16
|
-
# allow introspection of lazy-loaded column list
|
17
|
-
const_set(:LAZY_LOADED, columns)
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
def exclude_columns_from_default_scope(columns)
|
22
|
-
default_scope {
|
23
|
-
select((column_names - columns).map {
|
24
|
-
|column_name|
|
25
|
-
"#{table_name}.#{column_name}"
|
26
|
-
})
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def define_lazy_accessors_for(columns)
|
31
|
-
columns.each { |column| define_lazy_accessor_for column }
|
32
|
-
end
|
33
|
-
|
34
|
-
def define_lazy_accessor_for(column)
|
35
|
-
define_method column do
|
36
|
-
unless has_attribute?(column)
|
37
|
-
changes_before_reload = self.changes.clone
|
38
|
-
self.reload
|
39
|
-
changes_before_reload.each{
|
40
|
-
|attribute_name, values|
|
41
|
-
self.send("#{attribute_name}=", values[1])
|
42
|
-
}
|
43
|
-
end
|
44
|
-
read_attribute column
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
if ActiveRecord::Base.respond_to?(:lazy_load)
|
52
|
-
$stderr.puts "ERROR: Method `.lazy_load` already defined in " +
|
53
|
-
"`ActiveRecord::Base`. This is incompatible with LazyColumnLoader " +
|
54
|
-
"and the module will be disabled."
|
55
|
-
else
|
56
|
-
ActiveRecord::Base.send :include, Marty::LazyColumnLoader
|
57
|
-
end
|