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:
authorThomas Steur <thomas.steur@gmail.com>2015-11-03 23:39:55 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-11-04 23:02:11 +0300
commitbb84ed872104345bef6a7eca876e4a05dc0106d6 (patch)
tree555ec2f08f2d8e26d20623332cc3d6c31562fd40 /plugins/CustomVariables
parentbbe80a955404549c4df7391d368c559a82c0fa86 (diff)
show a warning if there are custom variables but no usages are shown
Diffstat (limited to 'plugins/CustomVariables')
-rw-r--r--plugins/CustomVariables/CustomVariables.php1
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html4
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less4
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js33
-rw-r--r--plugins/CustomVariables/lang/en.json3
5 files changed, 35 insertions, 10 deletions
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index 24525983cd..6f4796b7aa 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -160,6 +160,7 @@ class CustomVariables extends \Piwik\Plugin
$translationKeys[] = 'CustomVariables_CurrentAvailableCustomVariables';
$translationKeys[] = 'CustomVariables_ToCreateCustomVarExecute';
$translationKeys[] = 'CustomVariables_CreatingCustomVariableTakesTime';
+ $translationKeys[] = 'CustomVariables_SlotsReportIsGeneratedOverTime';
$translationKeys[] = 'General_Loading';
}
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html
index 2870295847..ccba542a87 100644
--- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html
@@ -5,6 +5,10 @@
<span ng-bind-html="'CustomVariables_ManageDescription'|translate:manageCustomVars.siteName"></span>
</p>
+ <div class="alert alert-info" ng-show="!manageCustomVars.model.isLoading && manageCustomVars.model.hasCustomVariablesInGeneral && !manageCustomVars.model.hasAtLeastOneUsage">
+ {{ 'CustomVariables_SlotsReportIsGeneratedOverTime'|translate }}
+ </div>
+
<div ng-repeat="scope in manageCustomVars.scopes">
<h2 class="secondary">{{ 'CustomVariables_ScopeX'|translate:(scope|ucfirst) }}</h2>
<table class="dataTable entityTable">
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less
index 3a37f84a43..b666abebca 100644
--- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less
@@ -7,6 +7,10 @@
width: 900px;
}
+ .alert-info {
+ margin-top: 15px;
+ }
+
.scope, .index {
width: 90px;
max-width: 90px;
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js
index 87d3f92fe6..ceb6442a8f 100644
--- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js
@@ -16,26 +16,41 @@
extractions : [],
isLoading: false,
fetchUsages: fetchUsages,
+ hasCustomVariablesInGeneral: false,
+ hasAtLeastOneUsage: false,
numSlotsAvailable: 5,
};
return model;
+ function fetchCustomVariables() {
+ return piwikApi.fetch({method: 'CustomVariables.getCustomVariables', period: 'year', date: 'today', filter_limit: 1})
+ .then(function (customVariables) {
+ model.hasCustomVariablesInGeneral = (customVariables && customVariables.length > 0);
+ });
+ }
+
function fetchUsages() {
model.isLoading = true;
- piwikApi.fetch({method: 'CustomVariables.getUsagesOfSlots'})
- .then(function (customVariables) {
- model.customVariables = customVariables;
+ fetchCustomVariables().then(function () {
+ return piwikApi.fetch({method: 'CustomVariables.getUsagesOfSlots'});
+
+ }).then(function (customVariables) {
+ model.customVariables = customVariables;
+
+ angular.forEach(customVariables, function (customVar) {
+ if (customVar.index > model.numSlotsAvailable) {
+ model.numSlotsAvailable = customVar.index;
+ }
- angular.forEach(customVariables, function (customVar) {
- if (customVar.index > model.numSlotsAvailable) {
- model.numSlotsAvailable = customVar.index;
- }
- });
+ if (customVar.usages && customVar.usages.length > 0) {
+ model.hasAtLeastOneUsage = true;
+ }
+ });
- })['finally'](function () { // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c
+ })['finally'](function () { // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c
model.isLoading = false;
});
}
diff --git a/plugins/CustomVariables/lang/en.json b/plugins/CustomVariables/lang/en.json
index 810cd19702..45052df4d9 100644
--- a/plugins/CustomVariables/lang/en.json
+++ b/plugins/CustomVariables/lang/en.json
@@ -16,6 +16,7 @@
"UsageDetails": "%s visits and %s actions since creation of this website.",
"CreatingCustomVariableTakesTime": "Creating a new custom variable slot can take a long time depending on the size of your database. Therefore it is only possible to do this via a command which needs to be executed on the command line.",
"CurrentAvailableCustomVariables": "Currently you can use up to %s Custom Variables per site.",
- "ToCreateCustomVarExecute": "To create a new custom variable slot execute the following command within your Piwik installation: "
+ "ToCreateCustomVarExecute": "To create a new custom variable slot execute the following command within your Piwik installation: ",
+ "SlotsReportIsGeneratedOverTime": "Data for this report will be populated over time. It may take a day or two to see any data and a few weeks until the report is fully accurate."
}
} \ No newline at end of file