diff options
40 files changed, 285 insertions, 33 deletions
diff --git a/core/API/DataTableManipulator/Flattener.php b/core/API/DataTableManipulator/Flattener.php index fa77449f6a..47c6f31c68 100644 --- a/core/API/DataTableManipulator/Flattener.php +++ b/core/API/DataTableManipulator/Flattener.php @@ -106,26 +106,48 @@ class Flattener extends DataTableManipulator (Row $row, $rowId, DataTable $dataTable, $level, $dimensionName, $labelPrefix = '', $parentLogo = false) { + $dimensions = $dataTable->getMetadata('dimensions'); + + if (empty($dimensions)) { + $dimensions = []; + } + + if (!in_array($dimensionName, $dimensions)) { + $dimensions[] = $dimensionName; + } + + $dataTable->setMetadata('dimensions', $dimensions); + $origLabel = $label = $row->getColumn('label'); if ($label !== false) { - $label = trim($label); + $origLabel = $label = trim($label); if ($this->recursiveLabelSeparator == '/') { if (substr($label, 0, 1) == '/' && substr($labelPrefix, -1) == '/') { - $label = substr($label, 1); + $origLabel = $label = substr($label, 1); } elseif ($rowId === DataTable::ID_SUMMARY_ROW && $labelPrefix && $label != DataTable::LABEL_SUMMARY_ROW) { $label = ' - ' . $label; } } - $origLabel = $label; + if ($rowId === DataTable::ID_SUMMARY_ROW) { + if ($row->getMetadata('url')) { + // remove url metadata for flattened summary rows + $row->deleteMetadata('url'); + } + $row->setMetadata('is_summary', true); + } $label = $labelPrefix . $label; $row->setColumn('label', $label); if ($row->getMetadata($dimensionName)) { - $origLabel = $row->getMetadata($dimensionName) . $this->recursiveLabelSeparator . $origLabel; + if ($rowId === DataTable::ID_SUMMARY_ROW && $this->recursiveLabelSeparator == '/') { + $origLabel = $row->getMetadata($dimensionName) . $this->recursiveLabelSeparator . ' - ' . $origLabel; + } else { + $origLabel = $row->getMetadata($dimensionName) . $this->recursiveLabelSeparator . $origLabel; + } } $row->setMetadata($dimensionName, $origLabel); diff --git a/plugins/Actions/tests/UI/ActionsDataTable_spec.js b/plugins/Actions/tests/UI/ActionsDataTable_spec.js index b09a55eb7c..9c9f855544 100644 --- a/plugins/Actions/tests/UI/ActionsDataTable_spec.js +++ b/plugins/Actions/tests/UI/ActionsDataTable_spec.js @@ -25,10 +25,10 @@ describe("ActionsDataTable", function () { }); it("should load subtables correctly when row clicked", async function() { - firstRow = await page.jQuery('tr.subDataTable:first'); - await firstRow.click(); secondRow = await page.jQuery('tr.subDataTable:eq(2)'); await secondRow.click(); + firstRow = await page.jQuery('tr.subDataTable:first'); + await firstRow.click(); await page.mouse.move(-10, -10); await page.waitForNetworkIdle(); diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 79fac09408..3c80765c77 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -327,6 +327,8 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'CoreHome_ExcludeRowsWithLowPopulation'; $translationKeys[] = 'CoreHome_DataTableIncludeAggregateRows'; $translationKeys[] = 'CoreHome_DataTableExcludeAggregateRows'; + $translationKeys[] = 'CoreHome_DataTableCombineDimensions'; + $translationKeys[] = 'CoreHome_DataTableShowDimensions'; $translationKeys[] = 'CoreHome_Default'; $translationKeys[] = 'CoreHome_FormatMetrics'; $translationKeys[] = 'CoreHome_ShowExportUrl'; diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index 6ee9e93600..74be5d8a10 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -252,8 +252,21 @@ $.extend(DataTable.prototype, UIControl.prototype, { var params = {}; for (var key in self.param) { - if (typeof self.param[key] != "undefined" && self.param[key] != '') + if (typeof self.param[key] != "undefined" && self.param[key] != '') { + if (key == 'filter_column' || key == 'filter_column_recursive' ) { + // search in (metadata) `combinedLabel` when dimensions are shown separately in flattened tables + // needs to be overwritten for each request as switching a searched table might return no results + // otherwise, as search column doesn't fit anymore + if (self.param.flat == "1" && self.param.show_dimensions == "1") { + params[key] = 'combinedLabel'; + } else { + params[key] = 'label'; + } + continue; + } + params[key] = self.param[key]; + } } ajaxRequest.addParams(params, 'get'); @@ -456,7 +469,7 @@ $.extend(DataTable.prototype, UIControl.prototype, { labelWidth = maxLabelWidth; // prevent for instance table in Actions-Pages is not too wide } - return parseInt(labelWidth, 10); + return parseInt(labelWidth / $('tr:nth-child(1) td.label', domElem).length, 10); } function getLabelColumnMinWidth(domElem) @@ -1322,6 +1335,13 @@ $.extend(DataTable.prototype, UIControl.prototype, { } })); + $('.dataTableShowDimensions', domElem) + .each(function () { + setText(this, 'show_dimensions', 'CoreHome_DataTableCombineDimensions', + 'CoreHome_DataTableShowDimensions'); + }) + .click(generateClickCallback('show_dimensions')); + // handle pivot by $('.dataTablePivotBySubtable', domElem) .each(function () { @@ -1437,6 +1457,16 @@ $.extend(DataTable.prototype, UIControl.prototype, { // label (first column of a data row) or not $("th:first-child", domElem).addClass('label'); $("td:first-child", domElem).addClass('label'); + + var metadata = this.getReportMetadata(); + + if (self.param.flat == "1" && self.param.show_dimensions == "1" && metadata.dimensions && Object.keys(metadata.dimensions).length > 1) { + for (var i = 1; i < Object.keys(metadata.dimensions).length; i++) { + $("th:nth-child("+(i+1)+")", domElem).addClass('label'); + $("td:nth-child("+(i+1)+")", domElem).addClass('label'); + } + } + $("tr td", domElem).addClass('column'); }, @@ -1754,7 +1784,9 @@ $.extend(DataTable.prototype, UIControl.prototype, { var details = _pk_translate('General_LearnMore', [' (<a href="https://matomo.org/faq/how-to/faq_54/" rel="noreferrer noopener" target="_blank">', '</a>)']); domElem.find('tr.summaryRow').each(function () { - var labelSpan = $(this).find('.label .value'); + var labelSpan = $(this).find('.label .value').filter(function(index, elem){ + return $(elem).text() != '-'; + }).last(); var defaultLabel = labelSpan.text(); $(this).hover(function() { @@ -1789,7 +1821,7 @@ $.extend(DataTable.prototype, UIControl.prototype, { trs.each(function () { var tr = $(this); - var td = tr.find('td:first'); + var td = tr.find('td.label:last'); // call initTr on all actions that are available for the report for (var i = 0; i < availableActionsForReport.length; i++) { @@ -1918,7 +1950,7 @@ $.extend(DataTable.prototype, UIControl.prototype, { return; } - var td = tr.find('td:first'); + var td = tr.find('td.label:last'); var actions = tr.find('div.dataTableRowActions'); if (!actions) { diff --git a/plugins/CoreHome/javascripts/dataTable_rowactions.js b/plugins/CoreHome/javascripts/dataTable_rowactions.js index 5d51e06302..9d8751293b 100644 --- a/plugins/CoreHome/javascripts/dataTable_rowactions.js +++ b/plugins/CoreHome/javascripts/dataTable_rowactions.js @@ -198,6 +198,12 @@ DataTable_RowAction.prototype.trigger = function (tr, e, subTableLabel) { /** Get the label string from a tr dom element */ DataTable_RowAction.prototype.getLabelFromTr = function (tr) { + var rowMetadata = this.getRowMetadata(tr); + + if (rowMetadata.combinedLabel) { + return '@' + rowMetadata.combinedLabel; + } + var label = tr.find('span.label'); // handle truncation diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json index cd302097eb..1c6970ce51 100644 --- a/plugins/CoreHome/lang/en.json +++ b/plugins/CoreHome/lang/en.json @@ -14,6 +14,8 @@ "DataTableExcludeAggregateRows": "Aggregate rows are shown %s Hide them", "DataTableIncludeAggregateRows": "Aggregate rows are hidden %s Show them", "DataTableHowToSearch": "Press enter or click the search icon to search", + "DataTableShowDimensions": "Dimensions are combined %s Show dimensions separately", + "DataTableCombineDimensions": "Dimensions are shown separately %s Show dimensions combined", "Default": "default", "DonateCall1": "Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make.", "DonateCall2": "Matomo needs your continued support to grow and thrive.", diff --git a/plugins/CoreHome/templates/_dataTableActions.twig b/plugins/CoreHome/templates/_dataTableActions.twig index 095c5a0aee..4266644440 100644 --- a/plugins/CoreHome/templates/_dataTableActions.twig +++ b/plugins/CoreHome/templates/_dataTableActions.twig @@ -121,14 +121,19 @@ <ul id='dropdownConfigure{{ randomIdForDropdown }}' class='dropdown-content tableConfiguration'> {% if properties.show_flatten_table %} + <li> + <div class="configItem dataTableFlatten"></div> + </li> {% if clientSideParameters.flat is defined and clientSideParameters.flat == 1 %} + {% if hasMultipleDimensions|default %} + <li> + <div class="configItem dataTableShowDimensions"></div> + </li> + {% endif %} <li> <div class="configItem dataTableIncludeAggregateRows"></div> </li> {% endif %} - <li> - <div class="configItem dataTableFlatten"></div> - </li> {% endif %} {% if not isDataTableEmpty and properties.show_totals_row|default(0) %} <li> diff --git a/plugins/CoreHome/templates/_dataTableCell.twig b/plugins/CoreHome/templates/_dataTableCell.twig index a1b1c2c59a..7aca38defd 100644 --- a/plugins/CoreHome/templates/_dataTableCell.twig +++ b/plugins/CoreHome/templates/_dataTableCell.twig @@ -37,13 +37,13 @@ title="{{ reportRatioTooltip|raw }} {{ totalRatioTooltip|e('html_attr') }}" > {{ rowPercentage }}</span> {%- endif %} - -{% if column=='label' %} +{% set dimensions = dataTable.getMetadata('dimensions')|default([]) %} +{% if column=='label' or column in dimensions %} {% import 'macros.twig' as piwik %} <span class='label{% if row.getMetadata('is_aggregate') %} highlighted{% endif %}' {% if properties is defined and properties.tooltip_metadata_name is not empty %}title="{{ row.getMetadata(properties.tooltip_metadata_name) }}"{% endif %}> - {{ piwik.logoHtml(row.getMetadata(), row.getColumn('label')) }} + {% if column=='label' %}{{ piwik.logoHtml(row.getMetadata(), row.getColumn('label')) }}{% endif %} {% if row.getMetadata('html_label_prefix') %}<span class='label-prefix'>{{ row.getMetadata('html_label_prefix') | raw }} </span>{% endif -%} {% endif %}<span class="value"> {%- if row.getColumn(column) or (column=='label' and row.getColumn(column) is same as("0")) %}{% if column=='label' %}{{- row.getColumn(column)|rawSafeDecoded -}}{% else %}{% if row.getMetadata('html_column_' ~ column ~ '_prefix') %}<span class='column-prefix'>{{ row.getMetadata('html_column_' ~ column ~ '_prefix') | raw }}</span>{% endif -%}{{- row.getColumn(column)|number(2,0)|rawSafeDecoded -}}{% if row.getMetadata('html_column_' ~ column ~ '_suffix') %}<span class='column-suffix'>{{ row.getMetadata('html_column_' ~ column ~ '_suffix') | raw }}</span>{% endif -%}{% endif %} diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable.php b/plugins/CoreVisualizations/Visualizations/HtmlTable.php index 2fa6e6674b..a305c12538 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable.php @@ -9,9 +9,11 @@ namespace Piwik\Plugins\CoreVisualizations\Visualizations; use Piwik\API\Request as ApiRequest; +use Piwik\Columns\Dimension; use Piwik\Common; use Piwik\DataTable\Row; use Piwik\Metrics; +use Piwik\DataTable; use Piwik\Period; use Piwik\Plugin\Visualization; @@ -93,6 +95,55 @@ class HtmlTable extends Visualization if ($this->isPivoted()) { $this->config->columns_to_display = $this->dataTable->getColumns(); } + + // Note: This needs to be done right before rendering, as otherwise some plugins might change the columns to display again + if ($this->isFlattened()) { + $dimensions = $this->dataTable->getMetadata('dimensions'); + + $hasMultipleDimensions = is_array($dimensions) && count($dimensions) > 1; + $this->assignTemplateVar('hasMultipleDimensions', $hasMultipleDimensions); + + if ($hasMultipleDimensions) { + if ($this->config->show_dimensions) { + // ensure first metric translation is used as label if other dimensions are in separate columns + $this->config->addTranslation('label', $this->config->translations[reset($dimensions)]); + } else { + // concatenate dimensions if table is shown flattened + foreach ($dimensions as $dimension) { + $labels[] = $this->config->translations[$dimension]; + } + $this->config->addTranslation('label', implode(' - ', $labels)); + } + } + + if ($this->config->show_dimensions && $hasMultipleDimensions) { + + + $properties = $this->config; + array_shift($dimensions); // shift away first dimension, as that will be shown as label + + $this->dataTable->filter(function (DataTable $dataTable) use ($properties, $dimensions) { + if (empty($properties->columns_to_display)) { + $columns = $dataTable->getColumns(); + $hasNbVisits = in_array('nb_visits', $columns); + $hasNbUniqVisitors = in_array('nb_uniq_visitors', $columns); + + $properties->setDefaultColumnsToDisplay($columns, $hasNbVisits, $hasNbUniqVisitors); + } + + $label = array_search('label', $properties->columns_to_display); + if ($label !== false) { + unset($properties->columns_to_display[$label]); + } + + foreach (array_reverse($dimensions) as $dimension) { + array_unshift($properties->columns_to_display, $dimension); + } + + array_unshift($properties->columns_to_display, 'label'); + }); + } + } } public function beforeGenericFiltersAreAppliedToLoadedDataTable() @@ -104,6 +155,44 @@ class HtmlTable extends Visualization } parent::beforeGenericFiltersAreAppliedToLoadedDataTable(); + + // Note: This needs to be done right before generic filter are applied, to make sorting such columns possible + if ($this->isFlattened()) { + $dimensions = $this->dataTable->getMetadata('dimensions'); + + $hasMultipleDimensions = is_array($dimensions) && count($dimensions) > 1; + + if ($hasMultipleDimensions) { + foreach (Dimension::getAllDimensions() as $dimension) { + $dimensionId = str_replace('.', '_', $dimension->getId()); + $dimensionName = $dimension->getName(); + + if (!empty($dimensionId) && !empty($dimensionName) && in_array($dimensionId, $dimensions)) { + $this->config->translations[$dimensionId] = $dimensionName; + } + } + } + + + if ($this->config->show_dimensions && $hasMultipleDimensions) { + + $this->dataTable->filter(function($dataTable) use ($dimensions) { + /** @var DataTable $dataTable */ + $rows = $dataTable->getRows(); + foreach ($rows as $row) { + foreach ($dimensions as $dimension) { + $row->setColumn($dimension, $row->getMetadata($dimension)); + } + } + }); + + # replace original label column with first dimension + $firstDimension = array_shift($dimensions); + $this->dataTable->filter('ColumnCallbackAddMetadata', array('label', 'combinedLabel', function ($label) { return $label; })); + $this->dataTable->filter('ColumnDelete', array('label')); + $this->dataTable->filter('ReplaceColumnNames', array(array($firstDimension => 'label'))); + } + } } protected function isPivoted() @@ -122,4 +211,9 @@ class HtmlTable extends Visualization { return null; } + + protected function isFlattened() + { + return $this->requestConfig->flat || Common::getRequestVar('flat', ''); + } } diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php index 9f754eccc4..d3221acb8f 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php @@ -63,6 +63,8 @@ class AllColumns extends HtmlTable $properties->columns_to_display = $columnsToDisplay; }); + + parent::beforeGenericFiltersAreAppliedToLoadedDataTable(); } public function beforeLoadDataTable() diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php index ba39a66c0f..94de8f18b3 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/Config.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; +use Piwik\Columns\Dimension; use Piwik\ViewDataTable\Config as VisualizationConfig; /** @@ -100,6 +101,12 @@ class Config extends VisualizationConfig */ public $report_ratio_columns = array(); + /** + * If true, dimensions in flattened reports will be shown as separate columns + * @var bool + */ + public $show_dimensions = false; + public function __construct() { parent::__construct(); @@ -115,6 +122,7 @@ class Config extends VisualizationConfig 'enable_sort', 'keep_summary_row', 'subtable_controller_action', + 'show_dimensions', )); $this->addPropertiesThatCanBeOverwrittenByQueryParams(array( @@ -126,6 +134,7 @@ class Config extends VisualizationConfig 'disable_subtable_when_show_goals', 'keep_summary_row', 'highlight_summary_row', + 'show_dimensions', )); } diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php index dde538219c..804568bf08 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/RequestConfig.php @@ -58,12 +58,14 @@ class RequestConfig extends VisualizationRequestConfig 'filter_sort_column', 'filter_sort_order', 'keep_summary_row', - 'keep_totals_row' + 'keep_totals_row', + 'show_dimensions' )); $this->addPropertiesThatCanBeOverwrittenByQueryParams(array( 'keep_summary_row', 'keep_totals_row', + 'show_dimensions', )); } diff --git a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig index 10c28ff40b..c4b4659e03 100644 --- a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig +++ b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig @@ -21,7 +21,7 @@ {%- for rowId, row in dataTable.getRows() -%} {%- set rowHasSubtable = not subtablesAreDisabled and row.getIdSubDataTable() and properties.subtable_controller_action is not null -%} {%- set rowSubtableId = row.getMetadata('idsubdatatable_in_db')|default(row.getIdSubDataTable()) -%} - {%- set isSummaryRow = rowId == constant('Piwik\\DataTable::ID_SUMMARY_ROW') -%} + {%- set isSummaryRow = rowId == constant('Piwik\\DataTable::ID_SUMMARY_ROW') or row.getMetadata('is_summary') -%} {%- set shouldHighlightRow = isSummaryRow and properties.highlight_summary_row -%} {# display this row if it doesn't have a subtable or if we don't replace the row with the subtable #} diff --git a/plugins/Insights/templates/table_header.twig b/plugins/Insights/templates/table_header.twig index 00dc29736a..bb71c41bd3 100644 --- a/plugins/Insights/templates/table_header.twig +++ b/plugins/Insights/templates/table_header.twig @@ -2,11 +2,11 @@ <th class="label first"> {{ metadata.reportName }} </th> - <th class="label orderBy {% if 'absolute' == properties.order_by %}active{% endif %}" + <th class="orderBy {% if 'absolute' == properties.order_by %}active{% endif %}" name="orderBy" value="absolute"> {{ metadata.metricName }} </th> - <th class="label last orderBy {% if 'relative' == properties.order_by %}active{% endif %}" + <th class="last orderBy {% if 'relative' == properties.order_by %}active{% endif %}" name="orderBy" value="relative"> {{ 'MultiSites_Evolution'|translate }} </th> diff --git a/plugins/Live/templates/_totalVisitors.twig b/plugins/Live/templates/_totalVisitors.twig index a00ff2b3eb..665617e926 100644 --- a/plugins/Live/templates/_totalVisitors.twig +++ b/plugins/Live/templates/_totalVisitors.twig @@ -5,10 +5,10 @@ <th id="label" class="sortable label first" style="cursor: auto;"> <div id="thDIV">{{ 'General_Date'|translate }}</div> </th> - <th id="label" class="sortable label" style="cursor: auto;"> + <th class="sortable" style="cursor: auto;"> <div id="thDIV">{{ 'General_ColumnNbVisits'|translate }}</div> </th> - <th id="label" class="sortable label" style="cursor: auto;"> + <th class="sortable" style="cursor: auto;"> <div id="thDIV">{{ 'General_Actions'|translate }}</div> </th> </tr> diff --git a/plugins/Morpheus/stylesheets/main.less b/plugins/Morpheus/stylesheets/main.less index 61146031cc..e643ee193c 100644 --- a/plugins/Morpheus/stylesheets/main.less +++ b/plugins/Morpheus/stylesheets/main.less @@ -322,7 +322,7 @@ table.dataTable { padding-bottom: 16px; vertical-align: middle; - &:not(.first) { + &:not(.label) { text-align: right; padding-left: 28px; padding-right: 12px; diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getDownloads_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getDownloads_day.xml index 1a106c0617..e7341eb56b 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getDownloads_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getDownloads_day.xml @@ -10,6 +10,7 @@ <min_bandwidth /> <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> + <is_summary>1</is_summary> <Actions_DownloadUrl>Others</Actions_DownloadUrl> </row> <row> @@ -23,6 +24,7 @@ <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> <Actions_DownloadUrl>cloudsite5.com/ - Others</Actions_DownloadUrl> + <is_summary>1</is_summary> </row> <row> <label>cloudsite6.com/ - Others</label> @@ -35,6 +37,7 @@ <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> <Actions_DownloadUrl>cloudsite6.com/ - Others</Actions_DownloadUrl> + <is_summary>1</is_summary> </row> <row> <label>cloudsite7.com/ - Others</label> @@ -47,6 +50,7 @@ <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> <Actions_DownloadUrl>cloudsite7.com/ - Others</Actions_DownloadUrl> + <is_summary>1</is_summary> </row> <row> <label>cloudsite5.com/20/download</label> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getOutlinks_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getOutlinks_day.xml index a063a4311e..60f4e267b7 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getOutlinks_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getOutlinks_day.xml @@ -10,6 +10,7 @@ <min_bandwidth /> <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> + <is_summary>1</is_summary> <Actions_ClickedUrl>Others</Actions_ClickedUrl> </row> <row> @@ -23,6 +24,7 @@ <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> <Actions_ClickedUrl>othersite10.com/ - Others</Actions_ClickedUrl> + <is_summary>1</is_summary> </row> <row> <label>othersite11.com/ - Others</label> @@ -35,6 +37,7 @@ <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> <Actions_ClickedUrl>othersite11.com/ - Others</Actions_ClickedUrl> + <is_summary>1</is_summary> </row> <row> <label>othersite12.com/ - Others</label> @@ -47,6 +50,7 @@ <max_bandwidth /> <avg_bandwidth>0</avg_bandwidth> <Actions_ClickedUrl>othersite12.com/ - Others</Actions_ClickedUrl> + <is_summary>1</is_summary> </row> <row> <label>othersite10.com/</label> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageTitles_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageTitles_day.xml index 4babbcd1e6..668bde9856 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageTitles_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageTitles_day.xml @@ -18,6 +18,7 @@ <avg_time_on_page>0</avg_time_on_page> <bounce_rate>100%</bounce_rate> <exit_rate>100%</exit_rate> + <is_summary>1</is_summary> <Actions_PageTitle>Others</Actions_PageTitle> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageUrls_day.xml index 43565baee5..fb7fa5ba08 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageUrls_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getPageUrls_day.xml @@ -19,6 +19,7 @@ <bounce_rate>100%</bounce_rate> <exit_rate>100%</exit_rate> <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252F-1</segment> + <is_summary>1</is_summary> <Actions_PageUrl>Others</Actions_PageUrl> </row> <row> @@ -41,6 +42,7 @@ <exit_rate>100%</exit_rate> <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252F0</segment> <Actions_PageUrl>/0/ - Others</Actions_PageUrl> + <is_summary>1</is_summary> </row> <row> <label>/1/ - Others</label> @@ -62,6 +64,7 @@ <exit_rate>100%</exit_rate> <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252F1</segment> <Actions_PageUrl>/1/ - Others</Actions_PageUrl> + <is_summary>1</is_summary> </row> <row> <label>/2/ - Others</label> @@ -83,6 +86,7 @@ <exit_rate>100%</exit_rate> <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252F2</segment> <Actions_PageUrl>/2/ - Others</Actions_PageUrl> + <is_summary>1</is_summary> </row> <row> <label>/0/</label> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getSiteSearchKeywords_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getSiteSearchKeywords_day.xml index affe4b3dba..794dc442aa 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getSiteSearchKeywords_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Actions.getSiteSearchKeywords_day.xml @@ -15,6 +15,7 @@ <avg_time_on_page>0</avg_time_on_page> <bounce_rate>0%</bounce_rate> <exit_rate>100%</exit_rate> + <is_summary>1</is_summary> <Actions_Keyword>Others</Actions_Keyword> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__CustomVariables.getCustomVariables_day.xml index 19dd3ebfa5..57b60302f4 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__CustomVariables.getCustomVariables_day.xml @@ -3,6 +3,7 @@ <row> <label>Others</label> <nb_actions>60</nb_actions> + <is_summary>1</is_summary> <CustomVariables_CustomVariableName>Others</CustomVariables_CustomVariableName> </row> <row> @@ -16,6 +17,7 @@ </row> </slots> <CustomVariables_CustomVariableName>name</CustomVariables_CustomVariableName> + <is_summary>1</is_summary> <CustomVariables_CustomVariableValue>Others</CustomVariables_CustomVariableValue> </row> <row> @@ -42,6 +44,7 @@ </row> </slots> <CustomVariables_CustomVariableName>liked</CustomVariables_CustomVariableName> + <is_summary>1</is_summary> <CustomVariables_CustomVariableValue>Others</CustomVariables_CustomVariableValue> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getBrowserVersions_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getBrowserVersions_day.xml index 4462b4428e..188899636a 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getBrowserVersions_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getBrowserVersions_day.xml @@ -11,6 +11,7 @@ <bounce_count>10</bounce_count> <nb_visits_converted>0</nb_visits_converted> <logo>plugins/Morpheus/icons/dist/browsers/UNK.png</logo> + <is_summary>1</is_summary> <DevicesDetection_BrowserVersion>Others</DevicesDetection_BrowserVersion> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getOsVersions_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getOsVersions_day.xml index a356234a08..9980a0f955 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getOsVersions_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__DevicesDetection.getOsVersions_day.xml @@ -11,6 +11,7 @@ <bounce_count>10</bounce_count> <nb_visits_converted>0</nb_visits_converted> <logo>plugins/Morpheus/icons/dist/os/UNK.png</logo> + <is_summary>1</is_summary> <DevicesDetection_OsVersion>Others</DevicesDetection_OsVersion> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsCategory_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsCategory_day.xml index 56b828aa22..6b91011da3 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsCategory_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsCategory_day.xml @@ -8,6 +8,7 @@ <avg_price>30</avg_price> <avg_quantity>0</avg_quantity> <conversion_rate>0%</conversion_rate> + <is_summary>1</is_summary> <Ecommerce_ProductCategory>Others</Ecommerce_ProductCategory> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsName_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsName_day.xml index b5340e2da6..3f35409fb0 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsName_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Goals.getItemsName_day.xml @@ -8,6 +8,7 @@ <avg_price>180</avg_price> <avg_quantity>0</avg_quantity> <conversion_rate>0%</conversion_rate> + <is_summary>1</is_summary> <Ecommerce_ProductName>Others</Ecommerce_ProductName> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getAll_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getAll_day.xml index 4ce1373303..62d4e0246d 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getAll_day.xml @@ -10,6 +10,7 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>9</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <is_summary>1</is_summary> <Referrers_Referrer>Others</Referrers_Referrer> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getKeywords_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getKeywords_day.xml index 2ed256828f..b7c3e0cd22 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getKeywords_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getKeywords_day.xml @@ -10,6 +10,7 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>7</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <is_summary>1</is_summary> <Referrers_Keyword>Others</Referrers_Keyword> </row> <row> @@ -24,6 +25,7 @@ <nb_visits_converted>0</nb_visits_converted> <logo>plugins/Morpheus/icons/dist/searchEngines/xx.png</logo> <Referrers_Keyword>this search term</Referrers_Keyword> + <is_summary>1</is_summary> <Referrers_SearchEngine>Others</Referrers_SearchEngine> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getSearchEngines_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getSearchEngines_day.xml index 328713f102..cdb5c36986 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getSearchEngines_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getSearchEngines_day.xml @@ -10,8 +10,8 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>6</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <url>URL unknown!</url> <logo>plugins/Morpheus/icons/dist/searchEngines/xx.png</logo> + <is_summary>1</is_summary> <Referrers_SearchEngine>Others</Referrers_SearchEngine> </row> <row> @@ -24,9 +24,9 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>2</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <url>http://google.com</url> <logo>plugins/Morpheus/icons/dist/searchEngines/google.com.png</logo> <Referrers_SearchEngine>Google</Referrers_SearchEngine> + <is_summary>1</is_summary> <Referrers_Keyword>Others</Referrers_Keyword> </row> <row> @@ -39,9 +39,9 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>2</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <url>http://search.yahoo.com</url> <logo>plugins/Morpheus/icons/dist/searchEngines/search.yahoo.com.png</logo> <Referrers_SearchEngine>Yahoo!</Referrers_SearchEngine> + <is_summary>1</is_summary> <Referrers_Keyword>Others</Referrers_Keyword> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getWebsites_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getWebsites_day.xml index cf511774e2..739307c0f9 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getWebsites_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Referrers.getWebsites_day.xml @@ -10,6 +10,7 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>2</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <is_summary>1</is_summary> <Referrers_Website>Others</Referrers_Website> </row> <row> @@ -22,9 +23,9 @@ <sum_visit_length>0</sum_visit_length> <bounce_count>2</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <url>Others</url> <Referrers_Website>whatever0.com</Referrers_Website> - <Referrers_WebsitePage> - Others</Referrers_WebsitePage> + <is_summary>1</is_summary> + <Referrers_WebsitePage>Others</Referrers_WebsitePage> </row> <row> <label>whatever0.com/index</label> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getConfiguration_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getConfiguration_day.xml index aa4dd45835..4231a73dea 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getConfiguration_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getConfiguration_day.xml @@ -10,6 +10,7 @@ <sum_visit_length>45</sum_visit_length> <bounce_count>15</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <is_summary>1</is_summary> <Resolution_Configuration>Others</Resolution_Configuration> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getResolution_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getResolution_day.xml index 97ba64717f..47c523ddd6 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getResolution_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__Resolution.getResolution_day.xml @@ -10,6 +10,7 @@ <sum_visit_length>35</sum_visit_length> <bounce_count>5</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <is_summary>1</is_summary> <Resolution_Resolution>Others</Resolution_Resolution> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getCity_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getCity_day.xml index d743c41b62..98c7c05653 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getCity_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getCity_day.xml @@ -11,6 +11,7 @@ <bounce_count>15</bounce_count> <nb_visits_converted>0</nb_visits_converted> <logo>plugins/Morpheus/icons/dist/flags/xx.png</logo> + <is_summary>1</is_summary> <UserCountry_City>Others</UserCountry_City> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getRegion_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getRegion_day.xml index b3fafd427d..34db2b4c40 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getRegion_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_flattened__UserCountry.getRegion_day.xml @@ -11,6 +11,7 @@ <bounce_count>10</bounce_count> <nb_visits_converted>0</nb_visits_converted> <logo>plugins/Morpheus/icons/dist/flags/xx.png</logo> + <is_summary>1</is_summary> <UserCountry_Region>Others</UserCountry_Region> </row> <row> diff --git a/tests/UI/expected-screenshots/ViewDataTableTest_11_flattened.png b/tests/UI/expected-screenshots/ViewDataTableTest_11_flattened.png index ad53dc56d6..9aed6f1dca 100644 --- a/tests/UI/expected-screenshots/ViewDataTableTest_11_flattened.png +++ b/tests/UI/expected-screenshots/ViewDataTableTest_11_flattened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e62863bace998ad9a0ab526c1dd27bbbc4c61f04142207ba5100144e46fa6ed1 -size 69050 +oid sha256:af111d9fa698a6580f9354e76b2d66f307b03bf14debdb7077b97d5aee106a06 +size 70345 diff --git a/tests/UI/expected-screenshots/ViewDataTableTest_12_aggregate_shown.png b/tests/UI/expected-screenshots/ViewDataTableTest_12_aggregate_shown.png index 8dd6e37851..51e9b17ae6 100644 --- a/tests/UI/expected-screenshots/ViewDataTableTest_12_aggregate_shown.png +++ b/tests/UI/expected-screenshots/ViewDataTableTest_12_aggregate_shown.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16f66746af8ecf30ca0bf6438de3b90b7124316726636ed0aacc51125e2441f4 -size 72586 +oid sha256:66c87b4b6de1e793ae3acfb320bff8e77a474b13294446a4ef866ab47f61260f +size 73865 diff --git a/tests/UI/expected-screenshots/ViewDataTableTest_dimension_columns.png b/tests/UI/expected-screenshots/ViewDataTableTest_dimension_columns.png new file mode 100644 index 0000000000..29760f3937 --- /dev/null +++ b/tests/UI/expected-screenshots/ViewDataTableTest_dimension_columns.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd27f8ec626064401ce795c9553f3fa196245863b61069b4553a220fc4a3136a +size 73925 diff --git a/tests/UI/expected-screenshots/ViewDataTableTest_dimension_search.png b/tests/UI/expected-screenshots/ViewDataTableTest_dimension_search.png new file mode 100644 index 0000000000..d2e3e05657 --- /dev/null +++ b/tests/UI/expected-screenshots/ViewDataTableTest_dimension_search.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6919c7b43ac9a13dad081a1912f7ce7e7d98039c0b77be979db6f5796c005190 +size 44652 diff --git a/tests/UI/expected-screenshots/ViewDataTableTest_flatten_search.png b/tests/UI/expected-screenshots/ViewDataTableTest_flatten_search.png new file mode 100644 index 0000000000..e3f00f9b6d --- /dev/null +++ b/tests/UI/expected-screenshots/ViewDataTableTest_flatten_search.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3e5a4a3568d6c375f64200e44f189a2c6fc35248277ec2b6ed2458051d84115 +size 44648 diff --git a/tests/UI/specs/ViewDataTable_spec.js b/tests/UI/specs/ViewDataTable_spec.js index 65159a6ab5..ce308f3c11 100644 --- a/tests/UI/specs/ViewDataTable_spec.js +++ b/tests/UI/specs/ViewDataTable_spec.js @@ -101,7 +101,45 @@ describe("ViewDataTableTest", function () { // TODO: should remove Test suffix f expect(await page.screenshot({ fullPage: true })).to.matchImage('11_flattened'); }); + it("should show dimensions separately when option is clicked", async function () { + await page.click('.dropdownConfigureIcon'); + await page.click('.dataTableShowDimensions'); + await page.waitForNetworkIdle(); + await page.mouse.move(-10, -10); + expect(await page.screenshot({ fullPage: true })).to.matchImage('dimension_columns'); + }); + + it("should search in subtable dimensions even when they are displayed separately", async function () { + await page.click('.dataTableAction.searchAction'); + await page.focus('.searchAction .dataTableSearchInput'); + await page.keyboard.type('Bing'); + await page.click('.searchAction .icon-search'); + await page.waitForNetworkIdle(); + await page.evaluate(() => document.activeElement.blur()); + await page.waitFor(500); + expect(await page.screenshot({ fullPage: true })).to.matchImage('dimension_search'); + }); + + it("search should still work when showing dimensions combined again", async function () { + await page.click('.dropdownConfigureIcon'); + await page.click('.dataTableShowDimensions'); + await page.waitForNetworkIdle(); + await page.mouse.move(-10, -10); + expect(await page.screenshot({ fullPage: true })).to.matchImage('flatten_search'); + }); + + it("search should still work when switching to back to separate dimensions", async function () { + await page.click('.dropdownConfigureIcon'); + await page.click('.dataTableShowDimensions'); + await page.waitForNetworkIdle(); + await page.waitFor(500); + await page.mouse.move(-10, -10); + await page.evaluate(() => document.activeElement.blur()); + expect(await page.screenshot({ fullPage: true })).to.matchImage('dimension_search'); + }); + it("should show aggregate rows when the aggregate rows option is clicked", async function () { + await page.goto(url.replace(/filter_limit=5/, 'filter_limit=10') + '&flat=1'); await page.click('.dropdownConfigureIcon'); await page.click('.dataTableIncludeAggregateRows'); await page.waitForNetworkIdle(); |