glib-web 4.10.2 → 4.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/glib/enum_humanization.rb +1 -1
- data/app/views/json_ui/garage/views/controls.json.jbuilder +2 -2
- data/lib/glib/json_crawler/action_crawlers/dialogs_close.rb +14 -0
- data/lib/glib/json_crawler/http.rb +25 -2
- data/lib/glib/json_crawler/router.rb +2 -0
- data/lib/glib/json_crawler.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 840b2cb71ab488fdfff13806866763bd9e73c22c7cab85cff48a093643f7d898
|
4
|
+
data.tar.gz: 1a513b44d185b802b61b54f1053246b5308e38f536fb4cef32a1123695b7ab3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c48d7a4a27523b0ada18199e771f028879ce44a8587513416b46885cbf6fb1a695c64a0e3e30facf049cea0039c313e4cd8a0d7f8551dc744b6ecccb54a533a
|
7
|
+
data.tar.gz: a7717b61cd9e9ba90aeec57991fca3e39c387eaabf175d9d6585973a034198af5231562d72abe85844bb0f668f0088dfd5d63611b158a9a911f05ffb95b32d3c
|
@@ -21,7 +21,7 @@ module Glib
|
|
21
21
|
if enum_value
|
22
22
|
translation_key = "activerecord.attributes.#{model_name.i18n_key}.#{enum_name.to_s.pluralize}.#{enum_value}"
|
23
23
|
|
24
|
-
if default_translation.nil? && Rails.env.development?
|
24
|
+
if default_translation.nil? && (Rails.env.development? || Rails.env.test?)
|
25
25
|
text = I18n.t(translation_key, raise: I18n::MissingTranslationData)
|
26
26
|
else
|
27
27
|
text = I18n.t(translation_key, default: default_translation)
|
@@ -39,10 +39,10 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
39
39
|
dialog.body padding: glib_json_padding_body, childViews: ->(view) do
|
40
40
|
view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
|
41
41
|
res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
42
|
-
saction.windows_open url: '
|
42
|
+
saction.windows_open url: json_ui_garage_url(path: 'pages/index')
|
43
43
|
end
|
44
44
|
res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
45
|
-
saction.
|
45
|
+
saction.windows_open url: json_ui_garage_url(path: 'home/blank')
|
46
46
|
end
|
47
47
|
res.label text: 'Item 3', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
48
48
|
saction.popovers_close key: 'menu'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Glib
|
2
|
+
module JsonCrawler
|
3
|
+
class DialogsClose < ActionCrawler
|
4
|
+
def initialize(http, args, action)
|
5
|
+
super(http)
|
6
|
+
|
7
|
+
@http.router.log action, nil
|
8
|
+
if (on_close = args.fetch('onClose', nil))
|
9
|
+
perform(on_close)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -14,6 +14,7 @@ module Glib
|
|
14
14
|
def initialize(context, user, router)
|
15
15
|
@context = context
|
16
16
|
@history = []
|
17
|
+
@content_history = []
|
17
18
|
@response_times = []
|
18
19
|
@user = user
|
19
20
|
@router = router
|
@@ -51,6 +52,12 @@ module Glib
|
|
51
52
|
def fetch(method, url, action, params = {}, inspect_result = true)
|
52
53
|
return nil if url.blank?
|
53
54
|
|
55
|
+
if (last_record = @content_history.last)
|
56
|
+
previous_url = last_record[:url]
|
57
|
+
else
|
58
|
+
previous_url = nil
|
59
|
+
end
|
60
|
+
|
54
61
|
if method == :get
|
55
62
|
return nil if history.include?(url)
|
56
63
|
|
@@ -64,7 +71,8 @@ module Glib
|
|
64
71
|
http_header = {
|
65
72
|
'Client-DeviceOS' => user[:device],
|
66
73
|
'Client-Version' => user[:version],
|
67
|
-
'X-CSRF-Token' => user[:token]
|
74
|
+
'X-CSRF-Token' => user[:token],
|
75
|
+
'Referer' => previous_url
|
68
76
|
}
|
69
77
|
http_header.merge!(params[:headers]) if params[:headers].present?
|
70
78
|
|
@@ -76,7 +84,15 @@ module Glib
|
|
76
84
|
begin
|
77
85
|
@context.send(method, url, params: params, headers: http_header)
|
78
86
|
raw_response = @context.response
|
79
|
-
|
87
|
+
body = raw_response.body
|
88
|
+
response = Response.new(raw_response.code.to_i, raw_response.headers, raw_response.media_type, body)
|
89
|
+
|
90
|
+
if method == :get
|
91
|
+
@content_history << {
|
92
|
+
url: url,
|
93
|
+
response: body
|
94
|
+
}
|
95
|
+
end
|
80
96
|
|
81
97
|
if (controller = @context.controller)
|
82
98
|
Glib::JsonCrawler::Coverage.coverage_files.add(controller.class.instance_method(controller.action_name).source_location.first)
|
@@ -90,7 +106,14 @@ module Glib
|
|
90
106
|
end
|
91
107
|
|
92
108
|
if !response
|
109
|
+
crash_log_file = Rails.root.join('tmp', "crash-#{DateTime.current.to_fs(:number)}.log")
|
110
|
+
puts
|
93
111
|
puts "Crashed on #{url}"
|
112
|
+
puts "Referrer: #{previous_url}"
|
113
|
+
if last_record
|
114
|
+
File.write(crash_log_file, last_record[:response])
|
115
|
+
puts "Previous page's content logged to #{crash_log_file}"
|
116
|
+
end
|
94
117
|
raise
|
95
118
|
end
|
96
119
|
end
|
@@ -107,6 +107,8 @@ module Glib
|
|
107
107
|
JsonCrawler::FormsSubmit.new(http, params)
|
108
108
|
when 'dialogs/alert-v1', 'dialogs/alert'
|
109
109
|
JsonCrawler::DialogsAlert.new(http, params, action)
|
110
|
+
when 'dialogs/close-v1', 'dialogs/close', 'popovers/close', 'popovers/close-v1'
|
111
|
+
JsonCrawler::DialogsClose.new(http, params, action)
|
110
112
|
else
|
111
113
|
unless [
|
112
114
|
'http/delete-v1',
|
data/lib/glib/json_crawler.rb
CHANGED
@@ -8,6 +8,7 @@ require_relative './json_crawler/action_crawlers/windows_open'
|
|
8
8
|
require_relative './json_crawler/action_crawlers/action_http'
|
9
9
|
require_relative './json_crawler/action_crawlers/forms_submit'
|
10
10
|
require_relative './json_crawler/action_crawlers/dialogs_alert'
|
11
|
+
require_relative './json_crawler/action_crawlers/dialogs_close'
|
11
12
|
require_relative './json_crawler/action_crawlers/dialogs_show'
|
12
13
|
require_relative './json_crawler/action_crawlers/menu'
|
13
14
|
require_relative './json_crawler/action_crawlers/run_multiple'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.10.
|
4
|
+
version: 4.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -354,6 +354,7 @@ files:
|
|
354
354
|
- lib/glib/json_crawler/action_crawler.rb
|
355
355
|
- lib/glib/json_crawler/action_crawlers/action_http.rb
|
356
356
|
- lib/glib/json_crawler/action_crawlers/dialogs_alert.rb
|
357
|
+
- lib/glib/json_crawler/action_crawlers/dialogs_close.rb
|
357
358
|
- lib/glib/json_crawler/action_crawlers/dialogs_show.rb
|
358
359
|
- lib/glib/json_crawler/action_crawlers/forms_submit.rb
|
359
360
|
- lib/glib/json_crawler/action_crawlers/menu.rb
|