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:
Diffstat (limited to 'plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js')
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js10
1 files changed, 9 insertions, 1 deletions
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 3cc5b3d4b2..87d3f92fe6 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
@@ -15,7 +15,8 @@
customVariables : [],
extractions : [],
isLoading: false,
- fetchUsages: fetchUsages
+ fetchUsages: fetchUsages,
+ numSlotsAvailable: 5,
};
return model;
@@ -27,6 +28,13 @@
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;
+ }
+ });
+
})['finally'](function () { // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c
model.isLoading = false;
});