diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-02 02:52:46 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-02 02:52:46 +0300 |
commit | a61b7f377d909d86b2f5f81c29d412123cca08d4 (patch) | |
tree | 0687bb1952f8a397bdb125ba4f6c82d2a7352dd3 /plugins/Live | |
parent | 78a50e11806b1b99bbef0373795462ecc95471a1 (diff) |
Updated menu structure and naming fixes (#13518)
* add new category profiles
* disable row evolution
* add real time reports
* improve style when full-width
* change menu order plus remove visitors report
* remove more traces of the profiles report
* fix some ui tests
* fix more tests
* fix tests
* fix some tests
* Update en.json
* Update SegmentedVisitorLog.js
* updates expected test files
* updates expected UI files
* Updating expected files.
* Update expected screenshot.
Diffstat (limited to 'plugins/Live')
-rw-r--r-- | plugins/Live/API.php | 14 | ||||
-rw-r--r-- | plugins/Live/Categories/RealTimeVisitorsSubcategory.php | 19 | ||||
-rw-r--r-- | plugins/Live/Controller.php | 1 | ||||
-rw-r--r-- | plugins/Live/Model.php | 2 | ||||
-rw-r--r-- | plugins/Live/Reports/GetSimpleLastVisitCount.php | 1 | ||||
-rw-r--r-- | plugins/Live/Widgets/Widget.php | 4 | ||||
-rw-r--r-- | plugins/Live/javascripts/SegmentedVisitorLog.js | 2 | ||||
-rw-r--r-- | plugins/Live/lang/en.json | 20 | ||||
-rw-r--r-- | plugins/Live/stylesheets/live.less | 16 | ||||
-rw-r--r-- | plugins/Live/templates/index.twig | 4 | ||||
-rw-r--r-- | plugins/Live/tests/UI/expected-screenshots/Live_visitor_log.png | 4 | ||||
-rw-r--r-- | plugins/Live/tests/UI/expected-screenshots/Live_visitor_log_purged.png | 4 |
12 files changed, 68 insertions, 23 deletions
diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 7d93ce2287..38af910945 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -139,7 +139,7 @@ class API extends \Piwik\Plugin\API { Piwik::checkUserHasViewAccess($idSite); - $table = $this->loadLastVisitorDetailsFromDatabase($idSite, $period = false, $date = false, $segment = false, $offset = 0, $filter_limit, $minTimestamp = false, $filterSortOrder = false, $visitorId); + $table = $this->loadLastVisitsDetailsFromDatabase($idSite, $period = false, $date = false, $segment = false, $offset = 0, $filter_limit, $minTimestamp = false, $filterSortOrder = false, $visitorId); $this->addFilterToCleanVisitors($table, $idSite, $flat); return $table; @@ -178,7 +178,7 @@ class API extends \Piwik\Plugin\API $filterSortOrder = Common::getRequestVar('filter_sort_order', false, 'string'); - $dataTable = $this->loadLastVisitorDetailsFromDatabase($idSite, $period, $date, $segment, $filterOffset, $filterLimit, $minTimestamp, $filterSortOrder, $visitorId = false); + $dataTable = $this->loadLastVisitsDetailsFromDatabase($idSite, $period, $date, $segment, $filterOffset, $filterLimit, $minTimestamp, $filterSortOrder, $visitorId = false); $this->addFilterToCleanVisitors($dataTable, $idSite, $flat, $doNotFetchActions); $filterSortColumn = Common::getRequestVar('filter_sort_column', false, 'string'); @@ -222,7 +222,7 @@ class API extends \Piwik\Plugin\API $limit = Config::getInstance()->General['live_visitor_profile_max_visits_to_aggregate']; - $visits = $this->loadLastVisitorDetailsFromDatabase($idSite, $period = false, $date = false, $segment, + $visits = $this->loadLastVisitsDetailsFromDatabase($idSite, $period = false, $date = false, $segment, $offset = 0, $limit, false, false, $visitorId); $this->addFilterToCleanVisitors($visits, $idSite, $flat = false, $doNotFetchActions = false, $filterNow = true); @@ -270,21 +270,21 @@ class API extends \Piwik\Plugin\API // for faster performance search for a visitor within the last 7 days first $minTimestamp = Date::now()->subDay(7)->getTimestamp(); - $dataTable = $this->loadLastVisitorDetailsFromDatabase( + $dataTable = $this->loadLastVisitsDetailsFromDatabase( $idSite, $period = false, $date = false, $segment, $offset = 0, $limit = 1, $minTimestamp ); if (0 >= $dataTable->getRowsCount()) { $minTimestamp = Date::now()->subYear(1)->getTimestamp(); // no visitor found in last 7 days, look further back for up to 1 year. This query will be slower - $dataTable = $this->loadLastVisitorDetailsFromDatabase( + $dataTable = $this->loadLastVisitsDetailsFromDatabase( $idSite, $period = false, $date = false, $segment, $offset = 0, $limit = 1, $minTimestamp ); } if (0 >= $dataTable->getRowsCount()) { // no visitor found in last year, look over all logs. This query might be quite slow - $dataTable = $this->loadLastVisitorDetailsFromDatabase( + $dataTable = $this->loadLastVisitsDetailsFromDatabase( $idSite, $period = false, $date = false, $segment, $offset = 0, $limit = 1 ); } @@ -390,7 +390,7 @@ class API extends \Piwik\Plugin\API }); } - private function loadLastVisitorDetailsFromDatabase($idSite, $period, $date, $segment = false, $offset = 0, $limit = 100, $minTimestamp = false, $filterSortOrder = false, $visitorId = false) + private function loadLastVisitsDetailsFromDatabase($idSite, $period, $date, $segment = false, $offset = 0, $limit = 100, $minTimestamp = false, $filterSortOrder = false, $visitorId = false) { $model = new Model(); list($data, $hasMoreVisits) = $model->queryLogVisits($idSite, $period, $date, $segment, $offset, $limit, $visitorId, $minTimestamp, $filterSortOrder, true); diff --git a/plugins/Live/Categories/RealTimeVisitorsSubcategory.php b/plugins/Live/Categories/RealTimeVisitorsSubcategory.php new file mode 100644 index 0000000000..6a0154c81c --- /dev/null +++ b/plugins/Live/Categories/RealTimeVisitorsSubcategory.php @@ -0,0 +1,19 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Live\Categories; + +use Piwik\Category\Subcategory; + +class RealTimeVisitorsSubcategory extends Subcategory +{ + protected $categoryId = 'General_Visitors'; + protected $id = 'General_RealTime'; + protected $order = 7; + +} diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index 53a15893a9..c8978cef18 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -34,6 +34,7 @@ class Controller extends \Piwik\Plugin\Controller $view = new View('@Live/index'); $view->idSite = $this->idSite; + $view->isWidgetized = Common::getRequestVar('widget', 0, 'int'); $view = $this->setCounters($view); $view->liveRefreshAfterMs = (int)Config::getInstance()->General['live_widget_refresh_after_seconds'] * 1000; $view->visitors = $this->getLastVisitsStart(); diff --git a/plugins/Live/Model.php b/plugins/Live/Model.php index 51b7e2de66..47e2c3509a 100644 --- a/plugins/Live/Model.php +++ b/plugins/Live/Model.php @@ -363,7 +363,7 @@ class Model } $dateString = $date; - if ($period == 'range') { + if ($period == 'range' || Period::isMultiplePeriod($date, $period)) { $processedPeriod = new Range('range', $date); if ($parsedDate = Range::parseDateRange($date)) { $dateString = $parsedDate[2]; diff --git a/plugins/Live/Reports/GetSimpleLastVisitCount.php b/plugins/Live/Reports/GetSimpleLastVisitCount.php index d2f535ff4e..b8fef2ce55 100644 --- a/plugins/Live/Reports/GetSimpleLastVisitCount.php +++ b/plugins/Live/Reports/GetSimpleLastVisitCount.php @@ -23,6 +23,7 @@ class GetSimpleLastVisitCount extends Base protected function init() { parent::init(); + $this->categoryId = 'General_Visitors'; $this->order = 3; } diff --git a/plugins/Live/Widgets/Widget.php b/plugins/Live/Widgets/Widget.php index e058423b66..e76a3b663a 100644 --- a/plugins/Live/Widgets/Widget.php +++ b/plugins/Live/Widgets/Widget.php @@ -14,8 +14,10 @@ class Widget extends \Piwik\Widget\Widget { public static function configure(WidgetConfig $config) { - $config->setCategoryId('Live!'); + $config->setCategoryId('General_Visitors'); + $config->setSubcategoryId('General_RealTime'); $config->setName('Live_VisitorsInRealTime'); + $config->setIsWide(); $config->setOrder(20); } } diff --git a/plugins/Live/javascripts/SegmentedVisitorLog.js b/plugins/Live/javascripts/SegmentedVisitorLog.js index 6dc0ea4876..b4d24a8351 100644 --- a/plugins/Live/javascripts/SegmentedVisitorLog.js +++ b/plugins/Live/javascripts/SegmentedVisitorLog.js @@ -96,7 +96,7 @@ var SegmentedVisitorLog = function() { function show(apiMethod, segment, extraParams) { // open the popover - var box = Piwik_Popover.showLoading('Segmented Visitor Log'); + var box = Piwik_Popover.showLoading('Segmented Visit Log'); box.addClass('segmentedVisitorLogPopover'); diff --git a/plugins/Live/lang/en.json b/plugins/Live/lang/en.json index 3de17947f1..208051b927 100644 --- a/plugins/Live/lang/en.json +++ b/plugins/Live/lang/en.json @@ -12,7 +12,7 @@ "LastHours": "Last %s hours", "LastMinutes": "Last %s minutes", "LastVisit": "Last visit", - "LinkVisitorLog": "View detailed visitor log", + "LinkVisitorLog": "View detailed visit log", "LoadMoreVisits": "Load more visits", "LimitedSummary": "The information in this profile summarizes the last %1$s visits. This user had more visits in total.", "LimitedVisitsShown": "Only the last %1$s visits are shown. This user had more visits in total.", @@ -24,6 +24,7 @@ "PageRefreshed": "Number of times this page was viewed \/ refreshed in a row.", "PluginDescription": "Provides the live Visitor Log and lets you watch your visitors live in the real-time dashboard widget. The plugin also lets you see a Visitor profile for any given user.", "PreviousVisitor": "Previous visitor", + "RealTimeVisitors": "Real-time Visits", "RealTimeVisitorCount": "Real Time Visitor Count", "Referrer_URL": "Referrer URL", "ShowMap": "show map", @@ -34,20 +35,21 @@ "RevisitedPages": "Pages viewed more than once", "ToggleActions": "Toggle visibility of all actions", "TopVisitedPages": "Top visited pages", - "VisitorLog": "Visitor Log", + "VisitsLog": "Visits Log", + "VisitorLog": "Visits Log", "VisitorLogDocumentation": "This table shows the latest visits within the selected date range. You can see when a visitor's last visit occurred by hovering over the date of a visit. %1$s If the date range includes today, you can see your visitors real time! %2$s The data displayed here is always live, regardless of whether and how often you are using the archiving cron job.", - "VisitorLogNoDataMessagePurged": "Likely the data has been purged because the regular deletion of old visitor logs is enabled and the date for this report is more than %s days old. A super user can change this setting by going to Administration => Privacy.", + "VisitorLogNoDataMessagePurged": "Likely the data has been purged because the regular deletion of old raw data is enabled and the date for this report is more than %s days old. A super user can change this setting by going to Administration => Privacy.", "VisitorProfile": "Visitor profile", - "VisitorsInRealTime": "Visitors in Real-time", + "VisitorsInRealTime": "Visits in Real-time", "VisitorsLastVisit": "This visitor's last visit was %s days ago.", "VisitsFrom": "%1$s%2$s visits%3$s from", "VisitSummary": "Spent a total of %1$s%2$s on the website%3$s, and viewed %4$s pages%5$s in %6$s visits%7$s.", "VisitSummaryWithActionDetails": "Spent a total of %1$s%2$s on the website%3$s, and performed %4$s actions%5$s (%6$s) in %7$s visits%8$s.", - "RowActionTooltipDefault": "Show Visitor Log segmented by this row", - "RowActionTooltipWithDimension": "Show Visitor Log segmented by this %s", - "RowActionTooltipTitle": "Open segmented Visitor Log", - "SegmentedVisitorLogTitle": "Visitor Log showing visits where %1$s is \"%2$s\"", + "RowActionTooltipDefault": "Show Visit Log segmented by this row", + "RowActionTooltipWithDimension": "Show Visit Log segmented by this %s", + "RowActionTooltipTitle": "Open segmented Visit Log", + "SegmentedVisitorLogTitle": "Visit Log showing visits where %1$s is \"%2$s\"", "OnClickPause": "%s is started. Click to pause.", "OnClickStart": "%s is stopped. Click to start." } -}
\ No newline at end of file +} diff --git a/plugins/Live/stylesheets/live.less b/plugins/Live/stylesheets/live.less index 5667451019..3d2c477d57 100644 --- a/plugins/Live/stylesheets/live.less +++ b/plugins/Live/stylesheets/live.less @@ -14,6 +14,13 @@ } } +.card { + #visitsLive { + margin-left: -20px; + margin-right: -20px; + } +} + #visitsLive .settings { border-bottom: 1px solid @color-silver-l90; } @@ -434,6 +441,15 @@ a.visitor-log-visitor-profile-link { } } +@media only screen and (min-width: 800px) { + .card #visitsLive .visitorLogIcons:before { + content: none; + } + .card #visitsLive .referrer { + float: right; + } +} + @media only screen and (max-width: 600px) { .own-visitor-column { margin: 10px 0; diff --git a/plugins/Live/templates/index.twig b/plugins/Live/templates/index.twig index a908f77434..b1c20e1a3a 100644 --- a/plugins/Live/templates/index.twig +++ b/plugins/Live/templates/index.twig @@ -32,6 +32,8 @@ }); </script> +{% if not isWidgetized %}<div piwik-content-block content-title="{{ 'Live_VisitorsInRealTime'|translate|e('html_attr') }}">{% endif %} + {% include "@Live/_totalVisitors.twig" %} {{ visitors|raw }} @@ -50,3 +52,5 @@ {% endif %} </div> {% endspaceless %} + +{% if not isWidgetized %}</div>{% endif %}
\ No newline at end of file diff --git a/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log.png b/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log.png index a4bf78b72e..2634d4c684 100644 --- a/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log.png +++ b/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:02f8f32c2da715a40564b20bb919d89fae517f9cbac6d76d36694f734e33b00b -size 401164 +oid sha256:7cdfc97f47384c8e455378b4e35316d4217f82210b92617d2caf93c76c076336 +size 401446 diff --git a/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log_purged.png b/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log_purged.png index a97bc05045..3d2495240f 100644 --- a/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log_purged.png +++ b/plugins/Live/tests/UI/expected-screenshots/Live_visitor_log_purged.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:687d1acb2de9411f1b1a53a259aa857f34e3ca4ee56300d8c8a7d87e456db351 -size 21942 +oid sha256:3842f59a2d202904c85ce2fd66a8ba22792ca44c34eaa3f1beebabba78a1694d +size 22152 |