avo 2.5.1 → 2.5.2.pre.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

@@ -3,9 +3,21 @@
3
3
  class Avo::CardComponent < ViewComponent::Base
4
4
  def initialize(card: nil)
5
5
  @card = card
6
+
7
+ init_card
6
8
  end
7
9
 
8
10
  def render?
9
11
  !@card.nil?
10
12
  end
13
+
14
+ # Initializing the card byt running the query method.
15
+ # We'll still keep the query block around for compatibility reasons.
16
+ def init_card
17
+ if @card.respond_to? :query
18
+ @card.query
19
+ elsif @card.query_block.present?
20
+ @card.compute_result
21
+ end
22
+ end
11
23
  end
@@ -1,3 +1,3 @@
1
1
  <div class="relative flex flex-col <%= @card.chartkick_classes %>">
2
- <%= send(@card.chart_type, @card.compute_result.result_data, **@card.chartkick_options) %>
2
+ <%= send(@card.chart_type, @card.result_data, **@card.chartkick_options) %>
3
3
  </div>
@@ -1,5 +1,5 @@
1
1
  <div class="flex mt-4 items-end">
2
2
  <span class="text-3xl"><%= @card.prefix %></span>
3
- <span class="text-5xl"><%= @card.compute_result.result_data %></span>
3
+ <span class="text-5xl"><%= @card.result_data %></span>
4
4
  <span class="text-3xl"><%= @card.suffix %></span>
5
5
  </div>
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.5.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.5.2.pre.1" unless const_defined?(:VERSION)
3
3
  end
@@ -3,7 +3,7 @@ class <%= class_name.camelize %> < Avo::Dashboards::ChartkickCard
3
3
  self.label = "<%= name.underscore.humanize %>"
4
4
  self.chart_type = :area_chart
5
5
 
6
- query do
6
+ def query
7
7
  data = 3.times.map do |index|
8
8
  {
9
9
  name: "Batch #{index}",
@@ -9,7 +9,7 @@ class <%= class_name.camelize %> < Avo::Dashboards::ChartkickCard
9
9
  # self.chart_options = { library: { plugins: { legend: { display: true } } } }
10
10
  # self.flush = true
11
11
 
12
- query do
12
+ def query
13
13
  points = 16
14
14
  i = Time.new.year.to_i - points
15
15
  base_data = Array.new(points).map do
@@ -2,7 +2,7 @@ class <%= class_name.camelize %> < Avo::Dashboards::MetricCard
2
2
  self.id = "<%= name.underscore %>"
3
3
  self.label = "<%= name.underscore.humanize %>"
4
4
 
5
- query do
5
+ def query
6
6
  result 101
7
7
  end
8
8
  end
@@ -8,7 +8,7 @@ class <%= class_name.camelize %> < Avo::Dashboards::MetricCard
8
8
  # self.prefix = ""
9
9
  # self.suffix = ""
10
10
 
11
- query do
11
+ def query
12
12
  # from = Date.today.midnight - 1.week
13
13
  # to = DateTime.current
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -248,6 +248,9 @@ files:
248
248
  - Gemfile.lock
249
249
  - README.md
250
250
  - Rakefile
251
+ - app/assets/builds/avo.css
252
+ - app/assets/builds/avo.js
253
+ - app/assets/builds/avo.js.map
251
254
  - app/assets/config/avo_manifest.js
252
255
  - app/assets/stylesheets/avo.css
253
256
  - app/assets/stylesheets/css/active-storage.css
@@ -1320,9 +1323,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1320
1323
  version: 2.4.0
1321
1324
  required_rubygems_version: !ruby/object:Gem::Requirement
1322
1325
  requirements:
1323
- - - ">="
1326
+ - - ">"
1324
1327
  - !ruby/object:Gem::Version
1325
- version: '0'
1328
+ version: 1.3.1
1326
1329
  requirements: []
1327
1330
  rubygems_version: 3.3.3
1328
1331
  signing_key: