web47core 3.2.3.46 → 3.2.3.48

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cb60aaf9b363d9d95a53e02cd2875e60b79f26344d64e08f6ba2ab8dce88e28
4
- data.tar.gz: 383b9f556359a6578d06ea3b319c0382016e6638d2c914da04684d34a7c9d933
3
+ metadata.gz: b460458978fdba54209f884a08fd57d1407bb02e4542ed559f9198aa918eb162
4
+ data.tar.gz: b3d3c901f101674abe9be6cdafa8e2f866f795826b1a6ce00aedc49ad6802428
5
5
  SHA512:
6
- metadata.gz: 670ea6d949445923fe1a9ec0f0a9b27d48a9ad6a73ac5dd3050088e1adc13fc9393f7d67991826db3587a864319b112700c8bfd2fa761bcf47437c17c63810ff
7
- data.tar.gz: 4565290e61d30d10a39be0584e7b6fe200fe76edfbf769f42e6e0c4af3544218a4be89b7049d6fe4d66237cca637f09e27511b184ef1827baa00d6abfa0fd5e7
6
+ metadata.gz: 4a6ae3bf153a29041e5bf6b2c1e13f611a7056036dd50729e9c592b89d9015347b7fe9a5d2a5e584cad78fa4757b9f6e0ddd0720f91d233ba5feb27277f1989c
7
+ data.tar.gz: e5100c2ef32e912f2b7f03afa453f2895f17879805e7dfaf4f17c3ce078de54f87d53e1e4604c5e00b0b82d7f9ed24fca4ffd46dc073b7dc2e1bca1caf8d9206
@@ -4,14 +4,13 @@
4
4
  # Return the status of the server
5
5
  #
6
6
  class StatusController < ActionController::Base
7
- helper SvgIconHelper
8
7
  protect_from_forgery with: :exception
9
8
  #
10
9
  # Main (and only) page
11
10
  #
12
11
  def index
13
12
  components = { mongo: mongo_status,
14
- redis: redis_status,
13
+ cache: cache_status,
15
14
  jobs: delayed_jobs_status,
16
15
  cron_job_servers: cron_job_servers_status,
17
16
  workers: workers_status,
@@ -27,10 +26,10 @@ class StatusController < ActionController::Base
27
26
  private
28
27
 
29
28
  #
30
- # Return the status of the key components, mongo, redis
29
+ # Return the status of the key components, mongo, cache
31
30
  #
32
31
  def db_status(components)
33
- components[:mongo][:success] && components[:redis][:success] ? 200 : 500
32
+ components[:mongo][:success] && components[:cache][:success] ? 200 : 500
34
33
  rescue StandardError
35
34
  500
36
35
  end
@@ -76,18 +75,20 @@ class StatusController < ActionController::Base
76
75
  end
77
76
 
78
77
  #
79
- # Redis DB Status
78
+ # Cache Status
80
79
  #
81
- def redis_status
80
+ def cache_status
82
81
  value = SecureRandom.hex(32)
83
- key = "redis-status-check-#{SecureRandom.hex(16)}"
84
- Rails.cache.write key, value, expires_in: 15.seconds
85
- cached_value = Rails.cache.fetch(key)
82
+ key = "cache-status-check-#{SecureRandom.hex(16)}"
83
+ cache = Rails.cache
84
+ write_result = cache.write(key, value, expires_in: 15.seconds)
85
+ cached_value = cache.read(key)
86
86
  unless value.eql?(cached_value)
87
- raise "Redis not available: Expected: #{value} with key #{key}, but got #{cached_value}"
87
+ raise "Cache not available (#{cache.class.name}): Expected: #{value} with key #{key}, " \
88
+ "but got #{cached_value.inspect}; write returned #{write_result.inspect}"
88
89
  end
89
90
 
90
- report_success 'Redis Available', count: 1
91
+ report_success 'Cache Available', count: 1
91
92
  rescue StandardError => error
92
93
  report_error(error, count: 0)
93
94
  end
@@ -3,25 +3,26 @@
3
3
  module SvgIconHelper
4
4
  # @abstract Render the appropriate icon based on the name and type
5
5
  # @return [View]
6
- def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2, cached: true)
6
+ def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2)
7
7
  return if name.blank?
8
8
 
9
- unless cached
10
- return fetch_svg_icon(name, size: size, type: type, classes: classes, color: color, stroke_width: stroke_width,
11
- cached: false)
12
- end
13
-
14
- key = ['svg_icon', name, size.to_s, type.to_s, classes.to_s, color, stroke_width.to_s].join(':')
15
- Rails.cache.fetch(key, expires_in: 15.minutes) do
16
- fetch_svg_icon(name, size: size, type: type, classes: classes, color: color, stroke_width: stroke_width)
17
- end
9
+ fetch_svg_icon(name, size: size, type: type, classes: classes, color: color, stroke_width: stroke_width)
18
10
  end
19
11
 
20
- def fetch_svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2, cached: true)
12
+ def fetch_svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2)
21
13
  return if name.blank?
22
14
 
23
15
  classes = classes.compact.flatten.join(' ')
24
- partial, stroke = icon_partial(name, type, color, cached: cached)
16
+ preferred_path = if I18n.exists?("nav.icons.#{name}")
17
+ "icons/#{I18n.t("nav.icons.#{name}")}"
18
+ else
19
+ "icons/#{type}/#{name}"
20
+ end
21
+ outline_path = "icons/outline/#{name}"
22
+ filled_path = "icons/filled/#{name}"
23
+ (partial, stroke) = [preferred_path, outline_path, filled_path].collect do |path|
24
+ [preferred_path, color] if lookup_context.exists?(path, [], true)
25
+ end.compact.first
25
26
  if partial.blank?
26
27
  partial = 'icons/outline/bug'
27
28
  stroke = 'red'
@@ -34,15 +35,13 @@ module SvgIconHelper
34
35
  class: classes,
35
36
  fill: 'none',
36
37
  stroke: stroke,
37
- style: "color: #{stroke}",
38
38
  'stroke-width': stroke_width,
39
39
  'stroke-linecap': 'round',
40
40
  'stroke-linejoin': 'round',
41
41
  title: name) do
42
42
  render partial
43
43
  end
44
- rescue StandardError => error
45
- puts "Error: #{error}"
44
+ rescue StandardError
46
45
  tag.svg(xmlns: 'http://www.w3.org/2000/svg',
47
46
  viewBox: '0 0 24 24',
48
47
  width: size,
@@ -58,23 +57,4 @@ module SvgIconHelper
58
57
  render 'icons/outline/bug'
59
58
  end
60
59
  end
61
-
62
- def icon_partial(name, type, color, cached:)
63
- lookup = lambda do
64
- preferred_path = if I18n.exists?("nav.icons.#{name}")
65
- "icons/#{I18n.t("nav.icons.#{name}")}"
66
- else
67
- "icons/#{type}/#{name}"
68
- end
69
- outline_path = "icons/outline/#{name}"
70
- filled_path = "icons/filled/#{name}"
71
-
72
- [preferred_path, outline_path, filled_path].collect do |path|
73
- [preferred_path, color] if lookup_context.exists?(path, [], true)
74
- end.compact.first
75
- end
76
- return lookup.call unless cached
77
-
78
- Rails.cache.fetch("icon_partial_path:#{name}:#{type}", expires_in: 15.minutes, &lookup)
79
- end
80
60
  end
@@ -31,6 +31,7 @@
31
31
  %td
32
32
  %h4.flow-text=key.to_s.titleize
33
33
  %td.center
34
- = svg_icon(value[:icon_name], size: 32, color: value[:icon_color], cached: false)
34
+ %svg{xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', width: 32, height: 32, fill: 'none', stroke: value[:icon_color].to_s, style: "color: #{value[:icon_color]}", 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', title: value[:icon_name]}
35
+ = render "icons/outline/#{value[:icon_name]}"
35
36
  %td.center.hide-on-small-only
36
37
  %h4.flow-text.large=value[:message]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.3.46'
4
+ VERSION = '3.2.3.48'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3.46
4
+ version: 3.2.3.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder