Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded dashboard error is always in English #27426

Closed
3 tasks done
Ralkion opened this issue Mar 7, 2024 · 2 comments · Fixed by #29782
Closed
3 tasks done

Embedded dashboard error is always in English #27426

Ralkion opened this issue Mar 7, 2024 · 2 comments · Fixed by #29782

Comments

@Ralkion
Copy link
Contributor

Ralkion commented Mar 7, 2024

Bug description

If a failure occurs while attempting to load an embedded dashboard, the error message displayed is always in English.

In the example below, the guest token is invalid. The server is configured to only use French (as laid out in the reproduction steps).

How to reproduce the bug

Reproduction steps below utilize docker-compose, based on the current master branch.

  1. Create the local config file (docker/pythonpath_dev/superset_config_docker.py), and configure it to use French:
LANGUAGES = {
    "fr": {"flag": "fr", "name": "French"}
}

SECRET_KEY="password1234"
FEATURE_FLAGS = {"ALERT_REPORTS": True, "EMBEDDED_SUPERSET": True}
BABEL_DEFAULT_LOCALE = "fr"
  1. Modify your nginx config file (docker/nginx/nginx.conf) to allow for embedding
# Inside http > server > location /
# Add the following lines:
            proxy_hide_header   X-Frame-Options;
            add_header X-Frame-Options ALLOWALL always;
  1. docker-compose up
  2. Wait for superset_init to load the examples DB (takes some time)
  3. Create a local web-server that can host an HTML file (I used live server in VS Code). Take note of the port that will be used by the web-server (in my case, :5500).
  4. Open up superset in your http://localhost and login. Observe that the site is displayed in French (as configured).
  5. Pick any dashboard. Open the Embedding dialog via the dashboard options ... > Embed Dashboard button.
  6. Allow the local webserver to embed the dashboard by entering it in the text field (in my case, http://127.0.0.1:5500), then click "Save Changes". Take note of the generated UUID for the dashboard.
  7. Create the following HTML file in your local web-server (be sure to replace the UUID in the options):
<html>
<head>
</head>
<body>
  <div class="container" id="container"></div>

  <script src="https://unpkg.com/superset-embedded-sdk"></script>
  <script>
    supersetEmbeddedSdk.embedDashboard({
      id: '<insert embedded id here>', // given by the Superset embedding UI
      supersetDomain: 'http://localhost',
      mountPoint: document.getElementById('container'), // any html element that can contain an iframe
      fetchGuestToken: () => 'asdfasdcad', // guest_token
      dashboardUiConfig: {
        urlParams: {
          lang: 'fr'
        }
      } // dashboard UI config: hideTitle, hideTab, hideChartControls (optional)
    });
  </script>
</body>
</html>
  1. Open your local webserver http://127.0.0.1:5500 and observe the English error message.

Screenshots/recordings

image

image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

The code is actually hard-coded to use English. However I have a patch that I'll be creating (to be linked shortly) to fix this, and it still doesn't solve the problem.

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@Ralkion
Copy link
Contributor Author

Ralkion commented Mar 7, 2024

The related PR adds the translatable strings, but does not solve the issue. Even with the translation function added, and the translation strings defined, the error still exists.

@rusackas
Copy link
Member

At risk of duplicating efforts, I opened a similar PR here using the latest translation scripts, which have been revised a bit since this was opened. Wish me luck!
#29782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants