glib-web 0.5.4 → 0.5.11
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 +4 -4
- data/app/controllers/concerns/glib/json/ui.rb +7 -0
- data/app/helpers/glib/app_feature_support_helper.rb +16 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +9 -3
- data/app/helpers/glib/json_ui/action_builder.rb +36 -6
- data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -0
- data/app/helpers/glib/json_ui/page_helper.rb +13 -5
- data/app/helpers/glib/json_ui/response_helper.rb +1 -1
- data/app/helpers/glib/json_ui/styling_helper.rb +22 -0
- data/app/helpers/glib/json_ui/view_builder.rb +16 -16
- data/app/helpers/glib/json_ui/view_builder/fields.rb +9 -1
- data/app/helpers/glib/json_ui/view_builder/panels.rb +2 -0
- data/app/helpers/glib/urls_helper.rb +7 -0
- data/app/policies/glib/application_policy.rb +27 -30
- data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -2
- data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +9 -18
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +6 -3
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +20 -3
- data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +4 -1
- data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +1 -1
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +19 -21
- data/app/views/json_ui/garage/pages/index.json.jbuilder +11 -0
- data/app/views/json_ui/garage/pages/layout.json.jbuilder +12 -13
- data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +28 -16
- data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +40 -0
- data/app/views/json_ui/garage/panels/carousel.json.jbuilder +24 -3
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +37 -0
- data/app/views/json_ui/garage/tables/index.json.jbuilder +3 -0
- data/app/views/json_ui/garage/views/icons.json.jbuilder +22 -0
- data/app/views/json_ui/garage/views/images.json.jbuilder +4 -4
- data/app/views/json_ui/garage/views/index.json.jbuilder +3 -3
- data/lib/glib/json_crawler.rb +2 -0
- data/lib/glib/json_crawler/action_crawler.rb +4 -1
- data/lib/glib/json_crawler/action_crawlers/action_http.rb +2 -5
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +2 -2
- data/lib/glib/json_crawler/action_crawlers/menu.rb +12 -0
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +3 -1
- data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +13 -0
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +3 -0
- data/lib/glib/json_crawler/http.rb +3 -2
- data/lib/glib/json_crawler/router.rb +35 -28
- data/lib/glib/test_helpers.rb +4 -4
- metadata +8 -2
- data/app/views/json_ui/garage/views/carousels.json.jbuilder +0 -37
@@ -11,10 +11,10 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
11
11
|
scroll.spacer height: 6
|
12
12
|
scroll.avatar url: glib_json_image_avatar_url
|
13
13
|
|
14
|
-
scroll.spacer height: 20
|
15
|
-
scroll.h2 text: 'Icon'
|
16
|
-
scroll.spacer height: 6
|
17
|
-
scroll.icon spec: 'info'
|
14
|
+
# scroll.spacer height: 20
|
15
|
+
# scroll.h2 text: 'Icon'
|
16
|
+
# scroll.spacer height: 6
|
17
|
+
# scroll.icon spec: 'info'
|
18
18
|
|
19
19
|
scroll.spacer height: 20
|
20
20
|
scroll.h2 text: 'Image with base64 data'
|
@@ -16,15 +16,15 @@ json_ui_page json do |page|
|
|
16
16
|
template.thumbnail title: 'Images', onClick: ->(action) do
|
17
17
|
action.windows_open url: json_ui_garage_url(path: 'views/images')
|
18
18
|
end
|
19
|
-
template.thumbnail title: 'Carousels', onClick: ->(action) do
|
20
|
-
action.windows_open url: json_ui_garage_url(path: 'views/carousels')
|
21
|
-
end
|
22
19
|
template.thumbnail title: 'Charts', onClick: ->(action) do
|
23
20
|
action.windows_open url: json_ui_garage_url(path: 'views/charts')
|
24
21
|
end
|
25
22
|
template.thumbnail title: 'Banners', onClick: ->(action) do
|
26
23
|
action.windows_open url: json_ui_garage_url(path: 'views/banners')
|
27
24
|
end
|
25
|
+
template.thumbnail title: 'Icons', onClick: ->(action) do
|
26
|
+
action.windows_open url: json_ui_garage_url(path: 'views/icons')
|
27
|
+
end
|
28
28
|
template.thumbnail title: 'Misc', onClick: ->(action) do
|
29
29
|
action.windows_open url: json_ui_garage_url(path: 'views/misc')
|
30
30
|
end
|
data/lib/glib/json_crawler.rb
CHANGED
@@ -7,3 +7,5 @@ require_relative './json_crawler/action_crawlers/nav_initiate'
|
|
7
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
|
+
require_relative './json_crawler/action_crawlers/menu'
|
11
|
+
require_relative './json_crawler/action_crawlers/run_multiple'
|
@@ -4,11 +4,8 @@ module Glib
|
|
4
4
|
def initialize(method, http, args, controller)
|
5
5
|
@http = http
|
6
6
|
json = @http.send(method, args['url'], controller, args.fetch('formData', {}))
|
7
|
-
|
8
|
-
unless json.nil?
|
9
|
-
click(json)
|
10
|
-
end
|
7
|
+
perform(json['onResponse'])
|
11
8
|
end
|
12
9
|
end
|
13
10
|
end
|
14
|
-
end
|
11
|
+
end
|
@@ -31,7 +31,7 @@ module Glib
|
|
31
31
|
|
32
32
|
include_params = case name
|
33
33
|
when 'fields/check', 'fields/check-v1'
|
34
|
-
child['
|
34
|
+
child['checkValue'] == child['value']
|
35
35
|
else
|
36
36
|
true
|
37
37
|
end
|
@@ -41,7 +41,7 @@ module Glib
|
|
41
41
|
end
|
42
42
|
|
43
43
|
json = @http.patch url, action, params
|
44
|
-
|
44
|
+
perform(json['onResponse'])
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -3,12 +3,14 @@ module Glib
|
|
3
3
|
class NavInitiate < ActionCrawler
|
4
4
|
def initialize(http, args, action)
|
5
5
|
super(http)
|
6
|
-
|
6
|
+
|
7
7
|
@http = http
|
8
8
|
if (json = (@http.get args['url'], action, args.except('url'))) && (left_drawer = json['leftDrawer'])
|
9
9
|
crawl left_drawer['header']&.[]('childViews')
|
10
10
|
crawl left_drawer['rows']
|
11
11
|
end
|
12
|
+
|
13
|
+
perform(json['onLoad'])
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -3,6 +3,7 @@ module Glib
|
|
3
3
|
class WindowsOpen < ActionCrawler
|
4
4
|
def initialize(http, args, action)
|
5
5
|
@http = http
|
6
|
+
|
6
7
|
if (url = args['url'])
|
7
8
|
json = @http.get(url, action, args.except('url'))
|
8
9
|
|
@@ -20,6 +21,8 @@ module Glib
|
|
20
21
|
click button
|
21
22
|
end
|
22
23
|
end
|
24
|
+
|
25
|
+
perform(json['onLoad'])
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
@@ -8,8 +8,8 @@ module Glib
|
|
8
8
|
VALID_RESPONSE_CODES = [
|
9
9
|
(200..299).to_a,
|
10
10
|
## Note, the JSON API does not allow redirects
|
11
|
-
401, ## UNAUTHORIZED Should be used for not-logged-in
|
12
|
-
403, ## FORBIDDEN Should be used for logged-in but not allowed to access
|
11
|
+
# 401, ## UNAUTHORIZED Should be used for not-logged-in
|
12
|
+
# 403, ## FORBIDDEN Should be used for logged-in but not allowed to access
|
13
13
|
].flatten
|
14
14
|
|
15
15
|
def initialize(context, user, router)
|
@@ -105,6 +105,7 @@ module Glib
|
|
105
105
|
get redirect_uri.to_s, action, params
|
106
106
|
else
|
107
107
|
response_times << response.headers['X-Runtime'].to_f
|
108
|
+
|
108
109
|
@context.assert_includes VALID_RESPONSE_CODES, code, "Expected a valid response but was [#{response.code}] #{Rack::Utils::HTTP_STATUS_CODES[response.code.to_i]}:\n#{url}"
|
109
110
|
if response.media_type == 'application/json'
|
110
111
|
JSON.parse(response.body)
|
@@ -19,6 +19,7 @@ module Glib
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def step(http, args)
|
22
|
+
# TODO: Refactor
|
22
23
|
case args['view']
|
23
24
|
when 'fields/submit-v1', 'fields/submit'
|
24
25
|
@depth += 1
|
@@ -29,39 +30,45 @@ module Glib
|
|
29
30
|
end
|
30
31
|
|
31
32
|
if args.is_a?(Hash) && args['rel'] != 'nofollow'
|
32
|
-
if (onClick = (args.fetch('onClick', nil)
|
33
|
-
|
34
|
-
params = onClick
|
33
|
+
if (onClick = (args.fetch('onClick', nil)))
|
34
|
+
process_action(http, onClick)
|
35
35
|
end
|
36
|
+
end
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
def process_action(http, spec)
|
40
|
+
action = spec['action']
|
41
|
+
params = spec
|
42
|
+
|
43
|
+
if action.present?
|
44
|
+
@depth += 1
|
45
|
+
case action
|
46
|
+
when 'initiate_navigation'
|
47
|
+
@read_only_actions.add([action, params['url']])
|
48
|
+
JsonCrawler::NavInitiate.new(http, params, action)
|
49
|
+
when 'runMultiple-v1', 'runMultiple'
|
50
|
+
JsonCrawler::RunMultiple.new(http, params, action)
|
51
|
+
when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload'
|
52
|
+
@read_only_actions.add([action, params['url']])
|
53
|
+
JsonCrawler::WindowsOpen.new(http, params, action)
|
54
|
+
when 'sheets/select-v1', 'sheets/select'
|
55
|
+
JsonCrawler::Menu.new(http, params, action)
|
56
|
+
when 'http/post-v1', 'http/post'
|
57
|
+
JsonCrawler::ActionHttp.new(:post, http, params, action)
|
58
|
+
when 'forms/submit-v1', 'forms/submit'
|
59
|
+
forms = @visitor.forms
|
60
|
+
# raise 'Submit action needs to be inside a form' if forms.size < 1
|
61
|
+
JsonCrawler::FormsSubmit.new(http, forms.last)
|
62
|
+
else
|
63
|
+
unless [
|
64
|
+
'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
|
65
|
+
'http/delete', 'dialogs/oauth', 'windows/openWeb'
|
66
|
+
].include?(action)
|
45
67
|
@read_only_actions.add([action, params['url']])
|
46
|
-
JsonCrawler::WindowsOpen.new(http, params, action)
|
47
|
-
when 'http/post-v1', 'http/post'
|
48
|
-
JsonCrawler::ActionHttp.new(:post, http, params, action)
|
49
|
-
when 'forms/submit-v1', 'forms/submit'
|
50
|
-
forms = @visitor.forms
|
51
|
-
# raise 'Submit action needs to be inside a form' if forms.size < 1
|
52
|
-
JsonCrawler::FormsSubmit.new(http, forms.last)
|
53
|
-
else
|
54
|
-
unless [
|
55
|
-
'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
|
56
|
-
'http/delete', 'dialogs/oauth', 'windows/openWeb'
|
57
|
-
].include?(action)
|
58
|
-
@read_only_actions.add([action, params['url']])
|
59
|
-
end
|
60
|
-
self.log action, params['url']
|
61
68
|
end
|
62
|
-
|
63
|
-
# child
|
69
|
+
self.log action, params['url']
|
64
70
|
end
|
71
|
+
@depth -= 1
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
data/lib/glib/test_helpers.rb
CHANGED
@@ -20,21 +20,21 @@ module Glib
|
|
20
20
|
end
|
21
21
|
@__log_dir
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def __log_file
|
25
25
|
@__log_file ||= "#{self.method_name}.json"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def __log json
|
29
29
|
File.open("#{File.join(__log_dir, __log_file)}", "w") do |f|
|
30
30
|
f << JSON.pretty_generate( JSON.parse(json) )
|
31
31
|
end
|
32
32
|
json
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def __get_previous_result_from_git
|
36
36
|
`git checkout -- "#{File.join(__log_dir, __log_file)}" > /dev/null 2>&1` if __git_is_available?
|
37
|
-
File.
|
37
|
+
File.exist?(File.join(__log_dir, __log_file)) ? File.open(File.join(__log_dir, __log_file)).read : "\{\}"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
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: 0.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- app/controllers/concerns/glib/json/ui.rb
|
74
74
|
- app/controllers/concerns/glib/json/validation.rb
|
75
75
|
- app/controllers/glib/home_controller.rb
|
76
|
+
- app/helpers/glib/app_feature_support_helper.rb
|
76
77
|
- app/helpers/glib/dynamic_images_helper.rb
|
77
78
|
- app/helpers/glib/dynamic_texts_helper.rb
|
78
79
|
- app/helpers/glib/forms_helper.rb
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- app/helpers/glib/json_ui/view_builder/charts.rb
|
98
99
|
- app/helpers/glib/json_ui/view_builder/fields.rb
|
99
100
|
- app/helpers/glib/json_ui/view_builder/panels.rb
|
101
|
+
- app/helpers/glib/urls_helper.rb
|
100
102
|
- app/models/glib/active_storage/attachment.rb
|
101
103
|
- app/models/glib/active_storage/blob.rb
|
102
104
|
- app/models/glib/dynamic_text_record.rb
|
@@ -156,6 +158,7 @@ files:
|
|
156
158
|
- app/views/json_ui/garage/pages/layout.json.jbuilder
|
157
159
|
- app/views/json_ui/garage/pages/loading_indicator.json.jbuilder
|
158
160
|
- app/views/json_ui/garage/pages/nav_buttons.json.jbuilder
|
161
|
+
- app/views/json_ui/garage/pages/nested_scroll.json.jbuilder
|
159
162
|
- app/views/json_ui/garage/pages/tab_bar.json.jbuilder
|
160
163
|
- app/views/json_ui/garage/panels/_styled.json.jbuilder
|
161
164
|
- app/views/json_ui/garage/panels/card.json.jbuilder
|
@@ -173,6 +176,7 @@ files:
|
|
173
176
|
- app/views/json_ui/garage/services/index.json.jbuilder
|
174
177
|
- app/views/json_ui/garage/tables/_autoload_section.json.jbuilder
|
175
178
|
- app/views/json_ui/garage/tables/autoload_all.json.jbuilder
|
179
|
+
- app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder
|
176
180
|
- app/views/json_ui/garage/tables/export_import.json.jbuilder
|
177
181
|
- app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder
|
178
182
|
- app/views/json_ui/garage/tables/index.json.jbuilder
|
@@ -180,8 +184,8 @@ files:
|
|
180
184
|
- app/views/json_ui/garage/views/_chart_data.json.jbuilder
|
181
185
|
- app/views/json_ui/garage/views/banners.json.jbuilder
|
182
186
|
- app/views/json_ui/garage/views/calendar_data.json.jbuilder
|
183
|
-
- app/views/json_ui/garage/views/carousels.json.jbuilder
|
184
187
|
- app/views/json_ui/garage/views/charts.json.jbuilder
|
188
|
+
- app/views/json_ui/garage/views/icons.json.jbuilder
|
185
189
|
- app/views/json_ui/garage/views/images.json.jbuilder
|
186
190
|
- app/views/json_ui/garage/views/index.json.jbuilder
|
187
191
|
- app/views/json_ui/garage/views/links.json.jbuilder
|
@@ -208,7 +212,9 @@ files:
|
|
208
212
|
- lib/glib/json_crawler/action_crawler.rb
|
209
213
|
- lib/glib/json_crawler/action_crawlers/action_http.rb
|
210
214
|
- lib/glib/json_crawler/action_crawlers/forms_submit.rb
|
215
|
+
- lib/glib/json_crawler/action_crawlers/menu.rb
|
211
216
|
- lib/glib/json_crawler/action_crawlers/nav_initiate.rb
|
217
|
+
- lib/glib/json_crawler/action_crawlers/run_multiple.rb
|
212
218
|
- lib/glib/json_crawler/action_crawlers/windows_open.rb
|
213
219
|
- lib/glib/json_crawler/coverage.rb
|
214
220
|
- lib/glib/json_crawler/http.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
json.title 'Views'
|
2
|
-
|
3
|
-
image_url1 = 'http://ichef.bbci.co.uk/news/976/cpsprodpb/18106/production/_97266589_gettyimages-474547165.jpg'
|
4
|
-
image_url2 = 'https://s.abcnews.com/images/International/Guam03-gty-jrl-170809_16x9_992.jpg'
|
5
|
-
|
6
|
-
json_ui_page json do |page|
|
7
|
-
render "#{@path_prefix}/nav_menu", json: json, page: page
|
8
|
-
|
9
|
-
page.scroll childViews: ->(scroll) do
|
10
|
-
scroll.label text: "\n"
|
11
|
-
scroll.h1 text: 'Carousel with labels'
|
12
|
-
scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
|
13
|
-
carousel.label text: 'Item 1'
|
14
|
-
carousel.label text: 'Item 2'
|
15
|
-
end
|
16
|
-
|
17
|
-
scroll.label text: "\n"
|
18
|
-
scroll.h1 text: 'Carousel with images'
|
19
|
-
scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
|
20
|
-
carousel.image url: image_url1, width: 'matchParent'
|
21
|
-
carousel.image url: image_url2, width: 'matchParent'
|
22
|
-
end
|
23
|
-
|
24
|
-
scroll.label text: "\n"
|
25
|
-
scroll.h1 text: 'Carousel with complex layout'
|
26
|
-
scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
|
27
|
-
carousel.panels_vertical childViews: ->(panel) do
|
28
|
-
panel.h3 text: 'Item 1'
|
29
|
-
panel.image url: image_url1, width: 'matchParent'
|
30
|
-
end
|
31
|
-
carousel.panels_vertical childViews: ->(panel) do
|
32
|
-
panel.h3 text: 'Item 2'
|
33
|
-
panel.image url: image_url2, width: 'matchParent'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|