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.
- checksums.yaml +5 -5
- data/.gitignore +4 -0
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +11 -589
- data/Gemfile +9 -9
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -3
- data/app/components/marty/api_auth_view.rb +3 -3
- data/app/components/marty/api_config_view.rb +8 -8
- data/app/components/marty/api_log_view.rb +16 -20
- data/app/components/marty/auth_app.rb +6 -6
- data/app/components/marty/base_rule_view.rb +27 -19
- data/app/components/marty/config_view.rb +12 -9
- data/app/components/marty/data_grid_view.rb +26 -26
- data/app/components/marty/delorean_rule_view.rb +0 -1
- data/app/components/marty/event_view.rb +27 -27
- data/app/components/marty/extras/layout.rb +26 -26
- data/app/components/marty/extras/misc.rb +2 -2
- data/app/components/marty/grid.rb +13 -13
- data/app/components/marty/grid_append_only.rb +0 -1
- data/app/components/marty/import_type_view.rb +13 -13
- data/app/components/marty/import_view.rb +17 -16
- data/app/components/marty/log_view.rb +16 -14
- data/app/components/marty/main_auth_app.rb +59 -59
- data/app/components/marty/main_auth_app/client/main_auth_app.js +3 -3
- data/app/components/marty/mcfly_grid_panel.rb +10 -10
- data/app/components/marty/new_posting_form.rb +11 -11
- data/app/components/marty/new_posting_window.rb +0 -1
- data/app/components/marty/posting_grid.rb +12 -13
- data/app/components/marty/promise_view.rb +6 -6
- data/app/components/marty/report_form.rb +50 -53
- data/app/components/marty/report_select.rb +27 -27
- data/app/components/marty/reporting.rb +4 -4
- data/app/components/marty/script_form.rb +40 -42
- data/app/components/marty/script_grid.rb +24 -24
- data/app/components/marty/script_tester.rb +40 -42
- data/app/components/marty/scripting.rb +25 -27
- data/app/components/marty/simple_app.rb +24 -9
- data/app/components/marty/tag_grid.rb +12 -13
- data/app/components/marty/user_view.rb +35 -35
- data/app/controllers/marty/application_controller.rb +3 -4
- data/app/controllers/marty/components_controller.rb +1 -1
- data/app/controllers/marty/delayed_job_controller.rb +1 -0
- data/app/controllers/marty/diagnostic/controller.rb +4 -6
- data/app/controllers/marty/job_controller.rb +6 -6
- data/app/controllers/marty/report_controller.rb +11 -11
- data/app/controllers/marty/rpc_controller.rb +15 -16
- data/app/helpers/marty/script_set.rb +4 -4
- data/app/models/marty/api_auth.rb +4 -5
- data/app/models/marty/api_config.rb +1 -1
- data/app/models/marty/base.rb +9 -8
- data/app/models/marty/base_rule.rb +18 -13
- data/app/models/marty/config.rb +4 -5
- data/app/models/marty/data_grid.rb +157 -181
- data/app/models/marty/delorean_rule.rb +63 -62
- data/app/models/marty/enum.rb +1 -1
- data/app/models/marty/event.rb +56 -59
- data/app/models/marty/helper.rb +38 -6
- data/app/models/marty/import_type.rb +6 -6
- data/app/models/marty/log.rb +3 -2
- data/app/models/marty/name_validator.rb +3 -2
- data/app/models/marty/pg_enum.rb +3 -4
- data/app/models/marty/posting.rb +20 -24
- data/app/models/marty/promise.rb +28 -30
- data/app/models/marty/script.rb +30 -28
- data/app/models/marty/tag.rb +8 -8
- data/app/models/marty/token.rb +2 -2
- data/app/models/marty/user.rb +24 -23
- data/app/models/marty/vw_promise.rb +10 -11
- data/config/routes.rb +2 -2
- data/delorean/blame_report.dl +268 -0
- data/{spec/dummy/delorean/fields.dl → delorean/marty_fields.dl} +8 -0
- data/delorean/table_report.dl +34 -0
- data/docker-compose.dummy.yml +2 -3
- data/lib/marty/aws/base.rb +8 -8
- data/lib/marty/aws/request.rb +4 -4
- data/lib/marty/cache_adapters/mcfly_ruby_cache.rb +1 -0
- data/lib/marty/content_handler.rb +25 -25
- data/lib/marty/data_change.rb +49 -71
- data/lib/marty/data_conversion.rb +20 -28
- data/lib/marty/data_exporter.rb +25 -28
- data/lib/marty/data_importer.rb +25 -27
- data/lib/marty/engine.rb +1 -2
- data/lib/marty/json_schema.rb +22 -24
- data/lib/marty/logger.rb +6 -9
- data/lib/marty/mcfly_model.rb +20 -24
- data/lib/marty/migrations.rb +37 -35
- data/lib/marty/monkey.rb +33 -33
- data/lib/marty/permissions.rb +18 -18
- data/lib/marty/promise_job.rb +17 -17
- data/lib/marty/promise_proxy.rb +6 -6
- data/lib/marty/relation.rb +6 -7
- data/lib/marty/rpc_call.rb +13 -12
- data/lib/marty/rule_script_set.rb +32 -28
- data/lib/marty/schema_helper.rb +37 -51
- data/lib/marty/util.rb +25 -24
- data/lib/marty/version.rb +1 -1
- data/lib/marty/xl.rb +121 -115
- data/make-dummy.mk +3 -0
- data/marty.gemspec +21 -21
- data/other/marty/api/base.rb +34 -35
- data/other/marty/diagnostic/aws/ec2_instance.rb +8 -8
- data/other/marty/diagnostic/base.rb +13 -14
- data/other/marty/diagnostic/collection.rb +2 -1
- data/other/marty/diagnostic/connections.rb +8 -6
- data/other/marty/diagnostic/database.rb +1 -0
- data/other/marty/diagnostic/delayed_job_version.rb +7 -9
- data/other/marty/diagnostic/delayed_job_worker_total_count.rb +1 -1
- data/other/marty/diagnostic/delayed_job_workers.rb +1 -1
- data/other/marty/diagnostic/environment_variables.rb +17 -15
- data/other/marty/diagnostic/fatal.rb +1 -1
- data/other/marty/diagnostic/node.rb +5 -9
- data/other/marty/diagnostic/nodes.rb +7 -5
- data/other/marty/diagnostic/packer.rb +7 -7
- data/other/marty/diagnostic/reporter.rb +24 -27
- data/other/marty/diagnostic/version.rb +3 -5
- data/script/rails +2 -1
- data/spec/controllers/application_controller_spec.rb +6 -6
- data/spec/controllers/delayed_job_controller_spec.rb +4 -4
- data/spec/controllers/diagnostic/controller_spec.rb +59 -60
- data/spec/controllers/job_controller_spec.rb +68 -69
- data/spec/controllers/rpc_controller_spec.rb +353 -359
- data/spec/controllers/rpc_import_spec.rb +15 -16
- data/spec/dummy/delorean/blame_report.dl +110 -15
- data/spec/dummy/delorean/data_report.dl +4 -4
- data/spec/dummy/delorean/marty_fields.dl +63 -0
- data/spec/dummy/delorean/table_report.dl +34 -0
- data/spec/features/auth_app_spec.rb +1 -2
- data/spec/features/data_import_spec.rb +2 -3
- data/spec/features/enum_spec.rb +42 -46
- data/spec/features/jobs_dashboard_spec.rb +14 -8
- data/spec/features/log_view_spec.rb +40 -43
- data/spec/features/reporting_spec.rb +15 -15
- data/spec/features/rule_spec.rb +195 -190
- data/spec/features/scripting_spec.rb +17 -20
- data/spec/features/scripting_test_spec.rb +32 -33
- data/spec/features/user_view_spec.rb +15 -17
- data/spec/job_helper.rb +11 -11
- data/spec/lib/data_blame_spec.rb +82 -0
- data/spec/lib/data_exporter_spec.rb +31 -32
- data/spec/lib/data_importer_spec.rb +382 -395
- data/spec/lib/delorean_query_spec.rb +117 -119
- data/spec/lib/json_schema_spec.rb +382 -392
- data/spec/lib/logger_spec.rb +23 -24
- data/spec/lib/mcfly_model_spec.rb +112 -109
- data/spec/lib/migrations_spec.rb +10 -10
- data/spec/lib/struct_compare_spec.rb +6 -6
- data/spec/lib/table_report_spec.rb +90 -0
- data/spec/lib/xl_spec.rb +63 -65
- data/spec/lib/xl_styles_spec.rb +16 -19
- data/spec/models/api_auth_spec.rb +30 -30
- data/spec/models/config_spec.rb +32 -32
- data/spec/models/data_grid_spec.rb +642 -655
- data/spec/models/event_spec.rb +96 -88
- data/spec/models/import_type_spec.rb +20 -20
- data/spec/models/posting_spec.rb +35 -35
- data/spec/models/promise_spec.rb +5 -5
- data/spec/models/rule_spec.rb +280 -269
- data/spec/models/script_spec.rb +27 -18
- data/spec/models/user_spec.rb +9 -9
- data/spec/other/diagnostic/base_spec.rb +20 -19
- data/spec/other/diagnostic/collection_spec.rb +6 -5
- data/spec/other/diagnostic/delayed_job_version_spec.rb +1 -1
- data/spec/other/diagnostic/delayed_job_workers_spec.rb +8 -8
- data/spec/other/diagnostic/reporter_spec.rb +31 -33
- data/spec/spec_helper.rb +5 -5
- data/spec/support/chromedriver.rb +3 -5
- data/spec/support/components/netzke_combobox.rb +1 -1
- data/spec/support/components/netzke_grid.rb +17 -17
- data/spec/support/custom_matchers.rb +2 -2
- data/spec/support/download_helper.rb +1 -1
- data/spec/support/helper.rb +1 -2
- data/spec/support/netzke.rb +31 -31
- data/spec/support/performance_helper.rb +8 -8
- data/spec/support/post_run_logger.rb +1 -2
- data/spec/support/setup.rb +1 -4
- data/spec/support/shared_connection.rb +2 -2
- data/spec/support/structure_compare.rb +21 -22
- data/spec/support/suite.rb +1 -2
- data/spec/support/users.rb +5 -6
- metadata +32 -26
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
class Marty::ImportTypeView < Marty::Grid
|
|
2
2
|
has_marty_permissions \
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
create: :admin,
|
|
4
|
+
read: :any,
|
|
5
|
+
update: :admin,
|
|
6
|
+
delete: :admin
|
|
7
7
|
|
|
8
8
|
def configure(c)
|
|
9
9
|
super
|
|
10
10
|
|
|
11
|
-
c.title = I18n.t('import_type', default:
|
|
12
|
-
c.model =
|
|
11
|
+
c.title = I18n.t('import_type', default: 'ImportType')
|
|
12
|
+
c.model = 'Marty::ImportType'
|
|
13
13
|
c.attributes =
|
|
14
14
|
[
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
:name,
|
|
16
|
+
:role__name,
|
|
17
|
+
:db_model_name,
|
|
18
|
+
:cleaner_function,
|
|
19
|
+
:validation_function,
|
|
20
|
+
:preprocess_function,
|
|
21
21
|
]
|
|
22
|
-
c.store_config.merge!(
|
|
22
|
+
c.store_config.merge!(sorters: [{ property: :name, direction: 'ASC' }])
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
attribute :name do |c|
|
|
@@ -2,13 +2,15 @@ class Marty::ImportView < Marty::Form
|
|
|
2
2
|
include Marty::Extras::Layout
|
|
3
3
|
|
|
4
4
|
action :apply do |a|
|
|
5
|
-
a.text = I18n.t(
|
|
6
|
-
a.tooltip = I18n.t(
|
|
5
|
+
a.text = I18n.t('data_import_view.import')
|
|
6
|
+
a.tooltip = I18n.t('data_import_view.import')
|
|
7
7
|
a.icon_cls = 'fa fa-database glyph'
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def parent_model; end
|
|
11
|
+
|
|
11
12
|
def import_model; end
|
|
13
|
+
|
|
12
14
|
def model_view; end
|
|
13
15
|
|
|
14
16
|
def initialize args, kwargs
|
|
@@ -26,7 +28,7 @@ class Marty::ImportView < Marty::Form
|
|
|
26
28
|
######################################################################
|
|
27
29
|
|
|
28
30
|
def validate
|
|
29
|
-
return client.netzke_notify(
|
|
31
|
+
return client.netzke_notify('Must provide import data.') if
|
|
30
32
|
@import_data.empty?
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -58,16 +60,16 @@ class Marty::ImportView < Marty::Form
|
|
|
58
60
|
end
|
|
59
61
|
|
|
60
62
|
endpoint :submit do |params|
|
|
61
|
-
return client.netzke_notify
|
|
63
|
+
return client.netzke_notify 'No Model View defined' unless @model_view
|
|
62
64
|
|
|
63
|
-
return client.netzke_notify
|
|
65
|
+
return client.netzke_notify 'Permission denied' unless
|
|
64
66
|
@model_view.can_perform_action?(:update)
|
|
65
67
|
|
|
66
68
|
return client.netzke_notify "Can't import when time-warped" if
|
|
67
69
|
Marty::Util.warped?
|
|
68
70
|
|
|
69
71
|
@data = ActiveSupport::JSON.decode(params[:data])
|
|
70
|
-
@import_data = @data[
|
|
72
|
+
@import_data = @data['import_data'] || ''
|
|
71
73
|
@record = @parent_model.try(:find_by_id, client_config['parent_id'])
|
|
72
74
|
|
|
73
75
|
validate and return
|
|
@@ -76,21 +78,20 @@ class Marty::ImportView < Marty::Form
|
|
|
76
78
|
begin
|
|
77
79
|
processed = process_import_data
|
|
78
80
|
res = import(processed)
|
|
79
|
-
result = res.map{|k,v| format_message(k,v)}
|
|
81
|
+
result = res.map { |k, v| format_message(k, v) }
|
|
80
82
|
|
|
81
83
|
messages = post_import
|
|
82
84
|
result << messages if messages
|
|
83
85
|
|
|
84
|
-
client.set_result result.join(
|
|
85
|
-
|
|
86
|
+
client.set_result result.join('<br/>')
|
|
86
87
|
rescue Marty::DataImporter::Error => exc
|
|
87
88
|
result = [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
"Import failed on line(s): #{exc.lines.join(', ')}",
|
|
90
|
+
"Error: #{exc.to_s}",
|
|
91
|
+
]
|
|
91
92
|
|
|
92
|
-
client.set_result '<font color="red">' + result.join(
|
|
93
|
-
rescue => e
|
|
93
|
+
client.set_result '<font color="red">' + result.join('<br/>') + '</font>'
|
|
94
|
+
rescue StandardError => e
|
|
94
95
|
client.set_result e.message
|
|
95
96
|
end
|
|
96
97
|
end
|
|
@@ -111,8 +112,8 @@ class Marty::ImportView < Marty::Form
|
|
|
111
112
|
|
|
112
113
|
component :result do |c|
|
|
113
114
|
c.klass = Marty::Panel
|
|
114
|
-
c.title = I18n.t(
|
|
115
|
-
c.html =
|
|
115
|
+
c.title = I18n.t('data_import_view.results')
|
|
116
|
+
c.html = ''
|
|
116
117
|
c.flex = 1
|
|
117
118
|
c.min_height = 150
|
|
118
119
|
c.scrollable = true
|
|
@@ -6,8 +6,8 @@ class Marty::LogView < Marty::Grid
|
|
|
6
6
|
def configure(c)
|
|
7
7
|
super
|
|
8
8
|
|
|
9
|
-
c.title ||= I18n.t('log_viewer', default:
|
|
10
|
-
c.model =
|
|
9
|
+
c.title ||= I18n.t('log_viewer', default: 'Log Viewer')
|
|
10
|
+
c.model = 'Marty::Log'
|
|
11
11
|
c.paging = :pagination
|
|
12
12
|
c.editing = :in_form
|
|
13
13
|
c.attributes = [
|
|
@@ -17,7 +17,7 @@ class Marty::LogView < Marty::Grid
|
|
|
17
17
|
:details
|
|
18
18
|
]
|
|
19
19
|
|
|
20
|
-
c.store_config.merge!(sorters: [{property: :timestamp, direction: 'DESC'}])
|
|
20
|
+
c.store_config.merge!(sorters: [{ property: :timestamp, direction: 'DESC' }])
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def default_context_menu
|
|
@@ -29,7 +29,7 @@ class Marty::LogView < Marty::Grid
|
|
|
29
29
|
:timestamp_custom,
|
|
30
30
|
:message_type,
|
|
31
31
|
:message,
|
|
32
|
-
textarea_field(:details).merge!(
|
|
32
|
+
textarea_field(:details).merge!(height: 400)
|
|
33
33
|
]
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -39,13 +39,13 @@ class Marty::LogView < Marty::Grid
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
attribute :message_type do |c|
|
|
42
|
-
c.text = I18n.t(
|
|
42
|
+
c.text = I18n.t('log_grid.message_type')
|
|
43
43
|
c.width = 100
|
|
44
44
|
c.read_only = true
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
attribute :message do |c|
|
|
48
|
-
c.text = I18n.t(
|
|
48
|
+
c.text = I18n.t('log_grid.message')
|
|
49
49
|
c.width = 400
|
|
50
50
|
c.read_only = true
|
|
51
51
|
end
|
|
@@ -54,7 +54,7 @@ class Marty::LogView < Marty::Grid
|
|
|
54
54
|
# UI does not interact well with AR/PG and doesn't display fractional s
|
|
55
55
|
# This work around requires explicit sorting/filtering
|
|
56
56
|
attribute :timestamp_custom do |c|
|
|
57
|
-
c.text = I18n.t(
|
|
57
|
+
c.text = I18n.t('log_grid.timestamp')
|
|
58
58
|
c.width = 200
|
|
59
59
|
c.read_only = true
|
|
60
60
|
c.filterable = true
|
|
@@ -64,26 +64,28 @@ class Marty::LogView < Marty::Grid
|
|
|
64
64
|
xtype: :displayfield,
|
|
65
65
|
}
|
|
66
66
|
c.getter = lambda { |r| Time.at(r.timestamp) }
|
|
67
|
-
c.sorting_scope = lambda {|r, dir| r.order(
|
|
67
|
+
c.sorting_scope = lambda { |r, dir| r.order('timestamp ' + dir.to_s) }
|
|
68
68
|
|
|
69
69
|
# FIXME?: The UI AR/PG DateTime workaround requires the timestamp to be cast
|
|
70
70
|
# to text in order to compare filter input using the LIKE operator.
|
|
71
71
|
# Otherwise it will fail. '<' and '>' functionality is missing.
|
|
72
|
-
c.filter_with = lambda {|r, v, op|
|
|
73
|
-
r.where("timestamp::text #{op} '#{v}%'")
|
|
72
|
+
c.filter_with = lambda { |r, v, op|
|
|
73
|
+
r.where("timestamp::text #{op} '#{v}%'")
|
|
74
|
+
}
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
column :details do |c|
|
|
77
78
|
c.getter = lambda { |r| CGI.escapeHTML(r.details.pretty_inspect) }
|
|
78
|
-
c.filter_with = lambda {|r, v, op|
|
|
79
|
-
r.where("details::text #{op} '%#{v}%'")
|
|
79
|
+
c.filter_with = lambda { |r, v, op|
|
|
80
|
+
r.where("details::text #{op} '%#{v}%'")
|
|
81
|
+
}
|
|
80
82
|
end
|
|
81
83
|
|
|
82
84
|
attribute :details do |c|
|
|
83
|
-
c.text = I18n.t(
|
|
85
|
+
c.text = I18n.t('log_grid.details')
|
|
84
86
|
c.width = 900
|
|
85
87
|
c.read_only = true
|
|
86
|
-
c.getter = lambda { |r| r.details.pretty_inspect}
|
|
88
|
+
c.getter = lambda { |r| r.details.pretty_inspect }
|
|
87
89
|
end
|
|
88
90
|
end
|
|
89
91
|
|
|
@@ -26,16 +26,16 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def self.has_scripting_perm?
|
|
29
|
-
|
|
29
|
+
has_admin_perm?
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def posting_menu
|
|
33
33
|
{
|
|
34
|
-
text: warped ?
|
|
35
|
-
name:
|
|
36
|
-
tooltip:
|
|
37
|
-
icon_cls:
|
|
38
|
-
style: (warped ?
|
|
34
|
+
text: warped ? Marty::Util.get_posting.name.to_s : I18n.t('postings'),
|
|
35
|
+
name: 'posting',
|
|
36
|
+
tooltip: 'Postings',
|
|
37
|
+
icon_cls: 'fa fa-clock glyph',
|
|
38
|
+
style: (warped ? 'background-color: lightGrey;' : ''),
|
|
39
39
|
menu: [
|
|
40
40
|
:new_posting,
|
|
41
41
|
:select_posting,
|
|
@@ -48,7 +48,7 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
48
48
|
[
|
|
49
49
|
{
|
|
50
50
|
text: 'Log Maintenance',
|
|
51
|
-
icon_cls:
|
|
51
|
+
icon_cls: 'fa fa-wrench glyph',
|
|
52
52
|
disabled: !self.class.has_admin_perm?,
|
|
53
53
|
menu: [
|
|
54
54
|
:log_view,
|
|
@@ -62,7 +62,7 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
62
62
|
[
|
|
63
63
|
{
|
|
64
64
|
text: 'API Management',
|
|
65
|
-
icon_cls:
|
|
65
|
+
icon_cls: 'fa fa-fighter-jet glyph',
|
|
66
66
|
disabled: !self.class.has_admin_perm?,
|
|
67
67
|
menu: [
|
|
68
68
|
:api_auth_view,
|
|
@@ -75,9 +75,9 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
75
75
|
|
|
76
76
|
def system_menu
|
|
77
77
|
{
|
|
78
|
-
text: I18n.t(
|
|
79
|
-
icon_cls:
|
|
80
|
-
style:
|
|
78
|
+
text: I18n.t('system'),
|
|
79
|
+
icon_cls: 'fa fa-wrench glyph',
|
|
80
|
+
style: '',
|
|
81
81
|
menu: [
|
|
82
82
|
:import_type_view,
|
|
83
83
|
:user_view,
|
|
@@ -91,8 +91,8 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
91
91
|
|
|
92
92
|
def applications_menu
|
|
93
93
|
{
|
|
94
|
-
text: I18n.t(
|
|
95
|
-
icon_cls:
|
|
94
|
+
text: I18n.t('applications'),
|
|
95
|
+
icon_cls: 'fa fa-window-restore glyph',
|
|
96
96
|
menu: [
|
|
97
97
|
:data_grid_view,
|
|
98
98
|
:reporting,
|
|
@@ -106,7 +106,7 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
106
106
|
[
|
|
107
107
|
{
|
|
108
108
|
text: 'Background Jobs',
|
|
109
|
-
icon_cls:
|
|
109
|
+
icon_cls: 'fa fa-user-clock glyph',
|
|
110
110
|
disabled: !self.class.has_admin_perm?,
|
|
111
111
|
menu: [
|
|
112
112
|
:bg_status,
|
|
@@ -153,60 +153,60 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
153
153
|
self.class.has_user_manager_perm? ? [system_menu, sep] : []) +
|
|
154
154
|
data_menus +
|
|
155
155
|
[
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
applications_menu, sep,
|
|
157
|
+
posting_menu, sep,
|
|
158
158
|
] + super
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
######################################################################
|
|
162
162
|
|
|
163
163
|
action :import_type_view do |a|
|
|
164
|
-
a.text = I18n.t(
|
|
164
|
+
a.text = I18n.t('import_type')
|
|
165
165
|
a.handler = :netzke_load_component_by_action
|
|
166
166
|
a.disabled = !self.class.has_admin_perm?
|
|
167
|
-
a.icon_cls
|
|
167
|
+
a.icon_cls = 'fa fa-file-import glyph'
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
action :scripting do |a|
|
|
171
|
-
a.text = I18n.t(
|
|
171
|
+
a.text = I18n.t('scripting')
|
|
172
172
|
a.handler = :netzke_load_component_by_action
|
|
173
|
-
a.icon_cls
|
|
173
|
+
a.icon_cls = 'fa fa-code glyph'
|
|
174
174
|
a.disabled = !self.class.has_any_perm?
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
action :reporting do |a|
|
|
178
|
-
a.text = I18n.t(
|
|
178
|
+
a.text = I18n.t('reports')
|
|
179
179
|
a.handler = :netzke_load_component_by_action
|
|
180
|
-
a.icon_cls
|
|
180
|
+
a.icon_cls = 'fa fa-file-alt glyph'
|
|
181
181
|
a.disabled = !self.class.has_any_perm?
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
action :promise_view do |a|
|
|
185
|
-
a.text = I18n.t(
|
|
185
|
+
a.text = I18n.t('jobs.promise_view')
|
|
186
186
|
a.handler = :netzke_load_component_by_action
|
|
187
|
-
a.icon_cls
|
|
187
|
+
a.icon_cls = 'fa fa-search glyph'
|
|
188
188
|
a.disabled = !self.class.has_any_perm?
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
action :user_view do |a|
|
|
192
|
-
a.text = I18n.t(
|
|
192
|
+
a.text = I18n.t('user_view')
|
|
193
193
|
a.handler = :netzke_load_component_by_action
|
|
194
|
-
a.icon_cls
|
|
194
|
+
a.icon_cls = 'fa fa-users glyph'
|
|
195
195
|
a.disabled = !self.class.has_admin_perm? &&
|
|
196
196
|
!self.class.has_user_manager_perm?
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
action :event_view do |a|
|
|
200
|
-
a.text = I18n.t(
|
|
200
|
+
a.text = I18n.t('event_view')
|
|
201
201
|
a.handler = :netzke_load_component_by_action
|
|
202
|
-
a.icon_cls
|
|
202
|
+
a.icon_cls = 'fa fa-bolt glyph'
|
|
203
203
|
a.disabled = !self.class.has_admin_perm?
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
action :config_view do |a|
|
|
207
|
-
a.text = I18n.t(
|
|
207
|
+
a.text = I18n.t('config_view')
|
|
208
208
|
a.handler = :netzke_load_component_by_action
|
|
209
|
-
a.icon_cls
|
|
209
|
+
a.icon_cls = 'fa fa-cog glyph'
|
|
210
210
|
a.disabled = !self.class.has_admin_perm? &&
|
|
211
211
|
!self.class.has_user_manager_perm?
|
|
212
212
|
end
|
|
@@ -214,15 +214,15 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
214
214
|
action :api_auth_view do |a|
|
|
215
215
|
a.text = 'API Auth Management'
|
|
216
216
|
a.handler = :netzke_load_component_by_action
|
|
217
|
-
a.icon_cls
|
|
218
|
-
a.disabled
|
|
217
|
+
a.icon_cls = 'fa fa-key glyph'
|
|
218
|
+
a.disabled = !self.class.has_admin_perm?
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
action :api_config_view do |a|
|
|
222
222
|
a.text = 'API Config Management'
|
|
223
223
|
a.tooltip = 'Manage API behavior and settings'
|
|
224
224
|
a.handler = :netzke_load_component_by_action
|
|
225
|
-
a.icon_cls =
|
|
225
|
+
a.icon_cls = 'fa fa-sliders-h glyph'
|
|
226
226
|
a.disabled = !self.class.has_admin_perm?
|
|
227
227
|
end
|
|
228
228
|
|
|
@@ -230,49 +230,49 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
230
230
|
a.text = 'API Log View'
|
|
231
231
|
a.tooltip = 'View API logs'
|
|
232
232
|
a.handler = :netzke_load_component_by_action
|
|
233
|
-
a.icon_cls =
|
|
233
|
+
a.icon_cls = 'fa fa-pencil-alt glyph'
|
|
234
234
|
a.disabled = !self.class.has_admin_perm?
|
|
235
235
|
end
|
|
236
236
|
|
|
237
237
|
action :data_grid_view do |a|
|
|
238
|
-
a.text = I18n.t(
|
|
238
|
+
a.text = I18n.t('data_grid_view', default: 'Data Grids')
|
|
239
239
|
a.handler = :netzke_load_component_by_action
|
|
240
|
-
a.icon_cls
|
|
241
|
-
a.disabled
|
|
240
|
+
a.icon_cls = 'fa fa-table glyph'
|
|
241
|
+
a.disabled = !self.class.has_any_perm?
|
|
242
242
|
end
|
|
243
243
|
|
|
244
244
|
action :reload_scripts do |a|
|
|
245
245
|
a.text = 'Reload Scripts'
|
|
246
246
|
a.tooltip = 'Reload and tag Delorean scripts'
|
|
247
|
-
a.icon_cls
|
|
247
|
+
a.icon_cls = 'fa fa-sync-alt glyph'
|
|
248
248
|
a.disabled = !self.class.has_admin_perm?
|
|
249
249
|
end
|
|
250
250
|
|
|
251
251
|
action :load_seed do |a|
|
|
252
252
|
a.text = 'Load Seeds'
|
|
253
253
|
a.tooltip = 'Load Seeds'
|
|
254
|
-
a.icon_cls
|
|
254
|
+
a.icon_cls = 'fa fa-retweet glyph'
|
|
255
255
|
a.disabled = !self.class.has_admin_perm?
|
|
256
256
|
end
|
|
257
257
|
|
|
258
258
|
action :bg_status do |a|
|
|
259
259
|
a.text = 'Show Delayed Jobs Status'
|
|
260
260
|
a.tooltip = 'Run delayed_job status script'
|
|
261
|
-
a.icon_cls
|
|
261
|
+
a.icon_cls = 'fa fa-desktop glyph'
|
|
262
262
|
a.disabled = !self.class.has_admin_perm?
|
|
263
263
|
end
|
|
264
264
|
|
|
265
265
|
action :bg_stop do |a|
|
|
266
266
|
a.text = 'Stop Delayed Jobs'
|
|
267
267
|
a.tooltip = 'Run delayed_job stop script'
|
|
268
|
-
a.icon_cls
|
|
268
|
+
a.icon_cls = 'fa fa-skull glyph'
|
|
269
269
|
a.disabled = !self.class.has_admin_perm?
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
action :bg_restart do |a|
|
|
273
273
|
a.text = 'Restart Delayed Jobs'
|
|
274
274
|
a.tooltip = 'Run delayed_job restart script using DELAYED_JOB_PARAMS'
|
|
275
|
-
a.icon_cls
|
|
275
|
+
a.icon_cls = 'fa fa-power-off glyph'
|
|
276
276
|
a.disabled = !self.class.has_admin_perm?
|
|
277
277
|
end
|
|
278
278
|
|
|
@@ -280,22 +280,22 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
280
280
|
a.text = 'View Log'
|
|
281
281
|
a.tooltip = 'View Log'
|
|
282
282
|
a.handler = :netzke_load_component_by_action
|
|
283
|
-
a.icon_cls
|
|
283
|
+
a.icon_cls = 'fa fa-cog glyph'
|
|
284
284
|
a.disabled = !self.class.has_admin_perm?
|
|
285
285
|
end
|
|
286
286
|
|
|
287
287
|
action :log_cleanup do |a|
|
|
288
288
|
a.text = 'Cleanup Log Table'
|
|
289
289
|
a.tooltip = 'Delete old log records'
|
|
290
|
-
a.icon_cls
|
|
290
|
+
a.icon_cls = 'fa fa-cog glyph'
|
|
291
291
|
a.disabled = !self.class.has_admin_perm?
|
|
292
292
|
end
|
|
293
293
|
|
|
294
294
|
######################################################################
|
|
295
295
|
|
|
296
296
|
def bg_command(param)
|
|
297
|
-
e, root, p = ENV['RAILS_ENV'], Rails.root, Marty::Config[
|
|
298
|
-
dj_path = Marty::Config[
|
|
297
|
+
e, root, p = ENV['RAILS_ENV'], Rails.root, Marty::Config['RUBY_PATH']
|
|
298
|
+
dj_path = Marty::Config['DELAYED_JOB_PATH'] || 'bin/delayed_job'
|
|
299
299
|
cmd = "export RAILS_ENV=#{e};"
|
|
300
300
|
# FIXME: Environment looks to be setup incorrectly - this is a hack
|
|
301
301
|
cmd += "export PATH=#{p}:$PATH;" if p
|
|
@@ -307,29 +307,29 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
307
307
|
endpoint :bg_status do |params|
|
|
308
308
|
cmd = bg_command('status')
|
|
309
309
|
res = `#{cmd}`
|
|
310
|
-
client.show_detail res.html_safe.gsub("\n",
|
|
310
|
+
client.show_detail res.html_safe.gsub("\n", '<br/>'), 'Delayed Job Status'
|
|
311
311
|
end
|
|
312
312
|
|
|
313
313
|
endpoint :bg_stop do |params|
|
|
314
|
-
cmd = bg_command(
|
|
314
|
+
cmd = bg_command('stop')
|
|
315
315
|
res = `#{cmd}`
|
|
316
|
-
res =
|
|
317
|
-
client.show_detail res.html_safe.gsub("\n",
|
|
316
|
+
res = 'delayed_job: no instances running. Nothing to stop.' if res.empty?
|
|
317
|
+
client.show_detail res.html_safe.gsub("\n", '<br/>'), 'Delayed Job Stop'
|
|
318
318
|
end
|
|
319
319
|
|
|
320
320
|
endpoint :bg_restart do |params|
|
|
321
|
-
params = Marty::Config[
|
|
321
|
+
params = Marty::Config['DELAYED_JOB_PARAMS'] || ''
|
|
322
322
|
cmd = bg_command("restart #{params}")
|
|
323
323
|
res = `#{cmd}`
|
|
324
|
-
client.show_detail res.html_safe.gsub("\n",
|
|
324
|
+
client.show_detail res.html_safe.gsub("\n", '<br/>'), 'Delayed Job Restart'
|
|
325
325
|
end
|
|
326
326
|
|
|
327
327
|
endpoint :log_cleanup do |params|
|
|
328
328
|
begin
|
|
329
329
|
Marty::Log.cleanup(params)
|
|
330
|
-
rescue => e
|
|
330
|
+
rescue StandardError => e
|
|
331
331
|
res = e.message
|
|
332
|
-
client.show_detail res.html_safe.gsub("\n",
|
|
332
|
+
client.show_detail res.html_safe.gsub("\n", '<br/>'), 'Log Cleanup'
|
|
333
333
|
end
|
|
334
334
|
end
|
|
335
335
|
|
|
@@ -339,14 +339,14 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
339
339
|
action :new_posting do |a|
|
|
340
340
|
a.text = I18n.t('new_posting')
|
|
341
341
|
a.tooltip = I18n.t('new_posting')
|
|
342
|
-
a.icon_cls
|
|
342
|
+
a.icon_cls = 'fa fa-plus glyph'
|
|
343
343
|
a.disabled = Marty::Util.warped? || !self.class.has_posting_perm?
|
|
344
344
|
end
|
|
345
345
|
|
|
346
346
|
action :select_posting do |a|
|
|
347
347
|
a.text = I18n.t('select_posting')
|
|
348
348
|
a.tooltip = I18n.t('select_posting')
|
|
349
|
-
a.icon_cls
|
|
349
|
+
a.icon_cls = 'fa fa-history glyph'
|
|
350
350
|
end
|
|
351
351
|
|
|
352
352
|
endpoint :select_posting do |params|
|
|
@@ -359,9 +359,9 @@ class Marty::MainAuthApp < Marty::AuthApp
|
|
|
359
359
|
end
|
|
360
360
|
|
|
361
361
|
action :select_now do |a|
|
|
362
|
-
a.text
|
|
363
|
-
a.icon_cls
|
|
364
|
-
a.disabled
|
|
362
|
+
a.text = I18n.t('go_to_now')
|
|
363
|
+
a.icon_cls = 'fa fa-globe glyph'
|
|
364
|
+
a.disabled = Marty::Util.get_posting_time == Float::INFINITY
|
|
365
365
|
end
|
|
366
366
|
|
|
367
367
|
######################################################################
|