glib-web 0.5.9 → 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 +2 -2
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +16 -18
- data/lib/glib/json_crawler.rb +1 -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 +1 -1
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +2 -0
- 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/router.rb +35 -29
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c409da37352d6e9066f4b7895d76c3cba5e81f2
|
4
|
+
data.tar.gz: 7116d6e9e13cc00d98811010acb550749acdcbba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ce3e630395c565eb252a653db28eb026388100082105109d4f2a380f19bab6d0465bd5d04ff65ff0da4c729c4273a08d800c2e8db614678767349ef279a8422
|
7
|
+
data.tar.gz: cb22a75b02ed382066e4d6060026600093cd543032c0d9c0679f64628750068a8ffa3dca4070995907040db5871b75ae171a4a5172ec445aa4e762357bd73235
|
@@ -31,8 +31,8 @@ module Glib::Json::Ui
|
|
31
31
|
@__json_ui_activated
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
if (hash = json_transformation_start).is_a?(Hash)
|
34
|
+
def json_ui_page_lifecycle_prop(name)
|
35
|
+
if (hash = json_transformation_start).is_a?(Hash) && hash['body'] # A valid page
|
36
36
|
hash[name] ||= { 'action' => 'runMultiple', 'childActions' => [] }
|
37
37
|
hash[name]['childActions']
|
38
38
|
end
|
@@ -5,35 +5,33 @@ next_page = {
|
|
5
5
|
autoload: 'asNeeded'
|
6
6
|
}
|
7
7
|
|
8
|
+
page = json_ui_page json
|
8
9
|
column_indexes = (1..3)
|
10
|
+
|
9
11
|
if params[:section_only].present?
|
10
12
|
json.nextPage next_page if page_index < 3
|
11
|
-
|
12
|
-
json.
|
13
|
-
|
14
|
-
render 'json_ui/garage/tables/autoload_section', page: page, page_index: page_index, column_indexes: column_indexes
|
15
|
-
end
|
13
|
+
json.sections do
|
14
|
+
json.child! do
|
15
|
+
render 'json_ui/garage/tables/autoload_section', page: page, page_index: page_index, column_indexes: column_indexes
|
16
16
|
end
|
17
17
|
end
|
18
18
|
else
|
19
19
|
json.title 'Tables'
|
20
20
|
|
21
|
-
|
22
|
-
render "#{@path_prefix}/nav_menu", json: json, page: page
|
21
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
23
|
+
page.table nextPage: next_page, firstSection: ->(section) do
|
24
|
+
section.header cellViews: ->(header) do
|
25
|
+
column_indexes.each do |i|
|
26
|
+
header.label text: "Heading#{i}"
|
29
27
|
end
|
30
|
-
|
31
|
-
render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
|
32
|
-
end, onScrollToBottom: ->(action) do
|
33
|
-
action.snackbars_alert message: 'Scrolled to Bottom'
|
34
|
-
end, onScrollToTop: ->(action) do
|
35
|
-
action.snackbars_alert message: 'Scrolled to Top'
|
36
28
|
end
|
29
|
+
|
30
|
+
render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
|
31
|
+
end, onScrollToBottom: ->(action) do
|
32
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
33
|
+
end, onScrollToTop: ->(action) do
|
34
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
37
35
|
end
|
38
36
|
|
39
37
|
end
|
data/lib/glib/json_crawler.rb
CHANGED
@@ -8,3 +8,4 @@ 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/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
|
@@ -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
|
@@ -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,40 +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
|
-
|
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)
|
44
67
|
@read_only_actions.add([action, params['url']])
|
45
|
-
JsonCrawler::WindowsOpen.new(http, params, action)
|
46
|
-
when 'sheets/select-v1', 'sheets/select'
|
47
|
-
JsonCrawler::Menu.new(http, params, action)
|
48
|
-
when 'http/post-v1', 'http/post'
|
49
|
-
JsonCrawler::ActionHttp.new(:post, http, params, action)
|
50
|
-
when 'forms/submit-v1', 'forms/submit'
|
51
|
-
forms = @visitor.forms
|
52
|
-
# raise 'Submit action needs to be inside a form' if forms.size < 1
|
53
|
-
JsonCrawler::FormsSubmit.new(http, forms.last)
|
54
|
-
else
|
55
|
-
unless [
|
56
|
-
'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
|
57
|
-
'http/delete', 'dialogs/oauth', 'windows/openWeb'
|
58
|
-
].include?(action)
|
59
|
-
@read_only_actions.add([action, params['url']])
|
60
|
-
end
|
61
|
-
self.log action, params['url']
|
62
68
|
end
|
63
|
-
|
64
|
-
# child
|
69
|
+
self.log action, params['url']
|
65
70
|
end
|
71
|
+
@depth -= 1
|
66
72
|
end
|
67
73
|
end
|
68
74
|
|
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
|
- ''
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- lib/glib/json_crawler/action_crawlers/forms_submit.rb
|
215
215
|
- lib/glib/json_crawler/action_crawlers/menu.rb
|
216
216
|
- lib/glib/json_crawler/action_crawlers/nav_initiate.rb
|
217
|
+
- lib/glib/json_crawler/action_crawlers/run_multiple.rb
|
217
218
|
- lib/glib/json_crawler/action_crawlers/windows_open.rb
|
218
219
|
- lib/glib/json_crawler/coverage.rb
|
219
220
|
- lib/glib/json_crawler/http.rb
|