gooddata 0.6.24 → 0.6.25
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 +4 -4
- data/.rubocop.yml +54 -0
- data/CHANGELOG.md +3 -0
- data/DEPENDENCIES.md +155 -154
- data/README.md +15 -6
- data/Rakefile +5 -3
- data/dependency_decisions.yml +2 -0
- data/gooddata.gemspec +2 -3
- data/lib/gooddata/cli/cli.rb +1 -3
- data/lib/gooddata/cli/commands/auth_cmd.rb +16 -7
- data/lib/gooddata/cli/commands/project_cmd.rb +16 -178
- data/lib/gooddata/cli/shared.rb +46 -44
- data/lib/gooddata/commands/auth.rb +4 -0
- data/lib/gooddata/commands/project.rb +7 -24
- data/lib/gooddata/exceptions/object_migration.rb +4 -0
- data/lib/gooddata/exceptions/segment_not_empty.rb +18 -0
- data/lib/gooddata/extensions/object.rb +12 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +56 -9
- data/lib/gooddata/helpers/global_helpers.rb +92 -0
- data/lib/gooddata/mixins/md_finders.rb +2 -8
- data/lib/gooddata/mixins/md_grantees.rb +42 -0
- data/lib/gooddata/mixins/md_id_to_uri.rb +1 -8
- data/lib/gooddata/mixins/md_object_id.rb +1 -1
- data/lib/gooddata/mixins/md_object_indexer.rb +5 -8
- data/lib/gooddata/mixins/md_object_query.rb +2 -2
- data/lib/gooddata/mixins/not_group.rb +17 -0
- data/lib/gooddata/mixins/rest_getters.rb +2 -2
- data/lib/gooddata/mixins/rest_resource.rb +1 -0
- data/lib/gooddata/mixins/to_json.rb +11 -0
- data/lib/gooddata/mixins/uri_getter.rb +9 -0
- data/lib/gooddata/models/blueprint/anchor_field.rb +14 -0
- data/lib/gooddata/models/blueprint/project_blueprint.rb +15 -1
- data/lib/gooddata/models/blueprint/to_wire.rb +10 -0
- data/lib/gooddata/models/client.rb +178 -0
- data/lib/gooddata/models/client_synchronization_result.rb +31 -0
- data/lib/gooddata/models/client_synchronization_result_details.rb +41 -0
- data/lib/gooddata/models/datawarehouse.rb +1 -5
- data/lib/gooddata/models/domain.rb +85 -1
- data/lib/gooddata/models/execution.rb +0 -2
- data/lib/gooddata/models/execution_detail.rb +0 -2
- data/lib/gooddata/models/from_wire.rb +10 -0
- data/lib/gooddata/models/invitation.rb +1 -1
- data/lib/gooddata/models/links.rb +1 -1
- data/lib/gooddata/models/membership.rb +10 -6
- data/lib/gooddata/models/metadata.rb +98 -11
- data/lib/gooddata/models/metadata/attribute.rb +6 -7
- data/lib/gooddata/models/metadata/dashboard.rb +41 -75
- data/lib/gooddata/models/metadata/dashboard/dashboard_item.rb +20 -4
- data/lib/gooddata/models/metadata/dashboard/filter_apply_item.rb +37 -0
- data/lib/gooddata/models/metadata/dashboard/filter_item.rb +49 -0
- data/lib/gooddata/models/metadata/dashboard/geo_chart_item.rb +56 -0
- data/lib/gooddata/models/metadata/dashboard/headline_item.rb +56 -0
- data/lib/gooddata/models/metadata/dashboard/iframe_item.rb +46 -0
- data/lib/gooddata/models/metadata/dashboard/report_item.rb +49 -8
- data/lib/gooddata/models/metadata/dashboard/text_item.rb +55 -0
- data/lib/gooddata/models/metadata/dashboard_tab.rb +83 -30
- data/lib/gooddata/models/metadata/dataset.rb +0 -2
- data/lib/gooddata/models/metadata/dimension.rb +1 -3
- data/lib/gooddata/models/metadata/fact.rb +1 -3
- data/lib/gooddata/models/metadata/label.rb +1 -3
- data/lib/gooddata/models/metadata/metric.rb +11 -42
- data/lib/gooddata/models/metadata/report.rb +7 -18
- data/lib/gooddata/models/metadata/report_definition.rb +21 -113
- data/lib/gooddata/models/metadata/scheduled_mail.rb +274 -0
- data/lib/gooddata/models/metadata/scheduled_mail/dashboard_attachment.rb +62 -0
- data/lib/gooddata/models/metadata/scheduled_mail/report_attachment.rb +64 -0
- data/lib/gooddata/models/metadata/variable.rb +8 -2
- data/lib/gooddata/models/model.rb +2 -9
- data/lib/gooddata/models/process.rb +7 -29
- data/lib/gooddata/models/profile.rb +1 -1
- data/lib/gooddata/models/project.rb +131 -167
- data/lib/gooddata/models/project_creator.rb +2 -7
- data/lib/gooddata/models/project_metadata.rb +2 -10
- data/lib/gooddata/models/project_role.rb +4 -10
- data/lib/gooddata/models/report_data_result.rb +3 -5
- data/lib/gooddata/models/schedule.rb +4 -31
- data/lib/gooddata/models/segment.rb +192 -0
- data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +2 -2
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -1
- data/lib/gooddata/models/user_filters/variable_user_filter.rb +11 -0
- data/lib/gooddata/models/user_group.rb +241 -0
- data/lib/gooddata/rest/connection.rb +81 -16
- data/lib/gooddata/rest/object.rb +29 -0
- data/lib/gooddata/rest/object_factory.rb +6 -1
- data/lib/gooddata/rest/resource.rb +7 -1
- data/lib/gooddata/version.rb +1 -1
- data/spec/environment/default.rb +19 -16
- data/spec/environment/develop.rb +10 -10
- data/spec/environment/hotfix.rb +6 -6
- data/spec/environment/production.rb +14 -14
- data/spec/environment/release.rb +6 -6
- data/spec/environment/staging.rb +9 -9
- data/spec/environment/staging_3.rb +14 -15
- data/spec/integration/blueprint_with_grain_spec.rb +72 -0
- data/spec/integration/clients_spec.rb +135 -0
- data/spec/integration/date_dim_switch_spec.rb +142 -0
- data/spec/integration/full_project_spec.rb +3 -3
- data/spec/integration/project_spec.rb +20 -0
- data/spec/integration/segments_spec.rb +141 -0
- data/spec/integration/user_group_spec.rb +127 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/unit/models/domain_spec.rb +7 -1
- data/spec/unit/models/metric_spec.rb +0 -8
- data/spec/unit/models/profile_spec.rb +1 -1
- data/spec/unit/models/report_result_data_spec.rb +6 -0
- metadata +38 -38
- data/lib/gooddata/cli/commands/api_cmd.rb +0 -34
- data/lib/gooddata/cli/commands/console_cmd.rb +0 -40
- data/lib/gooddata/cli/commands/domain_cmd.rb +0 -46
- data/lib/gooddata/cli/commands/process_cmd.rb +0 -145
- data/lib/gooddata/cli/commands/projects_cmd.rb +0 -23
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +0 -77
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +0 -35
- data/lib/gooddata/cli/commands/user_cmd.rb +0 -24
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
require_relative 'dashboard_item'
|
|
8
|
+
|
|
9
|
+
module GoodData
|
|
10
|
+
class FilterApplyItem < DashboardItem
|
|
11
|
+
EMPTY_OBJECT = {
|
|
12
|
+
'filterApplyItem' => {
|
|
13
|
+
'positionX' => 0,
|
|
14
|
+
'sizeY' => 200,
|
|
15
|
+
'sizeX' => 300,
|
|
16
|
+
'positionY' => 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
def create(tab, item)
|
|
25
|
+
res = GoodData::FilterApply.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
26
|
+
item.each do |k, v|
|
|
27
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
28
|
+
end
|
|
29
|
+
res
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def initialize(tab, json)
|
|
34
|
+
super
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -8,8 +8,57 @@ require_relative 'dashboard_item'
|
|
|
8
8
|
|
|
9
9
|
module GoodData
|
|
10
10
|
class FilterItem < DashboardItem
|
|
11
|
+
EMPTY_OBJECT = {
|
|
12
|
+
'filterItem' => {
|
|
13
|
+
'positionX' => 0,
|
|
14
|
+
'sizeY' => 200,
|
|
15
|
+
'sizeX' => 300,
|
|
16
|
+
'positionY' => 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
21
|
+
:id,
|
|
22
|
+
:content_id,
|
|
23
|
+
:parent_filters
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
def create(tab, item)
|
|
28
|
+
res = GoodData::FilterItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
29
|
+
item.each do |k, v|
|
|
30
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
31
|
+
end
|
|
32
|
+
res
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
11
36
|
def initialize(tab, json)
|
|
12
37
|
super
|
|
13
38
|
end
|
|
39
|
+
|
|
40
|
+
def id
|
|
41
|
+
data['id']
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def id=(new_id)
|
|
45
|
+
data['id'] = new_id
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def content_id
|
|
49
|
+
data['contentId']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def content_id=(new_content_id)
|
|
53
|
+
data['contentId'] = new_content_id
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def parent_filters
|
|
57
|
+
data['parentFilters']
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def parent_filters=(new_parent_filters)
|
|
61
|
+
data['parentFilters'] = new_parent_filters
|
|
62
|
+
end
|
|
14
63
|
end
|
|
15
64
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
require_relative 'dashboard_item'
|
|
8
|
+
|
|
9
|
+
module GoodData
|
|
10
|
+
class GeoChartItem < DashboardItem
|
|
11
|
+
EMPTY_OBJECT = {
|
|
12
|
+
'geoChartItem' => {
|
|
13
|
+
'positionX' => 0,
|
|
14
|
+
'sizeY' => 200,
|
|
15
|
+
'sizeX' => 300,
|
|
16
|
+
'positionY' => 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
21
|
+
:id,
|
|
22
|
+
:metric,
|
|
23
|
+
:layers_base_color
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
def create(tab, item)
|
|
28
|
+
res = GoodData::GeoChartItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
29
|
+
item.each do |k, v|
|
|
30
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
31
|
+
end
|
|
32
|
+
res
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(tab, json)
|
|
37
|
+
super
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def metric
|
|
41
|
+
data['metric']
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def metric=(new_metric)
|
|
45
|
+
data['metric'] = new_metric.respond_to?(:uri) ? new_metric.uri : new_metric
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def layers_base_color
|
|
49
|
+
data['layersBaseColor']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def layers_base_color=(new_layers_base_color)
|
|
53
|
+
data['layersBaseColor'] = new_layers_base_color
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
require_relative 'dashboard_item'
|
|
8
|
+
|
|
9
|
+
module GoodData
|
|
10
|
+
class HeadlineItem < DashboardItem
|
|
11
|
+
EMPTY_OBJECT = {
|
|
12
|
+
'headlineItem' => {
|
|
13
|
+
'positionX' => 0,
|
|
14
|
+
'sizeY' => 200,
|
|
15
|
+
'sizeX' => 300,
|
|
16
|
+
'positionY' => 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
21
|
+
:id,
|
|
22
|
+
:metric,
|
|
23
|
+
:linked_with_external_filter
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
def create(tab, item)
|
|
28
|
+
res = GoodData::HeadlineItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
29
|
+
item.each do |k, v|
|
|
30
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
31
|
+
end
|
|
32
|
+
res
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(tab, json)
|
|
37
|
+
super
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def metric
|
|
41
|
+
data['metric']
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def metric=(new_metric)
|
|
45
|
+
data['metric'] = new_metric.respond_to?(:uri) ? new_metric.uri : new_metric
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def linked_with_external_filter
|
|
49
|
+
data['linkedWithExternalFilter']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def linked_with_external_filter=(new_linked_with_external_filter)
|
|
53
|
+
data['linked_with_external_filter'] = new_linked_with_external_filter ? 1 : 0
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
require_relative 'dashboard_item'
|
|
8
|
+
|
|
9
|
+
module GoodData
|
|
10
|
+
class IframeItem < DashboardItem
|
|
11
|
+
EMPTY_OBJECT = {
|
|
12
|
+
'textItem' => {
|
|
13
|
+
'positionX' => 0,
|
|
14
|
+
'sizeY' => 200,
|
|
15
|
+
'sizeX' => 300,
|
|
16
|
+
'positionY' => 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
21
|
+
:url
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
class << self
|
|
25
|
+
def create(tab, item)
|
|
26
|
+
res = GoodData::IframeItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
27
|
+
item.each do |k, v|
|
|
28
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
29
|
+
end
|
|
30
|
+
res
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def initialize(tab, json)
|
|
35
|
+
super
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def url
|
|
39
|
+
data['url']
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def url=(new_url)
|
|
43
|
+
data['url'] = new_url
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -5,19 +5,59 @@
|
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
|
6
6
|
|
|
7
7
|
require_relative 'dashboard_item'
|
|
8
|
+
require_relative '../../../helpers/global_helpers'
|
|
8
9
|
|
|
9
10
|
module GoodData
|
|
10
11
|
class ReportItem < DashboardItem
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
EMPTY_OBJECT = {
|
|
13
|
+
:reportItem => {
|
|
14
|
+
:obj => nil,
|
|
15
|
+
:sizeY => 200,
|
|
16
|
+
:sizeX => 300,
|
|
17
|
+
:style => {
|
|
18
|
+
:displayTitle => 1,
|
|
19
|
+
:background => {
|
|
20
|
+
:opacity => 0
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
:visualization => {
|
|
24
|
+
:grid => {
|
|
25
|
+
:columnWidths => []
|
|
26
|
+
},
|
|
27
|
+
:oneNumber => {
|
|
28
|
+
:labels => {}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
:positionY => 0,
|
|
32
|
+
:filters => [],
|
|
33
|
+
:positionX => 0
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
38
|
+
:filters,
|
|
39
|
+
:obj,
|
|
40
|
+
:report,
|
|
41
|
+
:style,
|
|
42
|
+
:visualization
|
|
43
|
+
]
|
|
14
44
|
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
class << self
|
|
46
|
+
def obj_uri(obj)
|
|
47
|
+
obj.respond_to?(:uri) ? obj.uri : obj
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def create(tab, item)
|
|
51
|
+
res = GoodData::ReportItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
52
|
+
item.each do |k, v|
|
|
53
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
54
|
+
end
|
|
55
|
+
res
|
|
56
|
+
end
|
|
17
57
|
end
|
|
18
58
|
|
|
19
|
-
def
|
|
20
|
-
|
|
59
|
+
def initialize(tab, json)
|
|
60
|
+
super
|
|
21
61
|
end
|
|
22
62
|
|
|
23
63
|
def obj
|
|
@@ -27,10 +67,11 @@ module GoodData
|
|
|
27
67
|
alias_method :object, :obj
|
|
28
68
|
|
|
29
69
|
def obj=(new_obj)
|
|
30
|
-
data['obj'] =
|
|
70
|
+
data['obj'] = ReportItem.obj_uri(new_obj)
|
|
31
71
|
end
|
|
32
72
|
|
|
33
73
|
alias_method :object=, :obj=
|
|
74
|
+
alias_method :report=, :obj=
|
|
34
75
|
|
|
35
76
|
def style
|
|
36
77
|
data['style']
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
require_relative 'dashboard_item'
|
|
8
|
+
|
|
9
|
+
module GoodData
|
|
10
|
+
class TextItem < DashboardItem
|
|
11
|
+
EMPTY_OBJECT = {
|
|
12
|
+
'textItem' => {
|
|
13
|
+
'positionX' => 0,
|
|
14
|
+
'sizeY' => 200,
|
|
15
|
+
'sizeX' => 300,
|
|
16
|
+
'positionY' => 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ASSIGNABLE_MEMBERS = DashboardItem::ASSIGNABLE_MEMBERS + [
|
|
21
|
+
:text,
|
|
22
|
+
:text_size
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
class << self
|
|
26
|
+
def create(tab, item)
|
|
27
|
+
res = GoodData::TextItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
28
|
+
item.each do |k, v|
|
|
29
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
30
|
+
end
|
|
31
|
+
res
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def initialize(tab, json)
|
|
36
|
+
super
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def text
|
|
40
|
+
data['text']
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def text=(new_text)
|
|
44
|
+
data['text'] = new_text
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def text_size
|
|
48
|
+
data['textSize']
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def text_size=(new_text_size)
|
|
52
|
+
data['textSize'] = new_text_size
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -5,56 +5,99 @@
|
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
|
6
6
|
|
|
7
7
|
require_relative '../../core/core'
|
|
8
|
+
require_relative '../../helpers/global_helpers'
|
|
8
9
|
require_relative '../metadata'
|
|
9
10
|
require_relative 'metadata'
|
|
10
11
|
require_relative 'report'
|
|
11
12
|
|
|
12
13
|
require 'multi_json'
|
|
13
14
|
|
|
15
|
+
require_relative 'dashboard/filter_item'
|
|
16
|
+
require_relative 'dashboard/filter_apply_item'
|
|
17
|
+
require_relative 'dashboard/geo_chart_item'
|
|
18
|
+
require_relative 'dashboard/headline_item'
|
|
19
|
+
require_relative 'dashboard/iframe_item'
|
|
20
|
+
require_relative 'dashboard/report_item'
|
|
21
|
+
require_relative 'dashboard/text_item'
|
|
22
|
+
|
|
14
23
|
module GoodData
|
|
15
24
|
class DashboardTab
|
|
16
25
|
attr_reader :dashboard
|
|
17
26
|
attr_accessor :json
|
|
18
27
|
|
|
28
|
+
EMPTY_OBJECT = {
|
|
29
|
+
:title => '',
|
|
30
|
+
:items => []
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ASSIGNABLE_MEMBERS = [
|
|
34
|
+
:title,
|
|
35
|
+
:items,
|
|
36
|
+
:identifier
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
class << self
|
|
40
|
+
def create(dashboard, tab)
|
|
41
|
+
res = GoodData::DashboardTab.new(dashboard, GoodData::Helpers.deep_dup(GoodData::Helpers.deep_stringify_keys(EMPTY_OBJECT)))
|
|
42
|
+
tab.each do |k, v|
|
|
43
|
+
res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
|
|
44
|
+
end
|
|
45
|
+
res
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
19
49
|
def initialize(dashboard, json)
|
|
20
50
|
@dashboard = dashboard
|
|
21
51
|
@json = json
|
|
22
52
|
end
|
|
23
53
|
|
|
54
|
+
def create_filter_item(item)
|
|
55
|
+
new_item = GoodData::FilterItem.create(self, item)
|
|
56
|
+
json['items'] << new_item.json
|
|
57
|
+
new_item
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def create_filter_apply_item(item)
|
|
61
|
+
new_item = GoodData::FilterApplyItem.create(self, item)
|
|
62
|
+
json['items'] << new_item.json
|
|
63
|
+
new_item
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def create_geo_chart_item(item)
|
|
67
|
+
new_item = GoodData::GeoChartItem.create(self, item)
|
|
68
|
+
json['items'] << new_item.json
|
|
69
|
+
new_item
|
|
70
|
+
end
|
|
71
|
+
alias_method :add_geo_chart_item, :create_geo_chart_item
|
|
72
|
+
|
|
73
|
+
def create_headline_item(item)
|
|
74
|
+
new_item = GoodData::HeadlineItem.create(self, item)
|
|
75
|
+
json['items'] << new_item.json
|
|
76
|
+
new_item
|
|
77
|
+
end
|
|
78
|
+
alias_method :add_headline_item, :create_headline_item
|
|
79
|
+
|
|
80
|
+
def create_iframe_item(item)
|
|
81
|
+
new_item = GoodData::IframeItem.create(self, item)
|
|
82
|
+
json['items'] << new_item.json
|
|
83
|
+
new_item
|
|
84
|
+
end
|
|
85
|
+
alias_method :add_iframe_item, :create_iframe_item
|
|
86
|
+
|
|
24
87
|
def create_report_item(item)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
new_item_json = {
|
|
28
|
-
:reportItem => {
|
|
29
|
-
:obj => report.uri,
|
|
30
|
-
:sizeY => item[:size_y] || 200,
|
|
31
|
-
:sizeX => item[:size_x] || 300,
|
|
32
|
-
:style => {
|
|
33
|
-
:displayTitle => 1,
|
|
34
|
-
:background => {
|
|
35
|
-
:opacity => 0
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
:visualization => {
|
|
39
|
-
:grid => {
|
|
40
|
-
:columnWidths => []
|
|
41
|
-
},
|
|
42
|
-
:oneNumber => {
|
|
43
|
-
:labels => {}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
:positionY => item[:position_y] || 0,
|
|
47
|
-
:filters => [],
|
|
48
|
-
:positionX => item[:position_x] || 0
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
new_item = GoodData::DashboardItem.new(self, GoodData::Helpers.deep_stringify_keys(new_item_json))
|
|
88
|
+
new_item = GoodData::ReportItem.create(self, item)
|
|
53
89
|
json['items'] << new_item.json
|
|
54
90
|
new_item
|
|
55
91
|
end
|
|
56
92
|
alias_method :add_report_item, :create_report_item
|
|
57
93
|
|
|
94
|
+
def create_text_item(item)
|
|
95
|
+
new_item = GoodData::TextItem.create(self, item)
|
|
96
|
+
json['items'] << new_item.json
|
|
97
|
+
new_item
|
|
98
|
+
end
|
|
99
|
+
alias_method :add_text_item, :create_text_item
|
|
100
|
+
|
|
58
101
|
def identifier
|
|
59
102
|
@json['identifier']
|
|
60
103
|
end
|
|
@@ -67,10 +110,20 @@ module GoodData
|
|
|
67
110
|
@json['items'].map do |item|
|
|
68
111
|
type = item.keys.first
|
|
69
112
|
case type
|
|
70
|
-
when 'reportItem'
|
|
71
|
-
GoodData::ReportItem.new(self, item)
|
|
72
113
|
when 'filterItem'
|
|
73
114
|
GoodData::FilterItem.new(self, item)
|
|
115
|
+
when 'filterApplyItem'
|
|
116
|
+
GoodData::FilterApplyItem.new(self, item)
|
|
117
|
+
when 'geoChartItem'
|
|
118
|
+
GoodData::GeoChartItem.new(self, item)
|
|
119
|
+
when 'headlineItem'
|
|
120
|
+
GoodData::HeadlineItem.new(self, item)
|
|
121
|
+
when 'iframeItem'
|
|
122
|
+
GoodData::IframeItem.new(self, item)
|
|
123
|
+
when 'reportItem'
|
|
124
|
+
GoodData::ReportItem.new(self, item)
|
|
125
|
+
when 'textItem'
|
|
126
|
+
GoodData::TextItem.new(self, item)
|
|
74
127
|
else
|
|
75
128
|
GoodData::DashboardItem.new(self, item)
|
|
76
129
|
end
|