mirror of
https://github.com/apache/superset.git
synced 2026-07-27 09:02:29 +00:00
Compare commits
4 Commits
dependabot
...
fix-transl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42379a8253 | ||
|
|
d62a1771e9 | ||
|
|
ad1c976305 | ||
|
|
efeb981626 |
@@ -32,6 +32,7 @@ import {
|
|||||||
} from '@apache-superset/core/theme';
|
} from '@apache-superset/core/theme';
|
||||||
import Switchboard from '@superset-ui/switchboard';
|
import Switchboard from '@superset-ui/switchboard';
|
||||||
import getBootstrapData, { applicationRoot } from 'src/utils/getBootstrapData';
|
import getBootstrapData, { applicationRoot } from 'src/utils/getBootstrapData';
|
||||||
|
import initPreamble from 'src/preamble';
|
||||||
import setupClient from 'src/setup/setupClient';
|
import setupClient from 'src/setup/setupClient';
|
||||||
import setupPlugins from 'src/setup/setupPlugins';
|
import setupPlugins from 'src/setup/setupPlugins';
|
||||||
import { useUiConfig } from 'src/components/UiConfigContext';
|
import { useUiConfig } from 'src/components/UiConfigContext';
|
||||||
@@ -50,8 +51,19 @@ import { embeddedApi } from './api';
|
|||||||
import { getDataMaskChangeTrigger } from './utils';
|
import { getDataMaskChangeTrigger } from './utils';
|
||||||
import { validateMessageEvent } from './originValidation';
|
import { validateMessageEvent } from './originValidation';
|
||||||
|
|
||||||
setupPlugins();
|
// Defer plugin setup until after the language pack loads to prevent t() calls in
|
||||||
setupCodeOverrides({ embedded: true });
|
// plugin control panel configs from being cached in English before translations are ready.
|
||||||
|
const pluginsReady = initPreamble()
|
||||||
|
.catch(err => {
|
||||||
|
logging.warn(
|
||||||
|
'Preamble initialization failed, loading plugins without translations.',
|
||||||
|
err,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
setupPlugins();
|
||||||
|
setupCodeOverrides({ embedded: true });
|
||||||
|
});
|
||||||
|
|
||||||
const debugMode = process.env.WEBPACK_MODE === 'development';
|
const debugMode = process.env.WEBPACK_MODE === 'development';
|
||||||
const bootstrapData = getBootstrapData();
|
const bootstrapData = getBootstrapData();
|
||||||
@@ -172,32 +184,34 @@ function start() {
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
endpoint: '/api/v1/me/roles/',
|
endpoint: '/api/v1/me/roles/',
|
||||||
});
|
});
|
||||||
return getMeWithRole().then(
|
return pluginsReady.then(() =>
|
||||||
({ result }) => {
|
getMeWithRole().then(
|
||||||
// fill in some missing bootstrap data
|
({ result }) => {
|
||||||
// (because at pageload, we don't have any auth yet)
|
// fill in some missing bootstrap data
|
||||||
// this allows the frontend's permissions checks to work.
|
// (because at pageload, we don't have any auth yet)
|
||||||
bootstrapData.user = result;
|
// this allows the frontend's permissions checks to work.
|
||||||
store.dispatch({
|
bootstrapData.user = result;
|
||||||
type: USER_LOADED,
|
store.dispatch({
|
||||||
user: result,
|
type: USER_LOADED,
|
||||||
});
|
user: result,
|
||||||
if (!root) {
|
});
|
||||||
root = createRoot(appMountPoint);
|
if (!root) {
|
||||||
}
|
root = createRoot(appMountPoint);
|
||||||
root.render(<EmbeddedApp />);
|
}
|
||||||
},
|
root.render(<EmbeddedApp />);
|
||||||
err => {
|
},
|
||||||
// something is most likely wrong with the guest token; reset the guard
|
err => {
|
||||||
// so a rehandshake with a valid token can retry.
|
// something is most likely wrong with the guest token; reset the guard
|
||||||
logging.error(err);
|
// so a rehandshake with a valid token can retry.
|
||||||
showFailureMessage(
|
logging.error(err);
|
||||||
t(
|
showFailureMessage(
|
||||||
'Something went wrong with embedded authentication. Check the dev console for details.',
|
t(
|
||||||
),
|
'Something went wrong with embedded authentication. Check the dev console for details.',
|
||||||
);
|
),
|
||||||
started = false;
|
);
|
||||||
},
|
started = false;
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { ThemeProvider } from '@apache-superset/core/theme';
|
|||||||
import { theme } from '@apache-superset/core/theme';
|
import { theme } from '@apache-superset/core/theme';
|
||||||
import Menu from 'src/features/home/Menu';
|
import Menu from 'src/features/home/Menu';
|
||||||
import getBootstrapData from 'src/utils/getBootstrapData';
|
import getBootstrapData from 'src/utils/getBootstrapData';
|
||||||
|
import initPreamble from 'src/preamble';
|
||||||
import { setupStore } from './store';
|
import { setupStore } from './store';
|
||||||
import querystring from 'query-string';
|
import querystring from 'query-string';
|
||||||
|
|
||||||
@@ -67,5 +68,9 @@ const app = (
|
|||||||
|
|
||||||
const menuMountPoint = document.getElementById('app-menu');
|
const menuMountPoint = document.getElementById('app-menu');
|
||||||
if (menuMountPoint) {
|
if (menuMountPoint) {
|
||||||
createRoot(menuMountPoint).render(app);
|
initPreamble()
|
||||||
|
.catch(() => {}) // preamble logs failures internally; always render the menu
|
||||||
|
.then(() => {
|
||||||
|
createRoot(menuMountPoint).render(app);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user