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

refactor: Removes embedded/index.tsx warnings #20193

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions superset-frontend/src/embedded/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import React, { lazy, Suspense } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import { makeApi, t } from '@superset-ui/core';
import { makeApi, t, logging } from '@superset-ui/core';
import { Switchboard } from '@superset-ui/switchboard';
import { bootstrapData } from 'src/preamble';
import setupClient from 'src/setup/setupClient';
Expand All @@ -35,7 +35,7 @@ const debugMode = process.env.WEBPACK_MODE === 'development';

function log(...info: unknown[]) {
if (debugMode) {
console.debug(`[superset]`, ...info);
logging.debug(`[superset]`, ...info);
}
}

Expand Down Expand Up @@ -69,16 +69,16 @@ const appMountPoint = document.getElementById('app')!;

const MESSAGE_TYPE = '__embedded_comms__';

function showFailureMessage(message: string) {
appMountPoint.innerHTML = message;
}

if (!window.parent || window.parent === window) {
showFailureMessage(
'This page is intended to be embedded in an iframe, but it looks like that is not the case.',
);
}

function showFailureMessage(message: string) {
appMountPoint.innerHTML = message;
}

// if the page is embedded in an origin that hasn't
// been authorized by the curator, we forbid access entirely.
// todo: check the referrer on the route serving this page instead
Expand Down Expand Up @@ -134,7 +134,7 @@ function start() {
},
err => {
// something is most likely wrong with the guest token
console.error(err);
logging.error(err);
showFailureMessage(
'Something went wrong with embedded authentication. Check the dev console for details.',
);
Expand Down