Skip to content

Commit

Permalink
Adds option to format metrics in export overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed May 31, 2018
1 parent 3c47e97 commit 89d936c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions plugins/CoreHome/CoreHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'CoreHome_DataTableExcludeAggregateRows';
$translationKeys[] = 'CoreHome_Default';
$translationKeys[] = 'CoreHome_PageOf';
$translationKeys[] = 'CoreHome_FormatMetrics';
$translationKeys[] = 'CoreHome_FlattenDataTable';
$translationKeys[] = 'CoreHome_UnFlattenDataTable';
$translationKeys[] = 'CoreHome_ExternalHelp';
Expand Down
17 changes: 11 additions & 6 deletions plugins/CoreHome/angularjs/report-export/reportexport.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
exportUrlParams.expanded = 1;
}

if (scope.optionFormatMetrics) {
exportUrlParams.format_metrics = 1;
}

if (dataTable.param.pivotBy) {
exportUrlParams.pivotBy = dataTable.param.pivotBy;
exportUrlParams.pivotByColumnLimit = 20;
Expand Down Expand Up @@ -166,12 +170,13 @@
var popover = Piwik_Popover.showLoading('Export');
var formats = JSON.parse(scope.reportFormats);

scope.reportType = 'default';
scope.reportLimit = dataTable.param.filter_limit > 0 ? dataTable.param.filter_limit : 100;
scope.reportLimitAll = dataTable.param.filter_limit == -1 ? 'yes' : 'no';
scope.optionFlat = dataTable.param.flat;
scope.optionExpanded = 1;
scope.hasSubtables = dataTable.param.flat == 1 || dataTable.numberOfSubtables > 0;
scope.reportType = 'default';
scope.reportLimit = dataTable.param.filter_limit > 0 ? dataTable.param.filter_limit : 100;
scope.reportLimitAll = dataTable.param.filter_limit == -1 ? 'yes' : 'no';
scope.optionFlat = dataTable.param.flat;
scope.optionExpanded = 1;
scope.optionFormatMetrics = 0;
scope.hasSubtables = dataTable.param.flat == 1 || dataTable.numberOfSubtables > 0;

scope.availableReportFormats = {
default: formats,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
ng-model="$parent.optionExpanded" ng-show="$parent.hasSubtables && !$parent.optionFlat"
>
</div>
<div piwik-field uicontrol="checkbox" name="option_format_metrics"
title="{{ 'CoreHome_FormatMetrics'|translate }}"
ng-model="$parent.optionFormatMetrics"
>
</div>
</div>

<div class="col l6">
Expand Down
1 change: 1 addition & 0 deletions plugins/CoreHome/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ExcludeRowsWithLowPopulation": "All rows are shown %s Exclude low population",
"ExternalHelp": "Help (opens in new tab)",
"FlattenDataTable": "The report is hierarchical %s Make it flat",
"FormatMetrics": "Format metrics",
"HomeShortcut": "Home",
"HowMuchIsPiwikWorth": "How much is Matomo worth to you?",
"IncludeRowsWithLowPopulation": "Rows with low population are hidden %s Show all rows",
Expand Down

0 comments on commit 89d936c

Please sign in to comment.