forest_admin_datasource_toolkit 1.0.0.pre.beta.82 → 1.0.0.pre.beta.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree_branch.rb +1 -1
- data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree_leaf.rb +3 -3
- data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/times.rb +2 -2
- data/lib/forest_admin_datasource_toolkit/components/query/filter.rb +8 -1
- data/lib/forest_admin_datasource_toolkit/components/query/filter_factory.rb +2 -2
- data/lib/forest_admin_datasource_toolkit/datasource.rb +10 -1
- data/lib/forest_admin_datasource_toolkit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3550cad39d6cdb44ffa071b6f872831a7f84ccdfc98303385c4d0f5c6071f865
|
4
|
+
data.tar.gz: b3cce92750ed549ad2ea34e08cf7ae77ba62518b6b867b492c0fe78233769b27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 130de0d0e11b0711fe4baaf61d33da6ed9f2411c64c10dad468d66635e02b65d8f7edc56fa1e9b4d8b3dd6117b570c13af42d5356fa15a5c16e286b7238e8d25
|
7
|
+
data.tar.gz: c2e8760294b55455e567c3bbd85b7350825034ec671f3ff200428042a56219f12273de101cd0c2b46514c45eb30352fa29249c7000673a2706148d5ab77af7eb
|
@@ -40,9 +40,9 @@ module ForestAdminDatasourceToolkit
|
|
40
40
|
|
41
41
|
case @operator
|
42
42
|
when Operators::BLANK
|
43
|
-
override(operator: Operators::BLANK)
|
44
|
-
when Operators::PRESENT
|
45
43
|
override(operator: Operators::PRESENT)
|
44
|
+
when Operators::PRESENT
|
45
|
+
override(operator: Operators::BLANK)
|
46
46
|
else
|
47
47
|
raise ForestException, "Operator: #{@operator} cannot be inverted."
|
48
48
|
end
|
@@ -133,7 +133,7 @@ module ForestAdminDatasourceToolkit
|
|
133
133
|
ConditionTreeLeaf.new(
|
134
134
|
args[:field] || @field,
|
135
135
|
args[:operator] || @operator,
|
136
|
-
args[:value]
|
136
|
+
args[:value].nil? ? @value : args[:value]
|
137
137
|
)
|
138
138
|
end
|
139
139
|
|
data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/times.rb
CHANGED
@@ -14,7 +14,7 @@ module ForestAdminDatasourceToolkit
|
|
14
14
|
def self.compare(operator)
|
15
15
|
{
|
16
16
|
depends_on: [operator],
|
17
|
-
for_types: [
|
17
|
+
for_types: %w[Date Dateonly],
|
18
18
|
replacer: proc { |leaf, tz|
|
19
19
|
leaf.override(operator: operator, value: format(yield(Time.now.in_time_zone(tz), leaf.value)))
|
20
20
|
}
|
@@ -24,7 +24,7 @@ module ForestAdminDatasourceToolkit
|
|
24
24
|
def self.interval(start_fn, end_fn)
|
25
25
|
{
|
26
26
|
depends_on: [Operators::LESS_THAN, Operators::GREATER_THAN],
|
27
|
-
for_types: [
|
27
|
+
for_types: %w[Date Dateonly],
|
28
28
|
replacer: proc do |leaf, tz|
|
29
29
|
value_greater_than = if leaf.value.nil?
|
30
30
|
format(start_fn.call(Time.now.in_time_zone(tz)))
|
@@ -4,7 +4,14 @@ module ForestAdminDatasourceToolkit
|
|
4
4
|
class Filter
|
5
5
|
attr_reader :condition_tree, :segment, :sort, :search, :search_extended, :page
|
6
6
|
|
7
|
-
def initialize(
|
7
|
+
def initialize(
|
8
|
+
condition_tree: nil,
|
9
|
+
search: nil,
|
10
|
+
search_extended: nil,
|
11
|
+
segment: nil,
|
12
|
+
sort: nil,
|
13
|
+
page: nil
|
14
|
+
)
|
8
15
|
@condition_tree = condition_tree
|
9
16
|
@search = search
|
10
17
|
@search_extended = search_extended
|
@@ -33,9 +33,9 @@ module ForestAdminDatasourceToolkit
|
|
33
33
|
when Operators::TODAY
|
34
34
|
leaf.override(operator: Operators::YESTERDAY)
|
35
35
|
when Operators::PREVIOUS_X_DAYS
|
36
|
-
get_previous_x_days_period(leaf, timezone,
|
36
|
+
get_previous_x_days_period(leaf, timezone, Operators::PREVIOUS_X_DAYS)
|
37
37
|
when Operators::PREVIOUS_X_DAYS_TO_DATE
|
38
|
-
get_previous_x_days_period(leaf, timezone,
|
38
|
+
get_previous_x_days_period(leaf, timezone, Operators::PREVIOUS_X_DAYS_TO_DATE)
|
39
39
|
else
|
40
40
|
leaf
|
41
41
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module ForestAdminDatasourceToolkit
|
2
2
|
class Datasource < Components::Contracts::DatasourceContract
|
3
|
-
attr_reader :collections, :schema
|
3
|
+
attr_reader :collections, :schema, :live_query_connections
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
super
|
7
7
|
@schema = { charts: [] }
|
8
8
|
@collections = {}
|
9
|
+
@live_query_connections = {}
|
9
10
|
end
|
10
11
|
|
11
12
|
def get_collection(name)
|
@@ -25,5 +26,13 @@ module ForestAdminDatasourceToolkit
|
|
25
26
|
def render_chart(_caller, name)
|
26
27
|
raise Exceptions::ForestException, "No chart named #{name} exists on this datasource."
|
27
28
|
end
|
29
|
+
|
30
|
+
def execute_native_query(_connection_name, _query, _binds)
|
31
|
+
raise Exceptions::ForestException, 'this datasource do not support native query.'
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_binding_symbol(_connection_name, _binds)
|
35
|
+
raise Exceptions::ForestException, 'this datasource do not support native query.'
|
36
|
+
end
|
28
37
|
end
|
29
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_admin_datasource_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.beta.
|
4
|
+
version: 1.0.0.pre.beta.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-12-
|
12
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|