You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/03 00:48:57 UTC

[GitHub] mistercrunch closed pull request #4654: Expose metrics to JS

mistercrunch closed pull request #4654: Expose metrics to JS
URL: https://github.com/apache/incubator-superset/pull/4654
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/javascripts/modules/sandbox.js b/superset/assets/javascripts/modules/sandbox.js
index 3439c0319f..a139013d59 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 0c55262325..ebcbac4a93 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -2037,6 +2037,7 @@ def get_metrics(self):
 
     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'),


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services