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

villebro 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 0f44d3e  Fix add chart page frontend i18n issue (#9321)
0f44d3e is described below

commit 0f44d3edf25b194984255d84f70fce29c8c70ba4
Author: auxten <[email protected]>
AuthorDate: Sun Aug 23 02:04:18 2020 +0800

    Fix add chart page frontend i18n issue (#9321)
---
 superset-frontend/src/addSlice/App.tsx     |  2 +-
 superset-frontend/src/addSlice/index.tsx   |  2 +-
 superset/templates/superset/add_slice.html |  2 +-
 superset/views/chart/views.py              | 16 +++++++++++-----
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/superset-frontend/src/addSlice/App.tsx 
b/superset-frontend/src/addSlice/App.tsx
index 4443fb5..7fdb05d 100644
--- a/superset-frontend/src/addSlice/App.tsx
+++ b/superset-frontend/src/addSlice/App.tsx
@@ -26,7 +26,7 @@ import AddSliceContainer from './AddSliceContainer';
 setupApp();
 setupPlugins();
 
-const addSliceContainer = document.getElementById('js-add-slice-container');
+const addSliceContainer = document.getElementById('app');
 const bootstrapData = JSON.parse(
   addSliceContainer?.getAttribute('data-bootstrap') || '{}',
 );
diff --git a/superset-frontend/src/addSlice/index.tsx 
b/superset-frontend/src/addSlice/index.tsx
index 09b6de2..c257009 100644
--- a/superset-frontend/src/addSlice/index.tsx
+++ b/superset-frontend/src/addSlice/index.tsx
@@ -20,4 +20,4 @@ import React from 'react';
 import ReactDOM from 'react-dom';
 import App from './App';
 
-ReactDOM.render(<App />, document.getElementById('js-add-slice-container'));
+ReactDOM.render(<App />, document.getElementById('app'));
diff --git a/superset/templates/superset/add_slice.html 
b/superset/templates/superset/add_slice.html
index 6d22b1d..b287de6 100644
--- a/superset/templates/superset/add_slice.html
+++ b/superset/templates/superset/add_slice.html
@@ -24,7 +24,7 @@
 
 {% block body %}
   <div
-    id="js-add-slice-container"
+    id="app"
     data-bootstrap="{{ bootstrap_data }}"
   ></div>
 {% endblock %}
diff --git a/superset/views/chart/views.py b/superset/views/chart/views.py
index 0523e33..b2ecc5e 100644
--- a/superset/views/chart/views.py
+++ b/superset/views/chart/views.py
@@ -26,7 +26,12 @@ from superset.constants import RouteMethod
 from superset.models.slice import Slice
 from superset.typing import FlaskResponse
 from superset.utils import core as utils
-from superset.views.base import check_ownership, DeleteMixin, SupersetModelView
+from superset.views.base import (
+    check_ownership,
+    common_bootstrap_payload,
+    DeleteMixin,
+    SupersetModelView,
+)
 from superset.views.chart.mixin import SliceMixin
 
 
@@ -58,11 +63,12 @@ class SliceModelView(
             {"value": str(d.id) + "__" + d.type, "label": repr(d)}
             for d in ConnectorRegistry.get_all_datasources(db.session)
         ]
+        payload = {
+            "datasources": sorted(datasources, key=lambda d: d["label"]),
+            "common": common_bootstrap_payload(),
+        }
         return self.render_template(
-            "superset/add_slice.html",
-            bootstrap_data=json.dumps(
-                {"datasources": sorted(datasources, key=lambda d: d["label"])}
-            ),
+            "superset/add_slice.html", bootstrap_data=json.dumps(payload)
         )
 
     @expose("/list/")

Reply via email to