Welcome to mirror list, hosted at ThFree Co, Russian Federation.

manage-custom-vars.model.js « manage-custom-vars « angularjs « CustomVariables « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3cc5b3d4b27960779c21a07b6db1cf6b8f30dbc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*!
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
(function () {
    angular.module('piwikApp').factory('manageCustomVarsModel', manageCustomVarsModel);

    manageCustomVarsModel.$inject = ['piwikApi'];

    function manageCustomVarsModel(piwikApi) {

        var model = {
            customVariables : [],
            extractions : [],
            isLoading: false,
            fetchUsages: fetchUsages
        };

        return model;

        function fetchUsages() {

            model.isLoading = true;

            piwikApi.fetch({method: 'CustomVariables.getUsagesOfSlots'})
                .then(function (customVariables) {
                    model.customVariables = customVariables;
                })['finally'](function () {    // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c
                model.isLoading = false;
            });
        }

    }
})();