glib-web 4.34.3 → 4.34.5
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/views/json_ui/garage/forms/selects.json.jbuilder +9 -9
- data/app/views/json_ui/garage/panels/index.json.jbuilder +3 -4
- data/app/views/json_ui/garage/panels/tree.json.jbuilder +4 -4
- data/lib/glib/json_crawler/router.rb +22 -1
- data/lib/glib/test_helpers.rb +4 -3
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71657e9b80c2a5759e3df0ee81e068470bb5dfb627b8339241703b948e72129f
|
4
|
+
data.tar.gz: 9b754b492975ebea6d3d5b2a18b667ae00398a2f1cebdd2a6b33fcca377b8b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e3dd7df23643cc4bdff6e7fd4d3cdc8ca0cb05c1a955686ffb94707569a16bccbd50d1ee9fcb0cb469d2c946cb96f0786c7b8590b6136d39f086848ab3350a
|
7
|
+
data.tar.gz: 6ca9a5ec915680ecc074c369807838e56541e3946ba928d751965198a984cee991232aa5d8be389d75fef64cd77c9502a90d6338e200cc4cfcb855746ca23391
|
@@ -85,16 +85,16 @@ page.form id: 'form', url: json_ui_garage_url(path: 'forms/generic_post'), metho
|
|
85
85
|
|
86
86
|
languages = {
|
87
87
|
'East Asia' => {
|
88
|
-
'
|
89
|
-
'
|
90
|
-
'
|
88
|
+
'cn' => 'Chinese',
|
89
|
+
'jp' => 'Japanese',
|
90
|
+
'kr' => 'Korean',
|
91
91
|
},
|
92
92
|
'Middle East' => {
|
93
|
-
'
|
94
|
-
'
|
93
|
+
'sa' => 'Arabic',
|
94
|
+
'in' => 'Hindi',
|
95
95
|
},
|
96
96
|
'Europe' => {
|
97
|
-
'
|
97
|
+
'an' => 'Dutch',
|
98
98
|
'en' => 'English',
|
99
99
|
'fr' => 'French',
|
100
100
|
'de' => 'German',
|
@@ -109,7 +109,7 @@ page.form id: 'form', url: json_ui_garage_url(path: 'forms/generic_post'), metho
|
|
109
109
|
options = []
|
110
110
|
languages.each do |group, sub|
|
111
111
|
options << { type: 'label', text: group }
|
112
|
-
options.concat(sub.map { |k, v| { value: k, text: v, subtitle: 'Country' } })
|
112
|
+
options.concat(sub.map { |k, v| { value: k, text: v, subtitle: 'Country', imageUrl: "https://flagsapi.com/#{k.upcase}/flat/24.png" } })
|
113
113
|
options << { type: 'divider' }
|
114
114
|
end
|
115
115
|
|
@@ -118,7 +118,7 @@ page.form id: 'form', url: json_ui_garage_url(path: 'forms/generic_post'), metho
|
|
118
118
|
width: 'matchParent',
|
119
119
|
label: 'Primary Language',
|
120
120
|
options: options,
|
121
|
-
value: '
|
121
|
+
value: 'an',
|
122
122
|
accessory: ->(accessory) do
|
123
123
|
accessory.header padding: { x: 16, y: 10 }, childViews: ->(header) do
|
124
124
|
header.label text: 'Header'
|
@@ -146,7 +146,7 @@ page.form id: 'form', url: json_ui_garage_url(path: 'forms/generic_post'), metho
|
|
146
146
|
width: 'matchParent',
|
147
147
|
label: 'Primary Language',
|
148
148
|
options: options,
|
149
|
-
value: ['
|
149
|
+
value: ['jp', 'de'],
|
150
150
|
accessory: ->(view) do
|
151
151
|
view.footer padding: { x: 16, y: 10 }, width: 'matchParent', styleClass: 'sticky-footer', childViews: ->(footer) do
|
152
152
|
footer.panels_flow width: 'matchParent', styleClass: 'justify-end', childViews: ->(hori) do
|
@@ -68,6 +68,9 @@ json_ui_page json do |page|
|
|
68
68
|
template.thumbnail title: 'Table (Web Only)', subtitle: 'Rows with columns', onClick: ->(action) do
|
69
69
|
action.windows_open url: json_ui_garage_url(path: 'tables/index')
|
70
70
|
end
|
71
|
+
template.thumbnail title: 'Tree', subtitle: 'Tree like view just like folder and subfolder', onClick: ->(action) do
|
72
|
+
action.windows_open url: json_ui_garage_url(path: 'panels/tree')
|
73
|
+
end
|
71
74
|
|
72
75
|
end
|
73
76
|
end, ->(section) do
|
@@ -131,10 +134,6 @@ json_ui_page json do |page|
|
|
131
134
|
action.windows_open url: json_ui_garage_url(path: 'panels/grid')
|
132
135
|
end
|
133
136
|
|
134
|
-
template.thumbnail title: 'Tree', subtitle: 'Tree like view just like folder and subfolder', onClick: ->(action) do
|
135
|
-
action.windows_open url: json_ui_garage_url(path: 'panels/tree')
|
136
|
-
end
|
137
|
-
|
138
137
|
template.thumbnail title: 'List Template Accessory', onClick: ->(action) do
|
139
138
|
# TODO
|
140
139
|
end
|
@@ -9,7 +9,7 @@ onDropFile = ->(action) do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
onDropView = ->(action) do
|
12
|
-
action.http_post url: json_ui_garage_url(path: 'forms/generic_post_all')
|
12
|
+
action.http_post url: json_ui_garage_url(path: 'forms/generic_post_all', source_item_id: '{{moved[item_id]}}')
|
13
13
|
end
|
14
14
|
|
15
15
|
json_ui_page json do |page|
|
@@ -38,7 +38,7 @@ json_ui_page json do |page|
|
|
38
38
|
id: 'pop',
|
39
39
|
title: 'Pop',
|
40
40
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
41
|
-
dropData: { genre: 'pop' },
|
41
|
+
dropData: { genre: 'pop', item_id: 1 },
|
42
42
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'pop') },
|
43
43
|
subtitle: params['selected'] == 'pop' ? 'Pop music is a genre of popular music that originated in its modern' : nil,
|
44
44
|
rows: ['pop-1.mp3', 'pop-2.mp3', 'pop-3.mp3']
|
@@ -46,7 +46,7 @@ json_ui_page json do |page|
|
|
46
46
|
id: 'arab',
|
47
47
|
title: 'Arabian',
|
48
48
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
49
|
-
dropData: { genre: 'arab' },
|
49
|
+
dropData: { genre: 'arab', item_id: 2 },
|
50
50
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'arab') },
|
51
51
|
subtitle: params['selected'] == 'arab' ? 'Arabic music is the music of the Arab world' : nil,
|
52
52
|
rows: ['arabian-1.mp3', 'arabian-2.mp3', 'arabian-3.mp3']
|
@@ -55,7 +55,7 @@ json_ui_page json do |page|
|
|
55
55
|
title: 'Phonk',
|
56
56
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'phonk') },
|
57
57
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
58
|
-
dropData: { genre: 'phonk' },
|
58
|
+
dropData: { genre: 'phonk', item_id: 3 },
|
59
59
|
subtitle: params['selected'] == 'phonk' ? 'Phonk is a subgenre of hip hop and trap music' : nil,
|
60
60
|
rows: ['phonk1.mp3', 'phonk-2.mp3', { id: 'hard-phonk', title: 'Hard Phonk', rows: ['hard-phonk-1.mp3', 'hard-phonk-2.mp3'] }]
|
61
61
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'damerau-levenshtein'
|
2
|
+
|
1
3
|
module Glib
|
2
4
|
module JsonCrawler
|
3
5
|
class Router
|
4
6
|
attr_reader :read_only_actions # deprecated
|
5
7
|
attr_reader :logger, :last_log, :deferred_actions
|
6
8
|
attr_reader :http_actions
|
7
|
-
attr_accessor :host
|
9
|
+
attr_accessor :host, :skip_similar_page
|
8
10
|
|
9
11
|
def log(action, url, response = nil)
|
10
12
|
@last_log = [
|
@@ -53,6 +55,7 @@ module Glib
|
|
53
55
|
@host ||= 'localhost:3000'
|
54
56
|
@page_specs = []
|
55
57
|
@page_urls = []
|
58
|
+
@skip_similar_page = false
|
56
59
|
end
|
57
60
|
|
58
61
|
def step(http, args)
|
@@ -85,6 +88,8 @@ module Glib
|
|
85
88
|
assert_target_ids_exist(params)
|
86
89
|
|
87
90
|
if action.present?
|
91
|
+
return if similar_page?(params)
|
92
|
+
|
88
93
|
@depth += 1
|
89
94
|
case action
|
90
95
|
when 'initiate_navigation'
|
@@ -205,6 +210,22 @@ module Glib
|
|
205
210
|
regex = Regexp.new("#{host}.+(?<!\.pdf)$")
|
206
211
|
regex.match(url)
|
207
212
|
end
|
213
|
+
|
214
|
+
private
|
215
|
+
def similar_page?(params)
|
216
|
+
return false if http_actions.blank? || params['url'].blank?
|
217
|
+
return false if !skip_similar_page
|
218
|
+
|
219
|
+
result = false
|
220
|
+
http_actions.each do |http_action|
|
221
|
+
next if http_action[1].blank?
|
222
|
+
distance = ::DamerauLevenshtein.distance(http_action[1], params['url'])
|
223
|
+
result = (distance <= 1) && (http_action[0] == params['action'])
|
224
|
+
|
225
|
+
break if result
|
226
|
+
end
|
227
|
+
result
|
228
|
+
end
|
208
229
|
end
|
209
230
|
end
|
210
231
|
end
|
data/lib/glib/test_helpers.rb
CHANGED
@@ -7,10 +7,10 @@ module Glib
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module ClassMethods
|
10
|
-
def define_crawler_test(user, crawled_at, dump_path
|
10
|
+
def define_crawler_test(user, crawled_at, dump_path: , skip_similar_page: false, &on_after_crawl)
|
11
11
|
test "crawl api for #{user[:email]} #{user[:device]} #{user[:version] || 'current'}" do
|
12
12
|
Timecop.freeze(crawled_at || user[:crawled_at]) do
|
13
|
-
router = crawl_json_pages(user, dump_actions: dump_path.present?, dump_path: dump_path)
|
13
|
+
router = crawl_json_pages(user, dump_actions: dump_path.present?, dump_path: dump_path, skip_similar_page: skip_similar_page)
|
14
14
|
on_after_crawl&.call(router)
|
15
15
|
end
|
16
16
|
|
@@ -36,10 +36,11 @@ module Glib
|
|
36
36
|
assert_equal JSON.parse(expected), JSON.parse(result), "Result mismatch! #{__git_is_available? ? `git diff #{__controller_log_dir}/#{__controller_log_file}` : ''}"
|
37
37
|
end
|
38
38
|
|
39
|
-
def crawl_json_pages(user, log_file: nil, dump_actions: false, dump_path: nil, &block)
|
39
|
+
def crawl_json_pages(user, log_file: nil, dump_actions: false, dump_path: nil, skip_similar_page: false, &block)
|
40
40
|
__execute_crawler(user, inspect_http: true) do |router, http|
|
41
41
|
path = user[:path] ? "#{user[:path]}?format=json" : '/users/me?format=json&redirect=default'
|
42
42
|
router.host = HOST
|
43
|
+
router.skip_similar_page = skip_similar_page
|
43
44
|
router.step(
|
44
45
|
http,
|
45
46
|
'onClick' => {
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.34.
|
4
|
+
version: 4.34.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-10-04 00:00:00.000000000 Z
|
@@ -122,7 +122,21 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: damerau-levenshtein
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description:
|
126
140
|
email: ''
|
127
141
|
executables: []
|
128
142
|
extensions: []
|
@@ -426,10 +440,10 @@ files:
|
|
426
440
|
- lib/glib/value.rb
|
427
441
|
- lib/glib/version.rb
|
428
442
|
- lib/tasks/db.rake
|
429
|
-
homepage:
|
443
|
+
homepage:
|
430
444
|
licenses: []
|
431
445
|
metadata: {}
|
432
|
-
post_install_message:
|
446
|
+
post_install_message:
|
433
447
|
rdoc_options: []
|
434
448
|
require_paths:
|
435
449
|
- lib
|
@@ -445,7 +459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
445
459
|
version: '0'
|
446
460
|
requirements: []
|
447
461
|
rubygems_version: 3.4.6
|
448
|
-
signing_key:
|
462
|
+
signing_key:
|
449
463
|
specification_version: 4
|
450
464
|
summary: ''
|
451
465
|
test_files: []
|