diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-11-10 19:14:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 19:14:56 +0300 |
commit | be724571d2f477b4f553411d41df3fb22408c0a6 (patch) | |
tree | 385046baeb033a1be7abe9f57139a99c819e9664 /plugins/PagePerformance | |
parent | a4bdd6c9072d9c86e16fa566e129b7313751bdfe (diff) |
Move performance reports to a new page / category (#16673)
* Move performance reports to new category
* fix tooltips
* updates UI test
* updates expected test files
* updates expected screenshots
* Move Performance category after transitions
* Make page reports wider
* adds nonce to language selector in updater / installation
* updates expected test files
* Update getLanguagesSelector.twig
* change report title to page urls
* Hide performance viz on normal page reports (not in widgets)
* update tests
* updates submodules
* fix ui tests
Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'plugins/PagePerformance')
12 files changed, 98 insertions, 42 deletions
diff --git a/plugins/PagePerformance/Categories/PerformanceSubcategory.php b/plugins/PagePerformance/Categories/PerformanceSubcategory.php new file mode 100644 index 0000000000..e8f21cd27e --- /dev/null +++ b/plugins/PagePerformance/Categories/PerformanceSubcategory.php @@ -0,0 +1,19 @@ +<?php +/** + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\PagePerformance\Categories; + +use Piwik\Category\Subcategory; + +class PerformanceSubcategory extends Subcategory +{ + protected $categoryId = 'General_Actions'; + protected $id = 'PagePerformance_Performance'; + protected $order = 47; + +} diff --git a/plugins/PagePerformance/PagePerformance.php b/plugins/PagePerformance/PagePerformance.php index 8655f92472..ba4648f365 100644 --- a/plugins/PagePerformance/PagePerformance.php +++ b/plugins/PagePerformance/PagePerformance.php @@ -23,6 +23,8 @@ class PagePerformance extends \Piwik\Plugin 'getExitPageUrls', 'getPageUrlsFollowingSiteSearch', 'getPageTitles', + 'getEntryPageTitles', + 'getExitPageTitles', 'getPageTitlesFollowingSiteSearch', ]; diff --git a/plugins/PagePerformance/Reports/Get.php b/plugins/PagePerformance/Reports/Get.php index 107159843e..1c313dea61 100644 --- a/plugins/PagePerformance/Reports/Get.php +++ b/plugins/PagePerformance/Reports/Get.php @@ -8,13 +8,12 @@ */ namespace Piwik\Plugins\PagePerformance\Reports; -use Piwik\DataTable; -use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines; use Piwik\Plugins\PagePerformance\Metrics; use Piwik\Plugins\PagePerformance\Visualizations\JqplotGraph\StackedBarEvolution; +use Piwik\Plugins\PagePerformance\Visualizations\PerformanceColumns; use Piwik\Report\ReportWidgetFactory; use Piwik\Widget\WidgetsList; @@ -25,8 +24,8 @@ class Get extends \Piwik\Plugin\Report parent::init(); $this->dimension = null; - $this->categoryId = 'General_Visitors'; - $this->subcategoryId = 'General_Overview'; + $this->categoryId = 'General_Actions'; + $this->subcategoryId = 'PagePerformance_Performance'; $this->order = 5; $this->name = Piwik::translate('PagePerformance_Overview'); @@ -41,7 +40,7 @@ class Get extends \Piwik\Plugin\Report $config = $factory->createWidget(); $config->forceViewDataTable(StackedBarEvolution::ID); $config->setAction('getEvolutionGraph'); - $config->setOrder(20); + $config->setOrder(1); $config->setName('PagePerformance_EvolutionOverPeriod'); $widgetsList->addWidgetConfig($config); @@ -49,7 +48,31 @@ class Get extends \Piwik\Plugin\Report $config->forceViewDataTable(Sparklines::ID); $config->setName(''); $config->setIsNotWidgetizable(); - $config->setOrder(21); + $config->setOrder(2); + $widgetsList->addWidgetConfig($config); + + $config = $factory->createWidget(); + $config->forceViewDataTable(PerformanceColumns::ID); + $config->setModule('Actions'); + $config->setAction('getPageUrls'); + $config->setName('Actions_PageUrls'); + $config->setOrder(3); + // set an additional parameter so we can use that in the report to check if we are in a report on the performance page + $config->addParameters(['performance' => 1]); + $config->setIsNotWidgetizable(); + $config->setIsWide(); + $widgetsList->addWidgetConfig($config); + + $config = $factory->createWidget(); + $config->forceViewDataTable(PerformanceColumns::ID); + $config->setModule('Actions'); + $config->setAction('getPageTitles'); + $config->setName('Actions_SubmenuPageTitles'); + $config->setOrder(4); + // set an additional parameter so we can use that in the report to check if we are in a report on the performance page + $config->addParameters(['performance' => 1]); + $config->setIsWide(); + $config->setIsNotWidgetizable(); $widgetsList->addWidgetConfig($config); } diff --git a/plugins/PagePerformance/Visualizations/PerformanceColumns.php b/plugins/PagePerformance/Visualizations/PerformanceColumns.php index 98298bc6f8..9e6d2d44dc 100644 --- a/plugins/PagePerformance/Visualizations/PerformanceColumns.php +++ b/plugins/PagePerformance/Visualizations/PerformanceColumns.php @@ -33,8 +33,19 @@ class PerformanceColumns extends HtmlTable { $request = $viewDataTable->getRequestArray(); - if (is_array($request) && array_key_exists('module', $request) && array_key_exists('action', $request) && - 'Actions' === $request['module'] && in_array($request['action'], PagePerformance::$availableForMethods)) { + if ($viewDataTable->config->show_table_performance === false) { + return false; + } + + $module = $request['module'] ?? ''; + $action = $request['action'] ?? ''; + + if ($module === 'Widgetize') { + $module = $request['moduleToWidgetize'] ?: $module; + $action = $request['actionToWidgetize'] ?: $action; + } + + if ('Actions' === $module && in_array($action, PagePerformance::$availableForMethods)) { return true; } diff --git a/plugins/PagePerformance/javascripts/jqplotStackedBarEvolutionGraph.js b/plugins/PagePerformance/javascripts/jqplotStackedBarEvolutionGraph.js index 12c5dc9b87..b3f6b20c5b 100644 --- a/plugins/PagePerformance/javascripts/jqplotStackedBarEvolutionGraph.js +++ b/plugins/PagePerformance/javascripts/jqplotStackedBarEvolutionGraph.js @@ -108,10 +108,10 @@ var seriesColor = self.jqplotParams.seriesColors[d]; - dataByAxis[axis].push('<span class="tooltip-series-color" style="background-color: ' + seriesColor + ';"/>' + '<strong>' + value + '</strong> ' + piwikHelper.htmlEntities(series)); + dataByAxis[axis].push('<span class="tooltip-series-color" style="background-color: ' + seriesColor + ';"></span>' + '<strong>' + value + '</strong> ' + piwikHelper.htmlEntities(series)); } - dataByAxis[axis].push('<span class="tooltip-series-color" style="background-color: #000;"/>' + '<strong>' + self.formatY(totalValue, 0) + '</strong> ' + _pk_translate('General_Total')); + dataByAxis[axis].push('<span class="tooltip-series-color" style="background-color: #000;"></span>' + '<strong>' + self.formatY(totalValue, 0) + '</strong> ' + _pk_translate('General_Total')); var xAxisCount = 0; diff --git a/plugins/PagePerformance/lang/en.json b/plugins/PagePerformance/lang/en.json index 3aa08ad71e..174be1d4ae 100644 --- a/plugins/PagePerformance/lang/en.json +++ b/plugins/PagePerformance/lang/en.json @@ -31,6 +31,7 @@ "PluginDescription": "Adds some page performance reports", "PerformanceTable": "Table with performance metrics", "Overview": "Performance overview", + "Performance": "Performance", "HelpNote": "Some of those metrics might not always be available. You can find more information in our %1$sonline guide%2$s.", "RowActionTitle": "Open page performance report", "RowActionDescription": "Show page performance report for this row", diff --git a/plugins/PagePerformance/tests/UI/PagePerformance_spec.js b/plugins/PagePerformance/tests/UI/PagePerformance_spec.js index a92678b740..e7c7281832 100644 --- a/plugins/PagePerformance/tests/UI/PagePerformance_spec.js +++ b/plugins/PagePerformance/tests/UI/PagePerformance_spec.js @@ -23,7 +23,7 @@ describe("PagePerformance", function () { } it("should load page performance overview", async function () { - await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Visitors&subcategory=General_Overview"); + await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=PagePerformance_Performance"); pageWrap = await page.$('.pageWrap'); expect(await pageWrap.screenshot()).to.matchImage('load'); }); @@ -40,8 +40,26 @@ describe("PagePerformance", function () { expect(await pageWrap.screenshot()).to.matchImage('rowactions'); }); + it("should show rowaction for subtable rows", async function () { + const subtablerow = await page.jQuery('tr.subDataTable:eq(1) .label'); + await subtablerow.click(); + + await page.waitForNetworkIdle(); + await page.waitFor(200); + + // hover first row + const row = await page.jQuery('tr.subDataTable:eq(1) + tr'); + await row.hover(); + + pageWrap = await page.$('.pageWrap'); + expect(await pageWrap.screenshot()).to.matchImage('rowactions_subtable'); + }); + it("should load page performance overlay", async function () { // click page performance icon + const row = await page.waitForSelector('.dataTable tbody tr:first-child'); + await row.hover(); + const icon = await page.waitForSelector('.dataTable tbody tr:first-child a.actionPagePerformance'); await icon.click(); @@ -59,45 +77,27 @@ describe("PagePerformance", function () { }); it("should show new table with performance metrics visualization in selection", async function () { - await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=General_Pages"); + await page.goto("?module=Widgetize&action=iframe&disableLink=0&widget=1&moduleToWidgetize=Actions&actionToWidgetize=getPageUrls&" + generalParams); // hover visualization selection const icon = await page.jQuery('.activateVisualizationSelection'); await icon.click(); await page.waitFor(500); // animation - pageWrap = await page.$('.pageWrap'); - expect(await pageWrap.screenshot()).to.matchImage('visualizations'); + expect(await page.screenshot({ fullPage: true })).to.matchImage('visualizations'); }); it("should load new table with performance metrics visualization", async function () { - // hover visualization selection const icon = await page.jQuery('.dropdown-content .icon-page-performance'); await icon.click(); await page.waitForNetworkIdle(); - pageWrap = await page.$('.pageWrap'); + pageWrap = await page.$('.widget'); expect(await pageWrap.screenshot()).to.matchImage('performance_visualization'); }); - it("should show rowaction for subtable rows", async function () { - - const subtablerow = await page.jQuery('tr.subDataTable:eq(1)'); - await subtablerow.click(); - - await page.waitForNetworkIdle(); - await page.waitFor(200); - - // hover first row - const row = await page.jQuery('tr.subDataTable:eq(1) + tr'); - await row.hover(); - - pageWrap = await page.$('.pageWrap'); - expect(await pageWrap.screenshot()).to.matchImage('rowactions_subtable'); - }); - it("performance overlay should work on page titles report", async function () { await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=Actions_SubmenuPageTitles"); diff --git a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_load.png b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_load.png index 1770987ac3..5631df0372 100644 --- a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_load.png +++ b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_load.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c5215962bfcde00fce46e52b4fe3c7ceda56b0672bb31b2598f1b3314c10655 -size 120741 +oid sha256:f8ec7c876d639f0aad0f998eeced67a51198480895420f3fd8db2926f72d0a91 +size 121513 diff --git a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_performance_visualization.png b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_performance_visualization.png index ef24c0b211..fa02298f77 100644 --- a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_performance_visualization.png +++ b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_performance_visualization.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9825822466b8a733a3886d96410209358239f91051c9d404f77efd0a0661176 -size 31792 +oid sha256:f758598ab3331d661a9c391973993736ea0b929db8a8a72cefd80950c1cad8d5 +size 27851 diff --git a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions.png b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions.png index 1b0e075497..2f45eb4d7a 100644 --- a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions.png +++ b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08551a65ebc883d6548196070d93d900e8d0499abcda12a4e58c1c8ecd19fb67 -size 32163 +oid sha256:4d3e4999cee03fe42d264f6f43ef34e637ef88fbc1c5ce366a41fc1a90ee882d +size 32410 diff --git a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions_subtable.png b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions_subtable.png index 29afb2791e..6c74b13cfe 100644 --- a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions_subtable.png +++ b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_rowactions_subtable.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:496dd454a5e4ba78f9c2f16926eba8b664c1faa49572889985fb2845d5048f70 -size 39128 +oid sha256:42e837a574702c59c838c083de8a4083f21ca43f3db16a551358720019efd4d1 +size 34732 diff --git a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_visualizations.png b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_visualizations.png index fc543bd529..e5fc974b92 100644 --- a/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_visualizations.png +++ b/plugins/PagePerformance/tests/UI/expected-screenshots/PagePerformance_visualizations.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d5c0c75a39464586b5ee0c750a90630ae3827645a2e8b3fddc85eb466a60d71 -size 40258 +oid sha256:279e3191c246816d9d8e4311f7609175cbc938716b351f1215bf8cbb58f26919 +size 40110 |