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

ccwilliams pushed a commit to branch chris--ajax-charts
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit d3daf83f7ed239328962473e87b5c491777521c0
Author: Chris Williams <chris.willi...@airbnb.com>
AuthorDate: Mon Sep 10 22:03:48 2018 -0700

    [superset-client] initialize SupersetClient in app setup
---
 superset/assets/src/common.js | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/superset/assets/src/common.js b/superset/assets/src/common.js
index 69c2556..5fe9bd0 100644
--- a/superset/assets/src/common.js
+++ b/superset/assets/src/common.js
@@ -1,14 +1,12 @@
-/* eslint-disable global-require */
+/* eslint global-require: 0, no-console: 0 */
 import $ from 'jquery';
+import { SupersetClient } from '@superset-ui/core';
 import airbnb from './modules/colorSchemes/airbnb';
 import categoricalSchemes from './modules/colorSchemes/categorical';
 import lyft from './modules/colorSchemes/lyft';
 import { getInstance } from './modules/ColorSchemeManager';
 import { toggleCheckbox } from './modules/utils';
 
-// Everything imported in this file ends up in the common entry file
-// be mindful of double-imports
-
 $(document).ready(function () {
   $(':checkbox[data-checkbox-api-prefix]').change(function () {
     const $this = $(this);
@@ -22,10 +20,9 @@ $(document).ready(function () {
     ev.preventDefault();
 
     const targetUrl = ev.currentTarget.href;
-    $.ajax(targetUrl)
-      .then(() => {
-        location.reload();
-      });
+    $.ajax(targetUrl).then(() => {
+      location.reload();
+    });
   });
 });
 
@@ -42,4 +39,10 @@ export function appSetup() {
   window.$ = $;
   window.jQuery = $;
   require('bootstrap');
+
+  SupersetClient.configure({ host: (window.location && window.location.host) 
|| '' })
+    .init()
+    .catch((error) => {
+      console.warn(error);
+    });
 }

Reply via email to