motor-admin 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d3a3e923ca22e7fdf83117a4b7c0bd380ffb345f747d99de9eecceb171ceabc
4
- data.tar.gz: fb8239b1a4177781480dc59014c525aa84731eb9baaf63edb72072a81698fbd4
3
+ metadata.gz: ab0cc50d998434c23dbb9e9722a600b694b9177d7734d2abf347123c97e668cd
4
+ data.tar.gz: c6f7837f40d9490d694d1491e691aa4154e8649fa6c9d890683a9bb607fdb1d4
5
5
  SHA512:
6
- metadata.gz: 2effaa91317c2c4b48fbaf9008c4e006419c31e7266effe444ade006a7928b0c436596eeac20510a995b5c194ebbb66ce12edef1acb4c062a3bdef66fb35a5e6
7
- data.tar.gz: 002f44a7671b4fc529d7973cf66ef533eb00b1a7603b2d788a81f93f48daa0db56aa76f7040571901423352e29956b15b11116948d5f1fb9cb598cf7e2f04590
6
+ metadata.gz: b11ed6e3233d6e92c95cf2981236f806d91a985544d83872a20a8bcd9cf2f06e17814ca2dfa1dfdb7031e639950afa97822079ba9b68dc36d76426cbfd6065b5
7
+ data.tar.gz: dfa730ff66075b589c2a67fb6513fad839a6f60b01335b4eaff67599149822a2071467f1302ec4798235510a3baae77212f75cf02307543fbb3346839f7e0bb0
@@ -12,11 +12,11 @@ module Motor
12
12
  render_ui
13
13
  end
14
14
 
15
- def new
15
+ def show
16
16
  render_ui
17
17
  end
18
18
 
19
- def show
19
+ def new
20
20
  render_ui
21
21
  end
22
22
 
@@ -11,7 +11,7 @@ module Motor
11
11
  has_many :taggable_tags, as: :taggable, dependent: :destroy
12
12
  has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
13
13
 
14
- attribute :preferences, default: -> { HashWithIndifferentAccess.new }
14
+ attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
15
15
  serialize :preferences, HashSerializer
16
16
 
17
17
  scope :active, -> { where(deleted_at: nil) }
@@ -4,8 +4,8 @@ module Motor
4
4
  class ApiConfig < ::Motor::ApplicationRecord
5
5
  encrypts :credentials if defined?(::Motor::EncryptedConfig)
6
6
 
7
- attribute :preferences, default: -> { HashWithIndifferentAccess.new }
8
- attribute :credentials, default: -> { HashWithIndifferentAccess.new }
7
+ attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
8
+ attribute :credentials, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
9
9
 
10
10
  serialize :credentials, Motor::HashSerializer
11
11
  serialize :preferences, Motor::HashSerializer
@@ -9,7 +9,7 @@ module Motor
9
9
  has_many :taggable_tags, as: :taggable, dependent: :destroy
10
10
  has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
11
11
 
12
- attribute :preferences, default: -> { HashWithIndifferentAccess.new }
12
+ attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
13
13
  serialize :preferences, HashSerializer
14
14
 
15
15
  scope :active, -> { where(deleted_at: nil) }
@@ -10,7 +10,7 @@ module Motor
10
10
  has_many :taggable_tags, as: :taggable, dependent: :destroy
11
11
  has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
12
12
 
13
- attribute :preferences, default: -> { HashWithIndifferentAccess.new }
13
+ attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
14
14
  serialize :preferences, HashSerializer
15
15
 
16
16
  scope :active, -> { where(deleted_at: nil) }
@@ -10,7 +10,7 @@ module Motor
10
10
  has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
11
11
  has_many :alerts, dependent: :destroy
12
12
 
13
- attribute :preferences, default: -> { HashWithIndifferentAccess.new }
13
+ attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
14
14
  serialize :preferences, HashSerializer
15
15
 
16
16
  scope :active, -> { where(deleted_at: nil) }
@@ -4,7 +4,7 @@ module Motor
4
4
  class Resource < ::Motor::ApplicationRecord
5
5
  audited
6
6
 
7
- attribute :preferences, default: -> { HashWithIndifferentAccess.new }
7
+ attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
8
8
  serialize :preferences, HashSerializer
9
9
  end
10
10
  end
data/config/routes.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Motor::Admin.routes.draw do
4
4
  namespace :motor, path: '' do
5
- mount ActionCable.server => '/cable', as: :cabel if defined?(ActionCable)
5
+ mount ActionCable.server => '/cable', as: :cable if defined?(ActionCable)
6
6
 
7
7
  scope 'api', as: :api do
8
8
  resources :run_queries, only: %i[show create]
@@ -22,4 +22,4 @@ module Motor
22
22
  end
23
23
  end
24
24
 
25
- ActiveRecord::Base.extend(Motor::ActiveRecordUtils::DefinedScopesExtension)
25
+ ActiveSupport.on_load(:active_record) { extend Motor::ActiveRecordUtils::DefinedScopesExtension }
data/lib/motor/admin.rb CHANGED
@@ -121,8 +121,8 @@ module Motor
121
121
 
122
122
  if !Motor::ApiConfig.table_exists? || !Motor::Note.table_exists?
123
123
  puts
124
- puts ' => Run `rails g motor:upgrade && rake db:migrate`' \
125
- ' to perform data migration and enable the latest features'
124
+ puts ' => Run `rails g motor:upgrade && rake db:migrate` ' \
125
+ 'to perform data migration and enable the latest features'
126
126
  puts
127
127
 
128
128
  raise
data/lib/motor/alerts.rb CHANGED
@@ -27,7 +27,7 @@ module Motor
27
27
 
28
28
  column_index = result.columns.find_index { |c| c[:name] == column_name }
29
29
 
30
- emails = result.data.map { |row| row[column_index] }.uniq
30
+ emails = result.data.pluck(column_index).uniq
31
31
 
32
32
  emails.each do |email|
33
33
  Motor::AlertsMailer.alert_email(alert, email: email).deliver_now!
@@ -148,7 +148,7 @@ module Motor
148
148
  def load_configs(cache_keys)
149
149
  resources = Motor::Configs::LoadFromCache.load_resources(cache_key: cache_keys[:resources])
150
150
 
151
- resources.each_with_object(HashWithIndifferentAccess.new) do |resource, acc|
151
+ resources.each_with_object(ActiveSupport::HashWithIndifferentAccess.new) do |resource, acc|
152
152
  acc[resource.name] = resource.preferences
153
153
  end
154
154
  end
@@ -77,7 +77,7 @@ module Motor
77
77
 
78
78
  def normalize_hash(value)
79
79
  case value
80
- when Hash, HashWithIndifferentAccess
80
+ when Hash, ActiveSupport::HashWithIndifferentAccess
81
81
  value.to_h.stringify_keys.transform_values { |v| normalize_hash(v) }
82
82
  when Array
83
83
  value.map { |e| normalize_hash(e) }
@@ -44,7 +44,7 @@ module Motor
44
44
  audits_count: Motor::Audit.count,
45
45
  i18n: i18n_data,
46
46
  base_path: Motor::Admin.routes.url_helpers.motor_path,
47
- cabel_path: Motor::Admin.routes.url_helpers.try(:motor_cabel_path),
47
+ cable_path: Motor::Admin.routes.url_helpers.try(:motor_cable_path),
48
48
  admin_settings_path: Rails.application.routes.url_helpers.try(:admin_settings_general_path),
49
49
  schema: Motor::BuildSchema.call(cache_keys, current_ability),
50
50
  header_links: header_links_data_hash(current_user, current_ability, configs_cache_key),
@@ -3,7 +3,7 @@
3
3
  module Motor
4
4
  module Configs
5
5
  module LoadFromCache
6
- CACHE_HASH = HashWithIndifferentAccess.new
6
+ CACHE_HASH = ActiveSupport::HashWithIndifferentAccess.new
7
7
 
8
8
  module_function
9
9
 
@@ -47,17 +47,15 @@ module Motor
47
47
 
48
48
  display_value = note.record.attributes[configs['display_column']]
49
49
 
50
- I18n.t('new_mention_for',
50
+ I18n.t('motor.new_mention_for',
51
51
  resource: ["#{configs['display_name'].singularize} ##{note.record[note.record.class.primary_key]}",
52
- display_value].join(' '),
53
- scope: :motor)
52
+ display_value].join(' '))
54
53
  end
55
54
 
56
55
  def build_mention_description(note, current_user)
57
- I18n.t('user_mentioned_you_with_note',
56
+ I18n.t('motor.user_mentioned_you_with_note',
58
57
  user: current_user&.email || 'Anonymous',
59
- note: note.body.truncate(NOTIFICATION_DESCRIPTION_LIMIT),
60
- scope: :motor)
58
+ note: note.body.truncate(NOTIFICATION_DESCRIPTION_LIMIT))
61
59
  end
62
60
 
63
61
  def fetch_users_class(current_user)
@@ -39,10 +39,9 @@ module Motor
39
39
 
40
40
  display_value = note.record.attributes[configs['display_column']]
41
41
 
42
- I18n.t('new_reminder_for',
42
+ I18n.t('motor.new_reminder_for',
43
43
  resource: ["#{configs['display_name'].singularize} ##{note.record[note.record.class.primary_key]}",
44
- display_value].join(' '),
45
- scope: :motor)
44
+ display_value].join(' '))
46
45
  end
47
46
  end
48
47
  end
@@ -29,7 +29,7 @@ module Motor
29
29
  end
30
30
 
31
31
  def parse_tag_names(note)
32
- note.body.scan(TAG_REGEXP).map { |tag| tag[1..] }
32
+ note.body.scan(TAG_REGEXP).pluck(1..)
33
33
  end
34
34
  end
35
35
  end
@@ -12,7 +12,7 @@ module Motor
12
12
 
13
13
  REMINDER_NOTIFICATIONS_JOIN_SQL = <<~SQL.squish
14
14
  LEFT JOIN motor_notifications
15
- ON motor_notifications.record_id = motor_reminders.id
15
+ ON cast(motor_notifications.record_id as int) = motor_reminders.id
16
16
  AND motor_notifications.record_type = 'Motor::Reminder'
17
17
  SQL
18
18
 
@@ -3,7 +3,7 @@
3
3
  module Motor
4
4
  module Resources
5
5
  module FetchConfiguredModel
6
- CACHE_HASH = HashWithIndifferentAccess.new
6
+ CACHE_HASH = ActiveSupport::HashWithIndifferentAccess.new
7
7
 
8
8
  HAS_AND_BELONGS_TO_MANY_JOIN_MODEL_PREFIX = 'HABTM_'
9
9
 
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.4.3'
4
+ VERSION = '0.4.5'
5
5
  end
@@ -3964,9 +3964,9 @@
3964
3964
  "images/layers-2x.png": "images/layers-2x.png",
3965
3965
  "images/layers.png": "images/layers.png",
3966
3966
  "images/marker-icon.png": "images/marker-icon.png",
3967
- "main-ef8d17c17507c8301bda.css.gz": "main-ef8d17c17507c8301bda.css.gz",
3968
- "main-ef8d17c17507c8301bda.js.LICENSE.txt": "main-ef8d17c17507c8301bda.js.LICENSE.txt",
3969
- "main-ef8d17c17507c8301bda.js.gz": "main-ef8d17c17507c8301bda.js.gz",
3970
- "main.css": "main-ef8d17c17507c8301bda.css",
3971
- "main.js": "main-ef8d17c17507c8301bda.js"
3967
+ "main-947a9a9c3b6ed918c60d.css.gz": "main-947a9a9c3b6ed918c60d.css.gz",
3968
+ "main-947a9a9c3b6ed918c60d.js.LICENSE.txt": "main-947a9a9c3b6ed918c60d.js.LICENSE.txt",
3969
+ "main-947a9a9c3b6ed918c60d.js.gz": "main-947a9a9c3b6ed918c60d.js.gz",
3970
+ "main.css": "main-947a9a9c3b6ed918c60d.css",
3971
+ "main.js": "main-947a9a9c3b6ed918c60d.js"
3972
3972
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-24 00:00:00.000000000 Z
11
+ date: 2023-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ar_lazy_preload
@@ -2235,8 +2235,8 @@ files:
2235
2235
  - ui/dist/images/layers-2x.png
2236
2236
  - ui/dist/images/layers.png
2237
2237
  - ui/dist/images/marker-icon.png
2238
- - ui/dist/main-ef8d17c17507c8301bda.css.gz
2239
- - ui/dist/main-ef8d17c17507c8301bda.js.gz
2238
+ - ui/dist/main-947a9a9c3b6ed918c60d.css.gz
2239
+ - ui/dist/main-947a9a9c3b6ed918c60d.js.gz
2240
2240
  - ui/dist/manifest.json
2241
2241
  homepage:
2242
2242
  licenses:
@@ -2265,7 +2265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2265
2265
  - !ruby/object:Gem::Version
2266
2266
  version: '0'
2267
2267
  requirements: []
2268
- rubygems_version: 3.3.3
2268
+ rubygems_version: 3.4.1
2269
2269
  signing_key:
2270
2270
  specification_version: 4
2271
2271
  summary: Low-code Admin panel and Business intelligence