Skip to content

Commit

Permalink
fix(sqllab): Missing empty query result state (#27313)
Browse files Browse the repository at this point in the history
(cherry picked from commit ae8ec9c)
  • Loading branch information
justinpark authored and michael-s-molina committed Mar 4, 2024
1 parent f5750dd commit f063240
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { LOCALSTORAGE_MAX_QUERY_AGE_MS } from '../../constants';
const EXTRA_HEIGHT_RESULTS = 8; // we need extra height in RESULTS tab. because the height from props was calculated based on PREVIEW tab.

type Props = {
latestQueryId: string;
latestQueryId?: string;
height: number;
displayLimit: number;
defaultQueryLimit: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ test('should render offline when the state is offline', async () => {
expect(getByText(STATUS_OPTIONS.offline)).toBeVisible();
});

test('should render empty result state when latestQuery is empty', () => {
const { getAllByRole } = render(
<SouthPane {...mockedProps} latestQueryId={undefined} />,
{
useRedux: true,
initialState: mockState,
},
);

const resultPanel = getAllByRole('tabpanel')[0];
expect(resultPanel).toHaveTextContent('Run a query to display results');
});

test('should render tabs for table preview queries', () => {
const { getAllByRole } = render(<SouthPane {...mockedProps} />, {
useRedux: true,
Expand Down
14 changes: 6 additions & 8 deletions superset-frontend/src/SqlLab/components/SouthPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,12 @@ const SouthPane = ({
animated={false}
>
<Tabs.TabPane tab={t('Results')} key="Results">
{latestQueryId && (
<Results
height={innerTabContentHeight}
latestQueryId={latestQueryId}
displayLimit={displayLimit}
defaultQueryLimit={defaultQueryLimit}
/>
)}
<Results
height={innerTabContentHeight}
latestQueryId={latestQueryId}
displayLimit={displayLimit}
defaultQueryLimit={defaultQueryLimit}
/>
</Tabs.TabPane>
<Tabs.TabPane tab={t('Query history')} key="History">
<QueryHistory
Expand Down

0 comments on commit f063240

Please sign in to comment.