ramiroaquinoromero commented on code in PR #37112:
URL: https://github.com/apache/superset/pull/37112#discussion_r2730432597
##########
superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx:
##########
@@ -677,8 +671,187 @@ test('Should show RowCountLabel in embedded when
uiConfig.showRowLimitWarning is
initialState: rowCountState,
});
- expect(screen.getByTestId('warning')).toBeInTheDocument();
+ expect(screen.queryByTestId('warning')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('row-count-label')).not.toBeInTheDocument();
mockIsEmbedded.mockRestore();
mockUseUiConfig.mockRestore();
});
+
+test('Should show row count badge for table chart without server pagination',
() => {
+ const mockUseUiConfig = useUiConfig as jest.MockedFunction<
+ typeof useUiConfig
+ >;
+ mockUseUiConfig.mockReturnValue({
+ hideTitle: false,
+ hideTab: false,
+ hideNav: false,
+ hideChartControls: false,
+ emitDataMasks: false,
+ showRowLimitWarning: true,
+ });
+
+ const props = createProps({
+ formData: {
+ ...createProps().formData,
+ viz_type: VizType.Table,
+ row_limit: 10,
+ },
+ slice: {
+ ...createProps().slice,
+ form_data: {
+ ...createProps().slice.form_data,
+ viz_type: VizType.Table,
+ row_limit: 10,
+ },
+ viz_type: VizType.Table,
+ },
Review Comment:
You're right - we shouldn't single out table charts. I've removed that
restriction.
The row limit warning now shows for all chart types when the limit is
reached (restoring the original behavior from your PR that you mentioned
before).
The table-specific logic (isTableChart check) only applies to how we get the
row count:
Table charts with server pagination: Use the total count from the second
query (the fix for server pagination)
All other charts: Use sql_rowcount from the first query (original behavior)
The warning itself is no longer restricted to table charts - it works for
bar charts, line charts, etc., just as you originally implemented.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]