From 925bb91d8ea383b451382dd04b9f04cf8f432b20 Mon Sep 17 00:00:00 2001 From: Eric Radman Date: Wed, 12 Feb 2025 08:37:40 -0500 Subject: [PATCH] Use absolute path for image resources (#7322) When MULTI_ORG is enabled, 'static/' resolves to '/static/' --- client/app/components/PreviewCard.jsx | 2 +- .../app/components/empty-state/EmptyState.jsx | 6 +++--- .../components/QuerySourceTypeIcon.jsx | 2 +- .../components/QueryVisualizationTabs.jsx | 19 +++++++++++-------- client/app/services/data-source.js | 16 ++++++++-------- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/client/app/components/PreviewCard.jsx b/client/app/components/PreviewCard.jsx index ea652e96d7..de2c26b79d 100644 --- a/client/app/components/PreviewCard.jsx +++ b/client/app/components/PreviewCard.jsx @@ -69,7 +69,7 @@ UserPreviewCard.defaultProps = { // DataSourcePreviewCard export function DataSourcePreviewCard({ dataSource, withLink, children, ...props }) { - const imageUrl = `static/images/db-logos/${dataSource.type}.png`; + const imageUrl = `/static/images/db-logos/${dataSource.type}.png`; const title = withLink ? {dataSource.name} : dataSource.name; return ( diff --git a/client/app/components/empty-state/EmptyState.jsx b/client/app/components/empty-state/EmptyState.jsx index 1bc3ce9ddd..eeea9fd6c5 100644 --- a/client/app/components/empty-state/EmptyState.jsx +++ b/client/app/components/empty-state/EmptyState.jsx @@ -96,7 +96,7 @@ function EmptyState({ }, []); // Show if `onboardingMode=false` or any requested step not completed - const shouldShow = !onboardingMode || some(keys(isAvailable), step => isAvailable[step] && !isCompleted[step]); + const shouldShow = !onboardingMode || some(keys(isAvailable), (step) => isAvailable[step] && !isCompleted[step]); if (!shouldShow) { return null; @@ -181,7 +181,7 @@ function EmptyState({ ]; const stepsItems = getStepsItems ? getStepsItems(defaultStepsItems) : defaultStepsItems; - const imageSource = illustrationPath ? illustrationPath : "static/images/illustrations/" + illustration + ".svg"; + const imageSource = illustrationPath ? illustrationPath : "/static/images/illustrations/" + illustration + ".svg"; return (
@@ -196,7 +196,7 @@ function EmptyState({

Let's get started

-
    {stepsItems.map(item => item.node)}
+
    {stepsItems.map((item) => item.node)}
{helpMessage}
diff --git a/client/app/pages/queries/components/QuerySourceTypeIcon.jsx b/client/app/pages/queries/components/QuerySourceTypeIcon.jsx index a9cb210831..ef639ee9c8 100644 --- a/client/app/pages/queries/components/QuerySourceTypeIcon.jsx +++ b/client/app/pages/queries/components/QuerySourceTypeIcon.jsx @@ -2,7 +2,7 @@ import PropTypes from "prop-types"; import React from "react"; export function QuerySourceTypeIcon(props) { - return {props.alt}; + return {props.alt}; } QuerySourceTypeIcon.propTypes = { diff --git a/client/app/pages/queries/components/QueryVisualizationTabs.jsx b/client/app/pages/queries/components/QueryVisualizationTabs.jsx index 60785e3b5f..555fd029a8 100644 --- a/client/app/pages/queries/components/QueryVisualizationTabs.jsx +++ b/client/app/pages/queries/components/QueryVisualizationTabs.jsx @@ -18,7 +18,7 @@ function EmptyState({ title, message, refreshButton }) {
- No Query Results Illustration + No Query Results Illustration

{title}

{message}
@@ -40,7 +40,7 @@ EmptyState.defaultProps = { function TabWithDeleteButton({ visualizationName, canDelete, onDelete, ...props }) { const handleDelete = useCallback( - e => { + (e) => { e.stopPropagation(); Modal.confirm({ title: "Delete Visualization", @@ -111,7 +111,8 @@ export default function QueryVisualizationTabs({ className="add-visualization-button" data-test="NewVisualization" type="link" - onClick={() => onAddVisualization()}> + onClick={() => onAddVisualization()} + >