Skip to content
Snippets Groups Projects
Commit 6e1c22b5 authored by Jiaan Louw's avatar Jiaan Louw :two: Committed by Allen Cook
Browse files

Add queryOverrides field to product analytics dashboards panels

Adds the missing queryOverrides field to product analytics dashboards
panels node.
parent af37029e
1 merge request!124065Add queryOverrides field to product analytics dashboards panels
......@@ -19846,6 +19846,7 @@ Represents a product analytics dashboard panel.
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="productanalyticsdashboardpanelgridattributes"></a>`gridAttributes` | [`JSON`](#json) | Description of the position and size of the panel. |
| <a id="productanalyticsdashboardpanelqueryoverrides"></a>`queryOverrides` | [`JSON`](#json) | Overrides for the visualization query object. |
| <a id="productanalyticsdashboardpaneltitle"></a>`title` | [`String!`](#string) | Title of the panel. |
| <a id="productanalyticsdashboardpanelvisualization"></a>`visualization` | [`ProductAnalyticsDashboardVisualization!`](#productanalyticsdashboardvisualization) | Visualization of the panel. |
 
......@@ -17,6 +17,11 @@ class PanelType < BaseObject
null: true,
description: 'Description of the position and size of the panel.'
field :query_overrides,
type: GraphQL::Types::JSON,
null: true,
description: 'Overrides for the visualization query object.'
field :visualization,
type: Types::ProductAnalytics::VisualizationType,
null: false,
......
......@@ -2,7 +2,7 @@
module ProductAnalytics
class Panel
attr_reader :title, :grid_attributes, :visualization, :project
attr_reader :title, :grid_attributes, :visualization, :project, :query_overrides
def self.from_data(panel_yaml, project)
panel_yaml.map do |panel|
......@@ -10,15 +10,17 @@ def self.from_data(panel_yaml, project)
title: panel['title'],
project: project,
grid_attributes: panel['gridAttributes'],
query_overrides: panel['queryOverrides'],
visualization: panel['visualization']
)
end
end
def initialize(title:, grid_attributes:, visualization:, project:)
def initialize(title:, grid_attributes:, visualization:, project:, query_overrides:)
@title = title
@project = project
@grid_attributes = grid_attributes
@query_overrides = query_overrides
@visualization = ::ProductAnalytics::Visualization.from_data(data: visualization, project: project)
end
end
......
......@@ -103,6 +103,14 @@
it 'is expected to contain a panel with the correct grid attributes' do
expect(subject.first.grid_attributes).to eq({ 'xPos' => 1, 'yPos' => 4, 'width' => 12, 'height' => 2 })
end
it 'is expected to contain a panel with the correct query overrides' do
expect(subject.first.query_overrides).to eq({
'timeDimensions' => {
'dateRange' => ['2016-01-01', '2016-01-30'] # rubocop:disable Style/WordArray
}
})
end
end
describe '#==' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment