diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-07 05:28:25 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-07 05:28:25 +0300 |
commit | 53c4d95a4b60ee099400db8c36ac64a68ffa37a3 (patch) | |
tree | 1a6918e045fb9d5a6fe35531854be98faafeb86f /plugins/CoreVisualizations/Visualizations | |
parent | 6eb10a35e6388c62b88d77edc5055daa519de32d (diff) |
Some work on report totals (#13555)
* some work on totals
* fix graphs
* tweak rendering of totals row
* disable evolution for totals row
* let plugins configure totals row visibility
* remove metadata
* more tweaks and make it configurable
* improve code and performance
* fix some tests
* lots of improvements
* support bandwidth and other plugins
* fix tests
* add screenshot test
* also fix existing test
* add new method supportsTotalRow
* various fixes
* Updating some expected test files.
Diffstat (limited to 'plugins/CoreVisualizations/Visualizations')
3 files changed, 37 insertions, 2 deletions
diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable.php b/plugins/CoreVisualizations/Visualizations/HtmlTable.php index 65866c8edf..adcf8e2bda 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable.php @@ -10,9 +10,9 @@ namespace Piwik\Plugins\CoreVisualizations\Visualizations; use Piwik\API\Request as ApiRequest; use Piwik\Common; +use Piwik\Metrics; use Piwik\Period; use Piwik\Plugin\Visualization; -use Piwik\View; /** * DataTable visualization that shows DataTable data in an HTML table. @@ -44,6 +44,19 @@ class HtmlTable extends Visualization $this->config->show_visualization_only = true; } + if ($this->requestConfig->idSubtable) { + $this->config->show_totals_row = false; + } + + foreach (Metrics::getMetricIdsToProcessReportTotal() as $metricId) { + $this->config->report_ratio_columns[] = Metrics::getReadableColumnName($metricId); + } + if (!empty($this->report)) { + foreach ($this->report->getMetricNamesToProcessReportTotals() as $metricName) { + $this->config->report_ratio_columns[] = $metricName; + } + } + // we do not want to get a datatable\map $period = Common::getRequestVar('period', 'day', 'string'); if (Period\Range::parseDateRange($period)) { diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php index 9fa8163a6f..266a71e1b4 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php @@ -87,6 +87,19 @@ class Config extends VisualizationConfig */ public $highlight_summary_row = false; + /** + * If true, the totals row will be hidden + * + * Default value: false + */ + public $show_totals_row = true; + + /** + * A list of columns that support showing the ratio percentage on hover + * @var array + */ + public $report_ratio_columns = array(); + public function __construct() { parent::__construct(); diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php index 2f674a5872..696569c618 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php @@ -29,6 +29,13 @@ class RequestConfig extends VisualizationRequestConfig */ public $keep_summary_row = false; + /** + * Controls whether the totals row is displayed on every page of the datatable view or not. + * + * Default value: false + */ + public $keep_totals_row = false; + public function __construct() { $this->filter_limit = PiwikConfig::getInstance()->General['datatable_default_limit']; @@ -49,11 +56,13 @@ class RequestConfig extends VisualizationRequestConfig 'filter_offset', 'filter_sort_column', 'filter_sort_order', - 'keep_summary_row' + 'keep_summary_row', + 'keep_totals_row' )); $this->addPropertiesThatCanBeOverwrittenByQueryParams(array( 'keep_summary_row', + 'keep_totals_row', )); } |