Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2018-08-09 14:24:16 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2018-08-09 14:24:16 +0300
commit2b77bb4d609dd0ec377a9edc32536f22dd4dabb2 (patch)
tree14e38fd0b07b26dbcf50dd2e25793b556d45baa7 /core/Plugin/Visualization.php
parent6112cc2ddf955b9c7183ba767e0a8acce93111ef (diff)
Add notification when report w/ segment has no data, but segment is unprocessed (#12823)3.6.0-b4
* When a report has no data, check if it is for an unprocessed segment and display an explanatory notification. * Remove transient notifications on reporting page change, allow datatable views to add notifications, use to display unprocessed segment message. * Update changelog. * Internationalize unprocessed segment message. * Parse notification divs in dashboardWidget.js when setting widget content. * Tweak message. * Change PR to use different approach: throw exception when no archives found and segment is used, then detect exception in new event. * Update changelog + document new event. * Unfinished review changes * more review fixes * Do not show notification w/ custom segments. * apply pr review * Apply review. * undo escaping since it was not needed & get test to pass * Different strategy + new test. * Fix tests. * Update two expected screenshots.
Diffstat (limited to 'core/Plugin/Visualization.php')
-rw-r--r--core/Plugin/Visualization.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/Plugin/Visualization.php b/core/Plugin/Visualization.php
index 5f5a58462f..6d948ae536 100644
--- a/core/Plugin/Visualization.php
+++ b/core/Plugin/Visualization.php
@@ -209,12 +209,12 @@ class Visualization extends ViewDataTable
}
$view = new View("@CoreHome/_dataTable");
+ $view->assign($this->templateVars);
if (!empty($loadingError)) {
$view->error = $loadingError;
}
- $view->assign($this->templateVars);
$view->visualization = $this;
$view->visualizationTemplate = static::TEMPLATE_FILE;
$view->visualizationCssClass = $this->getDefaultDataTableCssClass();
@@ -243,10 +243,29 @@ class Visualization extends ViewDataTable
$view->reportLastUpdatedMessage = $this->reportLastUpdatedMessage;
$view->footerIcons = $this->config->footer_icons;
$view->isWidget = Common::getRequestVar('widget', 0, 'int');
+ $view->notifications = [];
+
+ if (empty($this->dataTable) || !$this->hasAnyData($this->dataTable)) {
+ /**
+ * @ignore
+ */
+ Piwik::postEvent('Visualization.onNoData', [$view]);
+ }
return $view->render();
}
+ private function hasAnyData(DataTable\DataTableInterface $dataTable)
+ {
+ $hasData = false;
+ $dataTable->filter(function (DataTable $table) use (&$hasData) {
+ if ($table->getRowsCount() > 0) {
+ $hasData = true;
+ }
+ });
+ return $hasData;
+ }
+
/**
* @internal
*/