Milimetric has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/344114 )

Change subject: Support reportcard in Dashiki
......................................................................


Support reportcard in Dashiki

- Adds a new metric in the dashiki configuration so that we can
generate dashboards using the new legacy pageviews endpoint in
AQS.

- Adds support to use the tabs layout with AQS endpoints

- Adds support for multiple project queries in tabs

Bug: T143906
Change-Id: I4f6afafca37968dc2845decac537c10e8617ee23
---
M package.json
M src/app/apis/aqs-api.js
M src/app/config.js
M src/app/sitematrix.js
M src/components/visualizers/visualizer/visualizer.js
5 files changed, 46 insertions(+), 5 deletions(-)

Approvals:
  Milimetric: Verified; Looks good to me, approved



diff --git a/package.json b/package.json
index 5e796a2..beea58a 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
     "mediawiki-storage": 
"https://github.com/wikimedia/analytics-mediawiki-storage/archive/master.tar.gz";,
     "moment": "^2.15.1",
     "numeral": "^1.5.3",
-    "pageviews": "^1.1.0",
+    "pageviews": "^1.3.0",
     "requirejs": "^2.3.2",
     "requirejs-text": "^2.0.12",
     "semantic-datepicker": 
"https://github.com/milimetric/semantic-ui-daterangepicker/archive/master.tar.gz";,
diff --git a/src/app/apis/aqs-api.js b/src/app/apis/aqs-api.js
index 4b92f44..8f339d2 100644
--- a/src/app/apis/aqs-api.js
+++ b/src/app/apis/aqs-api.js
@@ -92,7 +92,8 @@
 
                 // Datasets are disjoint but we need to add them so that
                 // the timeseries object makes sense.
-                deferred.resolve(timeseries);
+                var ts = TimeseriesData.mergeAll(timeseries)
+                deferred.resolve(ts);
 
             }, function (reason) {
                 deferred.resolve(new TimeseriesData());
diff --git a/src/app/config.js b/src/app/config.js
index bc78749..1b4cfb1 100644
--- a/src/app/config.js
+++ b/src/app/config.js
@@ -70,6 +70,22 @@
                 breakdownParameter: 'access',
                 dataStart: '2015010100'
             },
+            'LegacyPagecounts': {
+                endpoint: 'getAggregatedLegacyPagecounts',
+                valueField: 'count',
+                dateFormat: {
+                    'hourly': 'YYYYMMDDHH',
+                    'daily': 'YYYYMMDD00',
+                    'monthly': 'YYYYMM0100'
+                },
+                breakdownOptions: {
+                    'All': 'all-sites',
+                    'Desktop site': 'desktop-site',
+                    'Mobile site': 'mobile-site'
+                },
+                breakdownParameter: 'access-site',
+                dataStart: '2007120918'
+            },
             // these two metrics come from the same place
             // just granularity is different and that is configured on metric 
itself
             'UniqueDevices': uniqueDevicesConfig,
diff --git a/src/app/sitematrix.js b/src/app/sitematrix.js
index 1bdd7f5..36a752a 100644
--- a/src/app/sitematrix.js
+++ b/src/app/sitematrix.js
@@ -30,7 +30,8 @@
         if (Sitematrix.loaded === null) {
             // in the special case when project is "all", resolve to 
"all-projects"
             var cache = {
-                all: 'all-projects',
+                'all': 'all-projects',
+                'all-projects':'all-projects'
             };
 
             Sitematrix.loaded = new $.Deferred();
diff --git a/src/components/visualizers/visualizer/visualizer.js 
b/src/components/visualizers/visualizer/visualizer.js
index 181c9ee..19002a9 100644
--- a/src/components/visualizers/visualizer/visualizer.js
+++ b/src/components/visualizers/visualizer/visualizer.js
@@ -13,8 +13,9 @@
     require('knockout.datepicker');
 
     function Visualizer(params) {
+        var apiType = params.aqs? 'aqsApi' : 'datasets';
         var api = apiFinder({
-                api: 'datasets'
+                api: apiType
             }),
             graph = ko.unwrap(params);
 
@@ -38,7 +39,29 @@
         }
 
         this.data = ko.observable(new TimeseriesData());
-        api.getData(graph, 'all').done(this.data);
+
+        // don't love this , the point of having an api finder is to have a 
common interface
+        // for apis such it doesn't matter which one we are using
+        if (apiType === 'aqsApi'){
+            var aqs = params.aqs;
+            var projects = aqs.projects;
+
+            // no changes should be needed to api if we wait until all 
promises are resolved to render
+            var promises = projects.map(function (project) {
+                    return api.getData({'name':aqs.name, 
'granularity':aqs.granularity}, project);
+            });
+
+            //invoqued when all promises are done
+            Promise.all(promises).then(function (data) {
+                this.data(TimeseriesData.mergeAll(data));
+            }.bind(this));
+
+
+        } else {
+            api.getData(graph, 'all').done(this.data);
+        }
+
+
 
         this.startDate = ko.observable(graph.startDate);
         this.minDate = ko.observable(graph.startDate);

-- 
To view, visit https://gerrit.wikimedia.org/r/344114
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4f6afafca37968dc2845decac537c10e8617ee23
Gerrit-PatchSet: 9
Gerrit-Project: analytics/dashiki
Gerrit-Branch: master
Gerrit-Owner: Fdans <[email protected]>
Gerrit-Reviewer: Milimetric <[email protected]>
Gerrit-Reviewer: Nuria <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to