glib-web 4.1.1 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  3. data/app/helpers/glib/app_feature_support_helper.rb +0 -0
  4. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  5. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  6. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  7. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  8. data/app/helpers/glib/json_ui/view_builder/fields.rb +5 -1
  9. data/app/models/glib/active_storage/attachment.rb +0 -0
  10. data/app/models/glib/active_storage/blob.rb +0 -0
  11. data/app/models/glib/dynamic_text_record.rb +0 -0
  12. data/app/models/glib/text.rb +0 -0
  13. data/app/validators/email_typo_validator.rb +0 -0
  14. data/app/validators/email_validator.rb +0 -0
  15. data/app/validators/url_validator.rb +0 -0
  16. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +5 -1
  17. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  18. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  19. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +1 -0
  20. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  21. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +2 -2
  22. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  23. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  24. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  25. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  26. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  27. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/test_page/index.json.jbuilder +112 -0
  53. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  57. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  58. data/lib/generators/glib/install_generator.rb +0 -0
  59. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  60. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  61. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  62. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  63. data/lib/generators/templates/database.yml +0 -0
  64. data/lib/generators/templates/dynamic_text.rb +0 -0
  65. data/lib/glib/blob.rb +11 -3
  66. data/lib/glib/direct_uploads_controller.rb +1 -1
  67. data/lib/glib/dynamic_text/config.rb +0 -0
  68. data/lib/glib/dynamic_text.rb +0 -0
  69. data/lib/glib/engine.rb +2 -1
  70. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  71. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  72. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  73. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  74. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  75. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  76. data/lib/glib/json_crawler/coverage.rb +0 -0
  77. data/lib/glib/s3_service.rb +30 -0
  78. data/lib/glib/value.rb +0 -0
  79. data/lib/glib/version.rb +0 -0
  80. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5022fe611c19e51340f145ab4bb5577c208211186b575a2e784f8f50de06860c
4
- data.tar.gz: c1fc17633202ac17023f5040129165779283654334212168933608ed7df12e4f
3
+ metadata.gz: 59ce4822a2cbafa2933d7bf884df8eb63af65ebcd4046e4484a652fda583b5c6
4
+ data.tar.gz: f652bfbdb23e198af85cd46f0afef1f753da089a196ff18a13c4cbc57bf834b2
5
5
  SHA512:
6
- metadata.gz: d42b359a6e270fcdadfb8592af408974defc48bbd632d9cf91116f3a37fba4c47ac4bd54f53417c07ccb36afc883b1cbb72cd4afc1e0378b7a7dff283079c365
7
- data.tar.gz: 2b96d286b67a6e6faa900a474ea93d34a060eef45c0c1d85a493993757497ba8c0a14a624ba3e0764ad9c599bf35518c761f3c061af7a9ec20fa22c6948fd8ae
6
+ metadata.gz: ed0d06a31f63ab5fe4deffdf1995f1a673d751595da56fbbc2e1e8b3e3c55d7466957945cbf17f6aa78f094130480ea9c41d29c092b17f45aa6f4c5b90df60e5
7
+ data.tar.gz: 3ffb43696bb3c525282eead1ecd4232078acddc578091d056964b3c774e35e4c3be464a0ddb2230176a08d1a4578c53118d1cfe61893c6f802133d8cceecd7f2
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -257,6 +257,10 @@ class Glib::JsonUi::ViewBuilder
257
257
  action :onClick
258
258
  string :offIcon
259
259
  string :onIcon
260
+ string :imageUrl
261
+ string :icon
262
+ string :iconColor
263
+ string :iconSize
260
264
 
261
265
  views :childViews
262
266
  end
@@ -321,7 +325,7 @@ class Glib::JsonUi::ViewBuilder
321
325
 
322
326
  string :storagePrefix
323
327
  hash :metadata
324
- hash :tags
328
+ string :tagging
325
329
 
326
330
  required :accepts, :directUploadUrl
327
331
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -10,7 +10,7 @@ end
10
10
 
11
11
 
12
12
  if local_assigns[:top_nav] || json_ui_app_is_web?
13
- page.leftDrawer styleClasses:['maxi'], content: ->(drawer) do
13
+ page.leftDrawer styleClasses: ['maxi'], content: ->(drawer) do
14
14
  drawer.header childViews: ->(header) do
15
15
  header.button text: 'App', styleClasses: ['link', 'logo'], onClick: ->(action) do
16
16
  action.windows_open url: root_url
@@ -51,6 +51,10 @@ if local_assigns[:top_nav] || json_ui_app_is_web?
51
51
  action.windows_open url: json_ui_garage_url(path: 'services/index')
52
52
  end
53
53
 
54
+ menu.button text: 'Test Page', onClick: ->(action) do
55
+ action.windows_open url: json_ui_garage_url(path: 'test_page/index')
56
+ end
57
+
54
58
  menu.divider
55
59
  menu.label text: 'Misc Menu'
56
60
 
@@ -50,6 +50,7 @@ page.form options.merge(childViews: ->(form) do
50
50
  foo: 'bar',
51
51
  zoo: 'baz'
52
52
  },
53
+ tagging: 'key=value&key1=value1',
53
54
  files: [
54
55
  { name: 'File (Example)', signed_id: ActiveStorage::Attachment.last&.signed_id }
55
56
  ]
@@ -106,8 +106,8 @@ page.form \
106
106
  end
107
107
  end,
108
108
  childViews: ->(group) do
109
- group.fields_radio value: 'show', label: 'Show'
110
- group.fields_radio value: 'hide', label: 'Hide'
109
+ group.fields_radio value: 'show', label: 'Show', icon: 'edit', iconSize: 40
110
+ group.fields_radio value: 'hide', label: 'Hide', imageUrl: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png'
111
111
  group.fields_radio value: '', label: 'Empty'
112
112
  end
113
113
  form.spacer height: 10
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,112 @@
1
+ json.title 'Test Page'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body childViews: ->(body) do
6
+ body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
7
+ res.panels_column lg: { cols: 6 }, childViews: ->(col) do
8
+ res.h2 text: 'Reactivity'
9
+ res.spacer height: 8
10
+ res.panels_form \
11
+ url: json_ui_garage_url(path: 'forms/generic_post'),
12
+ method: 'post',
13
+ childViews: ->(form) do
14
+ form.panels_horizontal childViews: ->(hori) do
15
+ hori.button text: 'components/set', onClick: ->(action) do
16
+ action.runMultiple childActions: ->(saction) do
17
+ saction.components_set targetId: 'text', data: { value: 'Doe John' }
18
+ saction.components_set targetId: 'textarea', data: { value: 'The quick brown fox jumps over the lazy dog' }
19
+ new_options = [{ text: 'Option99', value: 'option99' }]
20
+ ['select', 'chip_group'].each do |id|
21
+ saction.components_set targetId: id, data: { options: new_options, value: ['option99'] }
22
+ end
23
+ end
24
+ end
25
+ hori.spacer width: 4
26
+ hori.button text: 'logics/set', onClick: ->(action) do
27
+ action.logics_set targetId: 'date', conditionalData: { value: { "+": [{ "var": ['user[date]'] }, 60 * 60 * 24 * 3] } }
28
+ end
29
+ hori.spacer width: 4
30
+ hori.button text: 'components/replace', onClick: ->(action) do
31
+ action.runMultiple childActions: ->(saction) do
32
+ saction.components_replace targetId: 'radio_group', newView: ->(view) do
33
+ view.fields_radioGroup value: '', childViews: ->(sview) do
34
+ sview.fields_radio label: 'Option99', value: 'option99'
35
+ end
36
+ end
37
+
38
+ saction.components_replace targetId: 'check_group', newView: ->(view) do
39
+ view.fields_checkGroup value: '', childViews: ->(sview) do
40
+ sview.fields_check label: 'Option99', value: nil, checkValue: 'option99'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ form.spacer height: 8
48
+ form.hr width: 'matchParent'
49
+ form.spacer height: 8
50
+
51
+ validation = { required: { message: 'Required' } }
52
+ options = ['option1', 'option2', 'option3', 'option4'].map { |option| { 'text'=> option.humanize, 'value' => option } }
53
+
54
+ form.fields_date width: 'matchParent', name: 'user[date]', id: 'date', value: Date.new(2024, 7, 24), validation: validation
55
+ form.hr width: 'matchParent'
56
+ form.fields_select multiple: true, width: 'matchParent', name: 'user[select]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
57
+ form.hr width: 'matchParent'
58
+ form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
59
+ form.hr width: 'matchParent'
60
+ form.fields_radioGroup width: 'matchParent', name: 'user[radio_group]', id: 'radio_group', value: 'option3', validation: validation, childViews: ->(radio) do
61
+ options.each do |option|
62
+ radio.fields_radio label: option['text'], value: option['value']
63
+ end
64
+ end
65
+ form.hr width: 'matchParent'
66
+ check_group_value = ['option3', 'option1']
67
+ form.fields_checkGroup width: 'matchParent', name: 'user[check_group]', id: 'check_group', value: check_group_value, validation: validation, childViews: ->(radio) do
68
+ options.each do |option|
69
+ radio.fields_check label: option['text'], value: check_group_value.include?(option['value']) ? option['value'] : nil, checkValue: option['value']
70
+ end
71
+ end
72
+ form.hr width: 'matchParent'
73
+ form.fields_text width: 'matchParent', name: 'user[text]', id: 'text', value: 'John Doe', validation: validation
74
+
75
+ form.hr width: 'matchParent'
76
+
77
+ form.fields_textarea width: 'matchParent', name: 'user[textarea]', id: 'textarea', value: 'Lorem ipsum et dumet bla bla bla...'
78
+
79
+ form.hr width: 'matchParent'
80
+ form.fields_submit text: 'submit'
81
+ form.spacer height: 2
82
+ form.fields_submit text: 'submit (if form valid)', disableIfFormInvalid: true
83
+ end
84
+
85
+
86
+ res.spacer height: 16
87
+
88
+ end
89
+
90
+
91
+ res.panels_column lg: { cols: 6 }, childViews: ->(col) do
92
+ res.h2 text: 'Dialog'
93
+ res.spacer height: 8
94
+ res.button text: 'Dialog updateExisting', onClick: ->(action) do
95
+ action.runMultiple childActions: ->(saction) do
96
+ saction.dialogs_show updateExisting: true, content: ->(dialog) do
97
+ dialog.body padding: glib_json_padding_body, childViews: ->(sbody) do
98
+ sbody.h1 text: 'Hello world'
99
+ sbody.button text: 'change dialog content', onClick: ->(ssaction) do
100
+ ssaction.dialogs_show updateExisting: true, disableCloseButton: true, content: ->(sdialog) do
101
+ sdialog.body padding: glib_json_padding_body, childViews: ->(ssbody) do
102
+ ssbody.h1 text: 'Hello world (updated)'
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/glib/blob.rb CHANGED
@@ -1,15 +1,23 @@
1
1
  ::ActiveStorage::Blob.class_eval do
2
+ attr_accessor :tagging
3
+
4
+ # removing custom_metadata and add tagging
2
5
  def service_headers_for_direct_upload
3
- service.headers_for_direct_upload key, filename: filename, content_type: content_type, content_length: byte_size, checksum: checksum
6
+ service.headers_for_direct_upload key, filename: filename, content_type: content_type, content_length: byte_size, checksum: checksum, tagging: tagging
7
+ end
8
+ def service_url_for_direct_upload(expires_in: ActiveStorage.service_urls_expire_in)
9
+ service.url_for_direct_upload key, expires_in: expires_in, content_type: content_type, content_length: byte_size, checksum: checksum, custom_metadata: custom_metadata, tagging: tagging
4
10
  end
5
11
 
6
12
  class << self
7
- def create_before_direct_upload!(key: nil, filename:, byte_size:, checksum:, content_type: nil, metadata: nil, service_name: nil, record: nil, prefix: nil)
13
+ def create_before_direct_upload!(key: nil, filename:, byte_size:, checksum:, content_type: nil, metadata: nil, service_name: nil, record: nil, prefix: nil, tagging: nil)
8
14
  key_name = key || generate_unique_secure_token
9
15
  if prefix.present?
10
16
  key_name = "#{prefix}/#{key_name}"
11
17
  end
12
- create! key: key_name, filename: filename, byte_size: byte_size, checksum: checksum, content_type: content_type, metadata: metadata, service_name: service_name
18
+ blob = create! key: key_name, filename: filename, byte_size: byte_size, checksum: checksum, content_type: content_type, metadata: metadata, service_name: service_name
19
+ blob.tagging = tagging
20
+ blob
13
21
  end
14
22
  end
15
23
  end
@@ -19,7 +19,7 @@
19
19
 
20
20
  private
21
21
  def blob_args
22
- params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :prefix, metadata: {}).to_h.symbolize_keys
22
+ params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :prefix, :tagging, metadata: {}).to_h.symbolize_keys
23
23
  end
24
24
 
25
25
  def authenticate_user!
File without changes
File without changes
data/lib/glib/engine.rb CHANGED
@@ -5,8 +5,9 @@ module Glib
5
5
 
6
6
  # modify direct upload
7
7
  config.to_prepare do
8
+ require_relative 's3_service'
8
9
  require_relative 'blob'
9
- require_relative 'direct_uploads_controller'
10
+ require_relative 'direct_uploads_controller'
10
11
  end
11
12
  end
12
13
  end
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,30 @@
1
+ require 'active_storage/service/s3_service'
2
+
3
+ ::ActiveStorage::Service::S3Service.class_eval do
4
+ attr_reader :headers_for_request
5
+
6
+ # Change presigned_url to presigned_request
7
+ # appearently presigned_url hoist all header `x-amz-` to query params.
8
+ # This is cause problem because S3 server ignore `x-amz-tagging` query params so it fails to tagging an object
9
+ # API: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Presigner.html#presigned_request-instance_method
10
+ # Detail about problem: https://github.com/aws/aws-sdk/issues/782
11
+ def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, tagging: nil, custom_metadata: {})
12
+ instrument :url, key: key do |payload|
13
+ generated_url, headers = object_for(key).presigned_request :put, expires_in: expires_in.to_i,
14
+ content_type: content_type, content_length: content_length, content_md5: checksum,
15
+ metadata: custom_metadata, whitelist_headers: ['content-length'], tagging: tagging, **upload_options
16
+
17
+ payload[:url] = generated_url
18
+ @headers_for_request = headers
19
+
20
+ generated_url
21
+ end
22
+ end
23
+
24
+ def headers_for_direct_upload(key, content_type:, checksum:, filename: nil, disposition: nil, tagging: nil, custom_metadata: {}, **)
25
+ content_disposition = content_disposition_with(type: disposition, filename: filename) if filename
26
+
27
+ headers = { 'Content-Type' => content_type, 'Content-MD5' => checksum, 'Content-Disposition' => content_disposition, **custom_metadata_headers(custom_metadata) }
28
+ headers.merge(headers_for_request)
29
+ end
30
+ end
data/lib/glib/value.rb CHANGED
File without changes
data/lib/glib/version.rb CHANGED
File without changes
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.1.1
4
+ version: 4.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -271,6 +271,7 @@ files:
271
271
  - app/views/json_ui/garage/tables/index.json.jbuilder
272
272
  - app/views/json_ui/garage/tables/layout.json.jbuilder
273
273
  - app/views/json_ui/garage/tables/panel_content.json.jbuilder
274
+ - app/views/json_ui/garage/test_page/index.json.jbuilder
274
275
  - app/views/json_ui/garage/views/_chart_data.json.jbuilder
275
276
  - app/views/json_ui/garage/views/banners.json.jbuilder
276
277
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder
@@ -328,6 +329,7 @@ files:
328
329
  - lib/glib/json_crawler/http.rb
329
330
  - lib/glib/json_crawler/router.rb
330
331
  - lib/glib/mailer_tester.rb
332
+ - lib/glib/s3_service.rb
331
333
  - lib/glib/test_helpers.rb
332
334
  - lib/glib/time_freezable_mailer.rb
333
335
  - lib/glib/time_returning_mailer.rb
@@ -352,8 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
354
  - !ruby/object:Gem::Version
353
355
  version: '0'
354
356
  requirements: []
355
- rubyforge_project:
356
- rubygems_version: 2.7.6
357
+ rubygems_version: 3.4.6
357
358
  signing_key:
358
359
  specification_version: 4
359
360
  summary: ''