You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/04/03 00:48:58 UTC

[incubator-superset] branch master updated: Expose metrics to JS (#4654)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ab7ba20  Expose metrics to JS (#4654)
ab7ba20 is described below

commit ab7ba20009440c9b30febc47ec0233064b3bacf0
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Mon Apr 2 17:48:56 2018 -0700

    Expose metrics to JS (#4654)
---
 superset/assets/javascripts/modules/sandbox.js | 8 ++++++--
 superset/viz.py                                | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/superset/assets/javascripts/modules/sandbox.js b/superset/assets/javascripts/modules/sandbox.js
index 3439c03..a139013 100644
--- a/superset/assets/javascripts/modules/sandbox.js
+++ b/superset/assets/javascripts/modules/sandbox.js
@@ -22,6 +22,10 @@ export default function sandboxedEval(code, context, opts) {
   Object.keys(sandboxContext).forEach(function (key) {
     sandbox[key] = sandboxContext[key];
   });
-  vm.runInNewContext(codeToEval, sandbox, opts);
-  return sandbox[resultKey];
+  try {
+    vm.runInNewContext(codeToEval, sandbox, opts);
+    return sandbox[resultKey];
+  } catch (error) {
+    return () => error;
+  }
 }
diff --git a/superset/viz.py b/superset/viz.py
index 5d98d5e..5a92cd3 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -2048,6 +2048,7 @@ class DeckScatterViz(BaseDeckGLViz):
 
     def get_properties(self, d):
         return {
+            'metric': d.get(self.metric),
             'radius': self.fixed_value if self.fixed_value else d.get(self.metric),
             'cat_color': d.get(self.dim) if self.dim else None,
             'position': d.get('spatial'),

-- 
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.