You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by cc...@apache.org on 2018/09/11 22:51:19 UTC
[incubator-superset] 02/04: [superset-client] initialize
SupersetClient in app setup
This is an automated email from the ASF dual-hosted git repository.
ccwilliams pushed a commit to branch chris--ajax-dashboard
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 617128e590c71a517264de4e799697eda83f8083
Author: Chris Williams <ch...@airbnb.com>
AuthorDate: Mon Sep 10 22:03:48 2018 -0700
[superset-client] initialize SupersetClient in app setup
---
superset/assets/src/common.js | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/superset/assets/src/common.js b/superset/assets/src/common.js
index 67ce498..e23821e 100644
--- a/superset/assets/src/common.js
+++ b/superset/assets/src/common.js
@@ -1,16 +1,17 @@
-/* eslint-disable global-require */
+/* eslint global-require: 0, no-console: 0 */
import $ from 'jquery';
+import { SupersetClient } from '@superset-ui/core';
+
// Everything imported in this file ends up in the common entry file
// be mindful of double-imports
-
-const utils = require('./modules/utils');
+import { toggleCheckbox } from './modules/utils';
$(document).ready(function () {
$(':checkbox[data-checkbox-api-prefix]').change(function () {
const $this = $(this);
const prefix = $this.data('checkbox-api-prefix');
const id = $this.attr('id');
- utils.toggleCheckbox(prefix, '#' + id);
+ toggleCheckbox(prefix, '#' + id);
});
// for language picker dropdown
@@ -18,10 +19,9 @@ $(document).ready(function () {
ev.preventDefault();
const targetUrl = ev.currentTarget.href;
- $.ajax(targetUrl)
- .then(() => {
- location.reload();
- });
+ $.ajax(targetUrl).then(() => {
+ location.reload();
+ });
});
});
@@ -31,4 +31,10 @@ export function appSetup() {
window.$ = $;
window.jQuery = $;
require('bootstrap');
+
+ SupersetClient.configure({ host: (window.location && window.location.host) || '' })
+ .init()
+ .catch((error) => {
+ console.warn(error);
+ });
}