mirror of
https://github.com/apache/superset.git
synced 2024-09-16 02:29:39 -04:00
Fix add chart page frontend i18n issue (#9321)
This commit is contained in:
parent
45fee60b62
commit
0f44d3edf2
@ -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') || '{}',
|
||||
);
|
||||
|
@ -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'));
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
{% block body %}
|
||||
<div
|
||||
id="js-add-slice-container"
|
||||
id="app"
|
||||
data-bootstrap="{{ bootstrap_data }}"
|
||||
></div>
|
||||
{% endblock %}
|
||||
|
@ -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/")
|
||||
|
Loading…
Reference in New Issue
Block a user