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

Change subject: Fix blocking problems with map component
......................................................................


Fix blocking problems with map component

Change-Id: I697e9d118f822da1dcde6ba32522a9fa1472e346
---
M src/components/detail/GraphPanel.vue
M src/components/detail/chart/MapChart/MapLegend.vue
M src/config/index.js
M src/config/metrics/contributing.js
M src/config/metrics/reading.js
5 files changed, 36 insertions(+), 30 deletions(-)

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



diff --git a/src/components/detail/GraphPanel.vue 
b/src/components/detail/GraphPanel.vue
index 23c400a..c183164 100644
--- a/src/components/detail/GraphPanel.vue
+++ b/src/components/detail/GraphPanel.vue
@@ -101,17 +101,32 @@
         StatusOverlay
     },
     props: ['fullscreen', 'graphModel', 'overlayMessage', 'granularity'],
+    data () {
+        return {
+            chartType: 'empty',
+            availableChartTypes: {
+                empty   : { chart: 'empty', icon: 'question' },
+                bar     : { chart: 'bar', icon: 'bar' },
+                line    : { chart: 'line', icon: 'line' },
+                map     : { chart: 'map', icon: 'globe' },
+                table   : { chart: 'table', icon: 'table' },
+            }
+        }
+    },
     computed: {
         chartTypes: function () {
-            return this.getChartTypes();
+            return !this.graphModel ? [] : {
+                map: ['map', 'table'],
+                bars: ['bar', 'table'],
+                lines: ['line', 'table'],
+                list: ['table'],
+            }[this.graphModel.config.type].map(k => 
this.availableChartTypes[k]);
         },
         chartIcon: function () {
-            return this.availableChartTypes.find(type => type.chart === 
this.chartComponent.replace('-chart', '')).icon;
+            return this.availableChartTypes[this.chartType].icon;
         },
         chartComponent: function () {
-            if (this.chartType) return this.chartType + '-chart';
-            let chartTypes = this.getChartTypes();
-            return (chartTypes[0].chart || 'empty') + '-chart';
+            return this.chartType  + '-chart';
         },
         aggregate: function () {
             return this.graphModel && this.graphModel.getAggregate();
@@ -124,16 +139,13 @@
             return this.graphModel.activeBreakdown;
         },
     },
-    data () {
-        return {
-            chartType: null,
-            availableChartTypes: [
-                { chart: 'bar', icon: 'bar' },
-                { chart: 'line', icon: 'line' },
-                { chart: 'map', icon: 'globe' },
-                { chart: 'table', icon: 'table' },
-            ]
-        }
+
+    watch: {
+        chartTypes () {
+            if (this.chartTypes.length) {
+                this.changeChart(this.chartTypes[0]);
+            }
+        },
     },
 
     methods: {
@@ -148,15 +160,6 @@
         },
         changeTimeRange (range) {
             this.$emit('changeTimeRange', range);
-        },
-        getChartTypes () {
-            return this.availableChartTypes.filter((c) => {
-                if (!this.graphModel) { return false; }
-                if (c.chart === 'table') return true;
-                if (c.chart === 'map') return true;
-                if (this.graphModel.config.type === 'bars') { return c.chart 
!== 'line'; }
-                if (this.graphModel.config.type === 'lines') { return c.chart 
=== 'line'; }
-            });
         },
         toggleFullscreen () {
             this.$emit('toggleFullscreen');
diff --git a/src/components/detail/chart/MapChart/MapLegend.vue 
b/src/components/detail/chart/MapChart/MapLegend.vue
index 0d5ab0d..78350d0 100644
--- a/src/components/detail/chart/MapChart/MapLegend.vue
+++ b/src/components/detail/chart/MapChart/MapLegend.vue
@@ -56,7 +56,7 @@
 .map.legend {
     width: 300px;
     position: absolute;
-    bottom: 10px;
+    bottom: 120px;
     right: 10px;
     background-color: rgba(255,255,255,0.8);
 }
@@ -74,4 +74,4 @@
     text-anchor: middle;
 }
 
-</style>
\ No newline at end of file
+</style>
diff --git a/src/config/index.js b/src/config/index.js
index dd515fb..b6ac8fa 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -99,7 +99,7 @@
             metrics: [
                 'total-pageviews',
                 'unique-devices',
-                'pageviews-by-country'
+                'top-viewed-articles'
             ]
         }
     },
@@ -128,7 +128,11 @@
 ];
 
 
-const metrics = require('./metrics');
+const allMetrics = require('./metrics');
+const metrics = {};
+
+Object.keys(allMetrics).filter(k => !(allMetrics[k].disabled))
+    .forEach(k => metrics[k] = allMetrics[k]);
 
 const questions = Object.keys(metrics).map(k => ({
     id: k,
diff --git a/src/config/metrics/contributing.js 
b/src/config/metrics/contributing.js
index 290d339..0850b86 100644
--- a/src/config/metrics/contributing.js
+++ b/src/config/metrics/contributing.js
@@ -1,6 +1,5 @@
 module.exports = {
     'editors': {
-        disabled: true,
         fullName: 'Editors',
         description: 'The count of editors with one or more edits, including 
on redirect pages',
         question: 'How many editors are there?',
@@ -91,7 +90,6 @@
         additive: true
     },
     'new-pages': {
-        disabled: true,
         fullName: 'New pages',
         description: 'The count of new pages created, excluding pages being 
redirects',
         question: 'How many new pages each month?',
diff --git a/src/config/metrics/reading.js b/src/config/metrics/reading.js
index 68d10db..f3ddd9f 100644
--- a/src/config/metrics/reading.js
+++ b/src/config/metrics/reading.js
@@ -25,6 +25,7 @@
         additive: true
     },
     'pageviews-by-country': {
+        disabled: true,
         fullName: 'Pageviews by Country',
         subtitle: 'Countries with the most views',
         description: 'Countries where this project is visited the most',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I697e9d118f822da1dcde6ba32522a9fa1472e346
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wikistats2
Gerrit-Branch: master
Gerrit-Owner: Milimetric <dandree...@wikimedia.org>
Gerrit-Reviewer: Fdans <fd...@wikimedia.org>
Gerrit-Reviewer: Milimetric <dandree...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to