ecoportal-api-v2 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -3
- data/lib/ecoportal/api/common/content.rb +1 -0
- data/lib/ecoportal/api/common/content/array_model.rb +8 -6
- data/lib/ecoportal/api/common/content/collection_model.rb +10 -4
- data/lib/ecoportal/api/common/content/double_model.rb +11 -0
- data/lib/ecoportal/api/common/content/hash_diff_patch.rb +31 -19
- data/lib/ecoportal/api/common/content/model_helpers.rb +36 -0
- data/lib/ecoportal/api/v2/page.rb +1 -0
- data/lib/ecoportal/api/v2/page/component.rb +33 -3
- data/lib/ecoportal/api/v2/page/component/action.rb +13 -5
- data/lib/ecoportal/api/v2/page/component/action_field.rb +37 -2
- data/lib/ecoportal/api/v2/page/component/chart_field.rb +39 -5
- data/lib/ecoportal/api/v2/page/component/chart_field/benchmark.rb +9 -7
- data/lib/ecoportal/api/v2/page/component/chart_field/config.rb +23 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/frequency.rb +3 -4
- data/lib/ecoportal/api/v2/page/component/chart_field/heatmap.rb +1 -3
- data/lib/ecoportal/api/v2/page/component/chart_field/indicator.rb +4 -5
- data/lib/ecoportal/api/v2/page/component/chart_field/multiseries.rb +3 -5
- data/lib/ecoportal/api/v2/page/component/chart_field/sankey.rb +1 -3
- data/lib/ecoportal/api/v2/page/component/chart_field/serie.rb +3 -4
- data/lib/ecoportal/api/v2/page/component/chart_field/series_config.rb +5 -7
- data/lib/ecoportal/api/v2/page/component/chart_fr_field.rb +7 -5
- data/lib/ecoportal/api/v2/page/component/checklist_field.rb +1 -1
- data/lib/ecoportal/api/v2/page/component/checklist_item.rb +3 -2
- data/lib/ecoportal/api/v2/page/component/date_field.rb +71 -4
- data/lib/ecoportal/api/v2/page/component/file.rb +3 -2
- data/lib/ecoportal/api/v2/page/component/gauge_field.rb +2 -2
- data/lib/ecoportal/api/v2/page/component/geo_coordinates.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/geo_field.rb +4 -1
- data/lib/ecoportal/api/v2/page/component/images_field.rb +57 -1
- data/lib/ecoportal/api/v2/page/component/people_field.rb +102 -4
- data/lib/ecoportal/api/v2/page/component/plain_text_field.rb +34 -2
- data/lib/ecoportal/api/v2/page/component/reference_field.rb +32 -3
- data/lib/ecoportal/api/v2/page/component/selection_field.rb +59 -3
- data/lib/ecoportal/api/v2/page/component/selection_option.rb +2 -1
- data/lib/ecoportal/api/v2/page/component/tag_field.rb +31 -1
- data/lib/ecoportal/api/v2/page/components.rb +8 -3
- data/lib/ecoportal/api/v2/page/permission_flags.rb +67 -0
- data/lib/ecoportal/api/v2/page/section.rb +65 -5
- data/lib/ecoportal/api/v2/page/sections.rb +64 -6
- data/lib/ecoportal/api/v2/page/stage.rb +10 -6
- data/lib/ecoportal/api/v2/page/stages.rb +2 -2
- data/lib/ecoportal/api/v2/pages/page_stage.rb +0 -1
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5833ea731a9d1360c346264d234ce9f95266db92a5480180a17f413459f196de
|
4
|
+
data.tar.gz: f3ef175580d2ab47c0ee7f51dc2731c0b42bd27ffa9f59600fb506d5cde38a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52064ec37a32470e699f846ac1c6c57f8f535fb0be1d689a4f086836a47f9fb2805c0f84533842f5aaa4ee9e538c60e61c1569177ae16a015520c65248347174
|
7
|
+
data.tar.gz: 0f8cd291558cad37b5157dba7ffdea6670548952b6aa5b0c90b34820abd2693d8f484009265bbc4c8c83fb46684f2968e9a40d4a65563e0ffc6704cca30885d0
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,43 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [0.8.
|
4
|
+
## [0.8.9] - 2021-06-xx
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- `Ecoportal::API::Common::Content::ModelHelpers`
|
8
|
+
- Starting with `#same_string?`, this lib aims to offer a full set of helper comparers.
|
9
|
+
- `Ecoportal::API::V2::Page::Components#get_by_id`
|
10
|
+
- In future changes, method `[]` might be overriding the method of the parent class `CollectionModel`.
|
11
|
+
- `Ecoportal::API::V2::Page::PermissionFlags` to offer support to `can_permission`, `subscribed`, etc.
|
12
|
+
- `Ecoportal::API::V2::Page::Section#add_component` super handy helper to add fields to sections.
|
13
|
+
- `Ecoportal::API::V2::Page::Component::PeopleField#delete` to remove people using their ids.
|
14
|
+
- `Ecoportal::API::V2::Page::Component::GeoField` **added** suport for `#coordinates`
|
15
|
+
- With embedded object `Ecoportal::API::V2::Page::Component::GeoCoordinates`
|
16
|
+
- `#configure` method, to all the `Component` types (but `ChartField` s)
|
17
|
+
- This method allows to quickly set field properties.
|
18
|
+
- `Ecoportal::API::V2::Page::Sections#between`, aiming to obtain sections between two other ones
|
19
|
+
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
- `Ecoportal::API::V2::Page::Section` real support for `split` sections (right vs left)
|
23
|
+
- This is actually a **FIX**
|
24
|
+
- `Ecoportal::API::V2::Page::Component::DateField#create_event`
|
25
|
+
- Now it switches to _allow future dates_
|
26
|
+
- `Ecoportal::API::V2::Page::Component::SelectionField#add_option`, the `name` parameter is now optional
|
27
|
+
- This change aims to make it consistent with the back-end.
|
28
|
+
- To its actual `Boolean` type some properties
|
29
|
+
- All `Component` types
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
- `Ecoportal::API::Common::Content::HashDiffPatch` did not support `Hash` values without `id` or `patch_ver`
|
33
|
+
- This fix should allow them to flow to the update
|
34
|
+
- `Ecoportal::API::V2::Page::Component::ChartField` did not have `doc` for `mode` based configuration
|
35
|
+
- `Ecoportal::API::Common::Content::ArrayModel#insert_one`
|
36
|
+
- When `pos`, `before` & `after` were `nil` it was failing to attach the element.
|
37
|
+
- `Ecoportal::API::V2::Page::Sections#add` was not adding in the correct order
|
38
|
+
- `Ecoportal::API::V2::Page::Section.new_doc` was unnecessarily giving `9999` as default weight
|
39
|
+
|
40
|
+
## [0.8.8] - 2021-08-03
|
5
41
|
|
6
42
|
### Added
|
7
43
|
- `Ecoportal::API::V2::Page::Component::ChartField::Benchmark`
|
@@ -10,8 +46,7 @@ All notable changes to this project will be documented in this file.
|
|
10
46
|
|
11
47
|
### Changed
|
12
48
|
- Removed `Stages.ordered_stages`: detected bug with Enumerable iteration
|
13
|
-
|
14
|
-
### Fixed
|
49
|
+
|
15
50
|
|
16
51
|
## [0.8.7] - 2021-05-25
|
17
52
|
|
@@ -9,6 +9,7 @@ end
|
|
9
9
|
|
10
10
|
require 'ecoportal/api/common/content/class_helpers'
|
11
11
|
require 'ecoportal/api/common/content/string_digest'
|
12
|
+
require 'ecoportal/api/common/content/model_helpers'
|
12
13
|
require 'ecoportal/api/common/content/double_model'
|
13
14
|
require 'ecoportal/api/common/content/array_model'
|
14
15
|
require 'ecoportal/api/common/content/collection_model'
|
@@ -3,7 +3,8 @@ module Ecoportal
|
|
3
3
|
module Common
|
4
4
|
module Content
|
5
5
|
# Class to handle a plain Array embedded in a Hashed model.
|
6
|
-
# @note
|
6
|
+
# @note
|
7
|
+
# - Its purpose is to handle an Array of basic objects (i.e. `Date`, `String`, `Number`)
|
7
8
|
class ArrayModel < Content::DoubleModel
|
8
9
|
class TypeMismatchedComparison < Exception
|
9
10
|
def initialize (this: nil, that: msg = "Trying to compare objects with different behavior.")
|
@@ -222,15 +223,16 @@ module Ecoportal
|
|
222
223
|
def insert_one(value, pos: NOT_USED, before: NOT_USED, after: NOT_USED)
|
223
224
|
i = index(value)
|
224
225
|
return i if (i && uniq?)
|
225
|
-
|
226
226
|
pos = case
|
227
227
|
when used_param?(pos)
|
228
|
-
pos
|
228
|
+
pos || length
|
229
229
|
when used_param?(before)
|
230
|
-
index(before)
|
230
|
+
before ? index(before) : length
|
231
231
|
when used_param?(after)
|
232
|
-
if
|
233
|
-
i + 1
|
232
|
+
if after
|
233
|
+
if i = index(after) then i + 1 end
|
234
|
+
else
|
235
|
+
length
|
234
236
|
end
|
235
237
|
else
|
236
238
|
length
|
@@ -2,6 +2,9 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
module Common
|
4
4
|
module Content
|
5
|
+
# CollectionModel aims to deal with Arrays of actual objects.
|
6
|
+
# @note to be able to refer to the correct element of the Collection,
|
7
|
+
# it is required that those elements have a unique `key` that allows to identify them
|
5
8
|
class CollectionModel < Content::DoubleModel
|
6
9
|
|
7
10
|
class << self
|
@@ -167,6 +170,7 @@ module Ecoportal
|
|
167
170
|
end
|
168
171
|
end
|
169
172
|
|
173
|
+
# Deletes `value` from this `CollectionModel` instance
|
170
174
|
def delete!(value)
|
171
175
|
unless value.is_a?(Hash) || value.is_a?(Content::DoubleModel)
|
172
176
|
raise "'Content::DoubleModel' or 'Hash' doc required"
|
@@ -186,7 +190,7 @@ module Ecoportal
|
|
186
190
|
variables_remove!
|
187
191
|
end
|
188
192
|
|
189
|
-
# Gets the `key` of the object
|
193
|
+
# Gets the `key` of the object `value`
|
190
194
|
def get_key(value)
|
191
195
|
case value
|
192
196
|
when Content::DoubleModel
|
@@ -235,10 +239,13 @@ module Ecoportal
|
|
235
239
|
super
|
236
240
|
end
|
237
241
|
|
242
|
+
# Deletes `value` from `doc` (here referred as `_doc_items`)
|
243
|
+
# @return [Object] the element deleted from `doc`
|
238
244
|
def _doc_delete(value)
|
239
245
|
if current_pos = _doc_key(value)
|
240
|
-
_doc_items.delete_at(current_pos)
|
241
|
-
|
246
|
+
_doc_items.delete_at(current_pos).tap do |deleted|
|
247
|
+
on_change
|
248
|
+
end
|
242
249
|
end
|
243
250
|
end
|
244
251
|
|
@@ -250,7 +257,6 @@ module Ecoportal
|
|
250
257
|
when used_param?(before)
|
251
258
|
_doc_key(before)
|
252
259
|
when used_param?(after)
|
253
|
-
#puts "to add after #{after.id}"
|
254
260
|
if i = _doc_key(after)
|
255
261
|
i + 1
|
256
262
|
end
|
@@ -10,6 +10,7 @@ module Ecoportal
|
|
10
10
|
class DoubleModel < Common::BaseModel
|
11
11
|
NOT_USED = Common::Content::ClassHelpers::NOT_USED
|
12
12
|
extend Common::Content::ClassHelpers
|
13
|
+
include Common::Content::ModelHelpers
|
13
14
|
|
14
15
|
class UnlinkedModel < Exception
|
15
16
|
def initialize (msg = "Something went wrong when linking the document.", from: nil, key: nil)
|
@@ -109,6 +110,16 @@ module Ecoportal
|
|
109
110
|
self
|
110
111
|
end
|
111
112
|
|
113
|
+
# To link as a `Boolean` to a subjacent `Hash` model property
|
114
|
+
# @param read_only [Boolean] should it only define the reader?
|
115
|
+
def passboolean(*methods, read_only: false)
|
116
|
+
pass_reader(*methods) {|value| value}
|
117
|
+
unless read_only
|
118
|
+
pass_writer(*methods) {|value| !!value}
|
119
|
+
end
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
112
123
|
# To link as plain `Array` to a subjacent `Hash` model property
|
113
124
|
# @param order_matters [Boolean] does the order matter
|
114
125
|
# @param uniq [Boolean] should it contain unique elements
|
@@ -85,31 +85,43 @@ module Ecoportal
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def patch_delete(b)
|
88
|
-
return NO_CHANGES unless b.is_a?(Hash)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
return NO_CHANGES unless b.is_a?(Hash)
|
89
|
+
if id = get_id(b, exception: false)
|
90
|
+
{
|
91
|
+
"id" => id,
|
92
|
+
"operation" => "deleted",
|
93
|
+
"data" => patch_data(b, delete: true)
|
94
|
+
}
|
95
|
+
else
|
96
|
+
nil
|
97
|
+
end
|
94
98
|
end
|
95
99
|
|
96
100
|
def patch_new(a)
|
97
|
-
return NO_CHANGES unless a.is_a?(Hash)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
101
|
+
return NO_CHANGES unless a.is_a?(Hash)
|
102
|
+
if id = get_id(a, exception: false)
|
103
|
+
{
|
104
|
+
"id" => id,
|
105
|
+
"operation" => "new",
|
106
|
+
"data" => patch_data(a)
|
107
|
+
}
|
108
|
+
else
|
109
|
+
a
|
110
|
+
end
|
103
111
|
end
|
104
112
|
|
105
113
|
def patch_update(a, b)
|
106
|
-
return NO_CHANGES unless a.is_a?(Hash)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
114
|
+
return NO_CHANGES unless a.is_a?(Hash)
|
115
|
+
if id = get_id(a, exception: false)
|
116
|
+
{
|
117
|
+
"id" => id,
|
118
|
+
"operation" => "changed",
|
119
|
+
"data" => patch_data(a, b)
|
120
|
+
}.tap do |update_hash|
|
121
|
+
return nil unless update_hash["data"] != NO_CHANGES
|
122
|
+
end
|
123
|
+
else
|
124
|
+
a
|
113
125
|
end
|
114
126
|
end
|
115
127
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
module Common
|
4
|
+
module Content
|
5
|
+
module ModelHelpers
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
# Offers multiple ways to compare two strings
|
10
|
+
def same_string?(value1, value2, exact: false)
|
11
|
+
case
|
12
|
+
when value1.is_a?(String) && value2.is_a?(String)
|
13
|
+
if exact
|
14
|
+
value1 == value2
|
15
|
+
else
|
16
|
+
value1.to_s.strip.downcase == value2.to_s.strip.downcase
|
17
|
+
end
|
18
|
+
when value1.is_a?(Regexp) && value2.is_a?(String)
|
19
|
+
value2 =~ value1
|
20
|
+
when value1.is_a?(String) && value2.is_a?(Regexp)
|
21
|
+
value1 =~ value2
|
22
|
+
else
|
23
|
+
value1 == value2
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def hash_except(hash, *keys)
|
28
|
+
keys.each {|key| hash.delete(key)}
|
29
|
+
hash
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -59,7 +59,6 @@ module Ecoportal
|
|
59
59
|
when "checklist"
|
60
60
|
checklist_field_class
|
61
61
|
when "page_action","checklist_task"
|
62
|
-
#doc["type"] = "checklist_task"
|
63
62
|
action_field_class
|
64
63
|
when "file"
|
65
64
|
files_field_class
|
@@ -85,8 +84,9 @@ module Ecoportal
|
|
85
84
|
passkey :id
|
86
85
|
passthrough :patch_ver, :undeletable
|
87
86
|
passthrough :type, :label, :tooltip, :global_binding
|
88
|
-
|
89
|
-
passthrough :
|
87
|
+
passboolean :hidden, :deindex, :required
|
88
|
+
passthrough :accent
|
89
|
+
passboolean :hide_view, :hidden_on_reports, :hidden_on_mobile
|
90
90
|
passarray :refs
|
91
91
|
|
92
92
|
def ref_backend
|
@@ -107,6 +107,36 @@ module Ecoportal
|
|
107
107
|
self.class.indexable_label(label)
|
108
108
|
end
|
109
109
|
|
110
|
+
# Quick config helper
|
111
|
+
# @param conf [Symbol, Array<Symbol>]
|
112
|
+
# - `:required`
|
113
|
+
# - `:hide_view` to hide in view mode
|
114
|
+
# - `:hide_mobile` to hide in mobile app
|
115
|
+
# - `:hide_reports` to hide in reports
|
116
|
+
# - `:global` to define a global binding
|
117
|
+
def configure(*conf)
|
118
|
+
conf.each_with_object([]) do |cnf, unused|
|
119
|
+
case cnf
|
120
|
+
when :required
|
121
|
+
self.required = true
|
122
|
+
when :hide_view
|
123
|
+
self.hide_view = true
|
124
|
+
when :hide_mobile
|
125
|
+
self.hidden_on_mobile = true
|
126
|
+
when :hide_reports
|
127
|
+
self.hidden_on_reports = true
|
128
|
+
when Hash
|
129
|
+
if cnf.key?(:global)
|
130
|
+
self.global_binding = cnf[:global]
|
131
|
+
end
|
132
|
+
else
|
133
|
+
unused.push(cnf)
|
134
|
+
end
|
135
|
+
end.tap do |unused|
|
136
|
+
raise "Unsupported configuration options '#{unused}' for #{self.class}" unless unused.empty?
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
110
140
|
end
|
111
141
|
end
|
112
142
|
end
|
@@ -12,14 +12,22 @@ module Ecoportal
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
passkey :id
|
17
17
|
passthrough :patch_ver, :name
|
18
|
-
passthrough :weight, :
|
19
|
-
|
20
|
-
|
18
|
+
passthrough :weight, :other_information
|
19
|
+
passboolean :complete
|
20
|
+
|
21
21
|
passdate :created_at, read_only: true #, :completed_at
|
22
|
-
|
22
|
+
passthrough :created_by, read_only: true
|
23
|
+
passthrough :assigned_person_member_id, :assigned_person_member
|
24
|
+
|
25
|
+
passdate :due_date, :reminder_date
|
26
|
+
passboolean :overdue, read_only: true
|
27
|
+
|
28
|
+
passthrough :duration_in_days, read_only: true
|
29
|
+
passarray :file_container_ids
|
30
|
+
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
@@ -4,9 +4,9 @@ module Ecoportal
|
|
4
4
|
class Page
|
5
5
|
class Component
|
6
6
|
class ActionField < Page::Component
|
7
|
-
|
7
|
+
passboolean :create_actions
|
8
8
|
passthrough :required_number_of_completed_actions
|
9
|
-
|
9
|
+
passboolean :permits_and_rules_integration, :add_subscribed, :add_subscribed_to_tasks
|
10
10
|
|
11
11
|
embeds_many :actions, klass: "Ecoportal::API::V2::Page::Component::Action", order_key: :weight
|
12
12
|
|
@@ -30,8 +30,43 @@ module Ecoportal
|
|
30
30
|
end.map(&:first)
|
31
31
|
end
|
32
32
|
|
33
|
+
# Quick config helper
|
34
|
+
# @param conf [Symbol, Array<Symbol>]
|
35
|
+
# - `:requires` required number of completed actions
|
36
|
+
# - `:all`
|
37
|
+
# - `#Number`
|
38
|
+
def configure(*conf)
|
39
|
+
self.create_actions = true
|
40
|
+
conf.each_with_object([]) do |cnf, unused|
|
41
|
+
case cnf
|
42
|
+
when Hash
|
43
|
+
supported = [:requires]
|
44
|
+
unless (rest = hash_except(cnf.dup, *supported)).empty?
|
45
|
+
unused.push(rest)
|
46
|
+
end
|
47
|
+
if cnf.key?(:requires) then configure_required(cnf[:requires]) end
|
48
|
+
else
|
49
|
+
unused.push(cnf)
|
50
|
+
end
|
51
|
+
end.yield_self do |unused|
|
52
|
+
super(*unused)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
33
56
|
private
|
34
57
|
|
58
|
+
def configure_required(req)
|
59
|
+
self.required = true
|
60
|
+
case req
|
61
|
+
when :all, NilClass
|
62
|
+
self.required_number_of_completed_actions = "all"
|
63
|
+
when Numeric
|
64
|
+
self.required_number_of_completed_actions = req
|
65
|
+
else
|
66
|
+
# Unsupported
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
35
70
|
def fix_task_weights!
|
36
71
|
ordered_tasks.each_with_index do |task, index|
|
37
72
|
task.weight = index
|
@@ -5,10 +5,14 @@ module Ecoportal
|
|
5
5
|
class Component
|
6
6
|
class ChartField < Page::Component
|
7
7
|
passthrough :mode
|
8
|
-
|
9
|
-
passthrough :
|
8
|
+
passboolean :relative, :bounded
|
9
|
+
passthrough :relstart, :relbound
|
10
|
+
passthrough :ubound, :lbound
|
11
|
+
|
10
12
|
passthrough :filter_date_input
|
11
|
-
|
13
|
+
|
14
|
+
passthrough :user_id, :user_lookup
|
15
|
+
passboolean :lock_chart_user
|
12
16
|
|
13
17
|
embeds_one :series_config, klass: "Ecoportal::API::V2::Page::Component::ChartField::SeriesConfig"
|
14
18
|
embeds_one :frequency_config, klass: "Ecoportal::API::V2::Page::Component::ChartField::Frequency"
|
@@ -20,10 +24,18 @@ module Ecoportal
|
|
20
24
|
|
21
25
|
embeds_many :series, klass: "Ecoportal::API::V2::Page::Component::ChartField::Serie"
|
22
26
|
|
23
|
-
MODES = ["frequency", "series", "heatmap", "sankey", "indicator", "faceted_series"]
|
27
|
+
MODES = ["frequency", "series", "heatmap", "sankey", "indicator", "faceted_series", "benchmark"]
|
28
|
+
|
29
|
+
def mode=(value)
|
30
|
+
raise "Unsuported mode #{value}. Should be one of #{MODES}" unless MODES.include?(value)
|
31
|
+
config_doc(nil)
|
32
|
+
doc["mode"] = value
|
33
|
+
config_doc(config.class.new_doc)
|
34
|
+
self.mode
|
35
|
+
end
|
24
36
|
|
25
37
|
def config
|
26
|
-
case mode
|
38
|
+
case self.mode
|
27
39
|
when "frequency"
|
28
40
|
frequency_config
|
29
41
|
when "series"
|
@@ -41,6 +53,27 @@ module Ecoportal
|
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
56
|
+
private
|
57
|
+
|
58
|
+
def config_doc(value)
|
59
|
+
case self.mode
|
60
|
+
when "frequency"
|
61
|
+
doc["frequency_config"] = value
|
62
|
+
when "series"
|
63
|
+
doc["series_config"] = value
|
64
|
+
when "heatmap"
|
65
|
+
doc["heatmap_config"] = value
|
66
|
+
when "sankey"
|
67
|
+
doc["sankey_config"] = value
|
68
|
+
when "indicator"
|
69
|
+
doc["indicator_config"] = value
|
70
|
+
when "faceted_series"
|
71
|
+
doc["faceted_series_config"] = value
|
72
|
+
when "benchmark"
|
73
|
+
doc["benchmark_config"] = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
44
77
|
end
|
45
78
|
end
|
46
79
|
end
|
@@ -48,6 +81,7 @@ module Ecoportal
|
|
48
81
|
end
|
49
82
|
end
|
50
83
|
|
84
|
+
require 'ecoportal/api/v2/page/component/chart_field/config'
|
51
85
|
require 'ecoportal/api/v2/page/component/chart_field/frequency'
|
52
86
|
require 'ecoportal/api/v2/page/component/chart_field/series_config'
|
53
87
|
require 'ecoportal/api/v2/page/component/chart_field/serie'
|