diff options
author | Zoltan Flamis <zoltan@innocraft.com> | 2021-05-27 05:05:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-27 05:05:54 +0300 |
commit | 14ffece034f8920a7ae6375c191a7af2a02f1fb5 (patch) | |
tree | 92bec16f349dae190dca354626c1afa7314078bf /plugins/CoreHome | |
parent | c973567705a0065fdd7d7c7b11b80f1f0f1be350 (diff) |
Show report generated time when date range includes today (#17506)
* wip
* wip
* report generated tooltip
* show only if date includes today
* show generated date for evo graphs
* add and use new clock icon
* force html formatter
* delete metadata from api response for multisite API
* redo show report generated for evo graph
* fix ui tests
* Update Archive.php
Diffstat (limited to 'plugins/CoreHome')
4 files changed, 37 insertions, 5 deletions
diff --git a/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html b/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html index 63f84b2146..f5d673b589 100644 --- a/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html +++ b/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html @@ -23,6 +23,8 @@ title="{{ featureName }}"></div> </span> + <div ng-show="showReportGenerated" class="icon-clock report-generated"></div> + <div class="inlineHelp" ng-show="view.showInlineHelp"> <div ng-bind-html="inlineHelp"></div> <a ng-if="helpUrl" diff --git a/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.js b/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.js index 930579d8b2..93afe6ed99 100644 --- a/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.js +++ b/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.js @@ -28,16 +28,22 @@ * </h2> * -> alternative definition for inline help * -> shows help icon to display inline help on click. Note: You can combine inlinehelp and help-url + * + * * <h2 piwik-enriched-headline report-generated="generated time">Pages report</h2> + * -> reportGenerated specified via this attribute shows a clock icon with a tooltip which activated by hover + * -> the tooltip shows the value of the attribute */ (function () { angular.module('piwikApp').directive('piwikEnrichedHeadline', piwikEnrichedHeadline); - piwikEnrichedHeadline.$inject = ['$document', 'piwik', '$filter', '$parse']; + piwikEnrichedHeadline.$inject = ['$document', 'piwik', '$filter', '$parse', 'piwikPeriods']; - function piwikEnrichedHeadline($document, piwik, $filter, $parse){ + function piwikEnrichedHeadline($document, piwik, $filter, $parse, piwikPeriods){ var defaults = { helpUrl: '', - editUrl: '' + editUrl: '', + reportGenerated: '', + showReportGenerated: '', }; return { @@ -46,8 +52,10 @@ scope: { helpUrl: '@', editUrl: '@', + reportGenerated: '@?', featureName: '@', - inlineHelp: '@?' + inlineHelp: '@?', + showReportGenerated: '=?' }, templateUrl: 'plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html?cb=' + piwik.cacheBuster, compile: function (element, attrs) { @@ -87,8 +95,20 @@ if (!attrs.featureName) { attrs.featureName = $.trim(element.find('.title').first().text()); } + + if (scope.reportGenerated && piwikPeriods.parse(piwik.period, piwik.currentDateString).containsToday()) { + element.find('.report-generated').first().tooltip({ + track: true, + content: scope.reportGenerated, + items: 'div', + show: false, + hide: false + }); + + scope.showReportGenerated = '1'; + } }; } }; } -})();
\ No newline at end of file +})(); diff --git a/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.less b/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.less index cb3c1c4ad8..17f7eec7c2 100644 --- a/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.less +++ b/plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.less @@ -62,4 +62,13 @@ text-decoration: none; } } + + .report-generated { + float: right; + cursor: pointer; + font-size: 14px; + color:#888; + opacity: 0.3; + line-height: 32px; + } } diff --git a/plugins/CoreHome/templates/_dataTable.twig b/plugins/CoreHome/templates/_dataTable.twig index b13fdaea2c..9cc562a977 100644 --- a/plugins/CoreHome/templates/_dataTable.twig +++ b/plugins/CoreHome/templates/_dataTable.twig @@ -13,6 +13,7 @@ {% if properties.title %} <h2 class="card-title" {% if properties.title_edit_entity_url %}edit-url="{{ properties.title_edit_entity_url }}"{% endif %} + {% if reportLastUpdatedMessage is defined and reportLastUpdatedMessage %}report-generated="{{ reportLastUpdatedMessage|raw }}"{% endif %} piwik-enriched-headline >{{ properties.title }}</h2> {% endif %} |