From 012191d14d8807998947810228056455f7e1dd96 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 12 Dec 2024 12:14:18 -0500 Subject: [PATCH] merge base --- .../data-warehouse/editor/OutputPane.tsx | 112 +++++++++--------- 1 file changed, 53 insertions(+), 59 deletions(-) diff --git a/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx b/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx index 30dfcc361f26a..7e2363b4c803b 100644 --- a/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx +++ b/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx @@ -40,10 +40,10 @@ export function OutputPane(): JSX.Element { const { editingView, sourceQuery, exportContext, isValidView, editorKey, error } = useValues(multitabEditorLogic) const { saveAsInsight, saveAsView, setSourceQuery, runQuery } = useActions(multitabEditorLogic) const { isDarkModeOn } = useValues(themeLogic) - const { response, responseLoading } = useValues(dataNodeLogic) + const { response, responseLoading, responseError } = useValues(dataNodeLogic) const { dataWarehouseSavedQueriesLoading } = useValues(dataWarehouseViewsLogic) const { updateDataWarehouseSavedQuery } = useActions(dataWarehouseViewsLogic) - const { visualizationType } = useValues(dataVisualizationLogic) + const { visualizationType, queryCancelled } = useValues(dataVisualizationLogic) const vizKey = `SQLEditorScene` @@ -70,45 +70,63 @@ export function OutputPane(): JSX.Element { }) }, [response]) + const ErrorState = useMemo((): JSX.Element | null => { + return ( +
+ +
+ ) + }, [responseError, sourceQuery, queryCancelled, response]) + const Content = (): JSX.Element | null => { if (activeTab === OutputTab.Results) { - return ( -
- {responseLoading ? ( - - ) : !response ? ( - Query results will appear here - ) : ( -
- -
- )} + if (responseError) { + return ErrorState + } + + return responseLoading ? ( + + ) : !response ? ( + Query results will appear here + ) : ( +
+
) } if (activeTab === OutputTab.Visualization) { - return ( -
- {!response ? ( - Query be results will be visualized here - ) : ( -
- -
- )} + if (responseError) { + return ErrorState + } + + return !response ? ( + Query be results will be visualized here + ) : ( +
+
) } @@ -221,8 +239,6 @@ function InternalDataTableVisualization( showResultControls, response, responseLoading, - responseError, - queryCancelled, isChartSettingsPanelOpen, } = useValues(dataVisualizationLogic) @@ -266,29 +282,7 @@ function InternalDataTableVisualization(
)} -
- {visualizationType !== ChartDisplayType.ActionsTable && responseError ? ( -
- -
- ) : ( - component - )} -
+
{component}
{showResultControls && ( <>