Compare commits

..

1 Commits

Author SHA1 Message Date
Vitor Avila
a1851ff3b2 fix: Check python deps CI job 2026-04-30 17:20:14 -03:00
5 changed files with 7 additions and 166 deletions

View File

@@ -707,7 +707,7 @@ protobuf==4.25.8
# proto-plus
psutil==6.1.0
# via apache-superset
psycopg2-binary==2.9.9
psycopg2-binary==2.9.12
# via apache-superset
py-key-value-aio==0.4.4
# via fastmcp

View File

@@ -271,10 +271,7 @@ function sortHierarchicalObject(
return result;
}
function convertToNumberIfNumeric(value: unknown): unknown {
if (typeof value !== 'string') {
return value;
}
function convertToNumberIfNumeric(value: string): string | number {
const n = Number(value);
return value.trim() !== '' && !Number.isNaN(n) ? n : value;
}

View File

@@ -1052,7 +1052,7 @@ test('renderTableRow uses active header surface for adaptive contrast', () => {
});
function makeColPivotSettings(
value: unknown,
value: string,
): Parameters<TableRenderer['renderColHeaderRow']>[2] {
return {
rowAttrs: [],
@@ -1146,45 +1146,3 @@ test.each([
expect(formatter).toHaveBeenCalledWith(expected);
},
);
test('col header date formatter does not throw when value is a Date object', () => {
const dateValue = new Date(1700000000000);
const formatter = jest.fn().mockReturnValue('formatted');
tableRenderer = new TableRenderer({
...mockProps,
cols: ['event_time'],
tableOptions: {
...mockProps.tableOptions,
dateFormatters: { event_time: formatter },
},
});
expect(() =>
tableRenderer.renderColHeaderRow(
'event_time',
0,
makeColPivotSettings(dateValue),
),
).not.toThrow();
expect(formatter).toHaveBeenCalledWith(dateValue);
});
test('row header date formatter does not throw when value is a Date object', () => {
const dateValue = new Date(1700000000000);
const formatter = jest.fn().mockReturnValue('formatted');
tableRenderer = new TableRenderer({
...mockProps,
rows: ['event_time'],
tableOptions: {
...mockProps.tableOptions,
dateFormatters: { event_time: formatter },
},
});
expect(() =>
tableRenderer.renderTableRow(
[dateValue as unknown as string],
0,
makeRowPivotSettings(),
),
).not.toThrow();
expect(formatter).toHaveBeenCalledWith(dateValue);
});

View File

@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
/// <reference types="@emotion/jest" />
import fetchMock from 'fetch-mock';
import {
fireEvent,
@@ -43,7 +42,6 @@ import {
import { storeWithState } from 'spec/fixtures/mockStore';
import mockState from 'spec/fixtures/mockState';
import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants';
import * as urlUtils from 'src/utils/urlUtils';
import * as useNativeFiltersModule from './state';
fetchMock.get('glob:*/csstemplateasyncmodelview/api/read', {});
@@ -458,116 +456,6 @@ describe('DashboardBuilder', () => {
expect(queryByTestId('dashboard-filters-panel')).not.toBeInTheDocument();
});
test('should hide filter panel in standalone=3 report mode', () => {
const urlParamSpy = (
jest.spyOn(urlUtils, 'getUrlParam') as jest.SpyInstance
).mockImplementation((param: { name: string }) => {
if (param.name === 'standalone') return 3;
return null;
});
const nativeFiltersSpy = jest
.spyOn(useNativeFiltersModule, 'useNativeFilters')
.mockReturnValue({
showDashboard: true,
missingInitialFilters: [],
dashboardFiltersOpen: true,
toggleDashboardFiltersOpen: jest.fn(),
nativeFiltersEnabled: true,
});
try {
const { getByTestId } = setup();
const filterPanel = getByTestId('dashboard-filters-panel');
expect(filterPanel).toHaveStyleRule('display', 'none');
} finally {
urlParamSpy.mockRestore();
nativeFiltersSpy.mockRestore();
}
});
test('should show filter panel in standalone=3 when show_filters=true', () => {
const urlParamSpy = (
jest.spyOn(urlUtils, 'getUrlParam') as jest.SpyInstance
).mockImplementation((param: { name: string }) => {
if (param.name === 'standalone') return 3;
if (param.name === 'show_filters') return true;
return null;
});
const nativeFiltersSpy = jest
.spyOn(useNativeFiltersModule, 'useNativeFilters')
.mockReturnValue({
showDashboard: true,
missingInitialFilters: [],
dashboardFiltersOpen: true,
toggleDashboardFiltersOpen: jest.fn(),
nativeFiltersEnabled: true,
});
try {
const { getByTestId } = setup();
const filterPanel = getByTestId('dashboard-filters-panel');
expect(filterPanel).not.toHaveStyleRule('display', 'none');
} finally {
urlParamSpy.mockRestore();
nativeFiltersSpy.mockRestore();
}
});
test('should hide filter panel in standalone=3 when show_filters=false', () => {
const urlParamSpy = (
jest.spyOn(urlUtils, 'getUrlParam') as jest.SpyInstance
).mockImplementation((param: { name: string }) => {
if (param.name === 'standalone') return 3;
if (param.name === 'show_filters') return false;
return null;
});
const nativeFiltersSpy = jest
.spyOn(useNativeFiltersModule, 'useNativeFilters')
.mockReturnValue({
showDashboard: true,
missingInitialFilters: [],
dashboardFiltersOpen: true,
toggleDashboardFiltersOpen: jest.fn(),
nativeFiltersEnabled: true,
});
try {
const { getByTestId } = setup();
const filterPanel = getByTestId('dashboard-filters-panel');
expect(filterPanel).toHaveStyleRule('display', 'none');
} finally {
urlParamSpy.mockRestore();
nativeFiltersSpy.mockRestore();
}
});
test('should show filters but hide tab navigation in report mode with show_filters=true on tabbed dashboard', () => {
const urlParamSpy = (
jest.spyOn(urlUtils, 'getUrlParam') as jest.SpyInstance
).mockImplementation((param: { name: string }) => {
if (param.name === 'standalone') return 3;
if (param.name === 'show_filters') return true;
return null;
});
const nativeFiltersSpy = jest
.spyOn(useNativeFiltersModule, 'useNativeFilters')
.mockReturnValue({
showDashboard: true,
missingInitialFilters: [],
dashboardFiltersOpen: true,
toggleDashboardFiltersOpen: jest.fn(),
nativeFiltersEnabled: true,
});
try {
const { getByTestId, queryByRole } = setup({
dashboardLayout: undoableDashboardLayoutWithTabs,
});
const filterPanel = getByTestId('dashboard-filters-panel');
expect(filterPanel).not.toHaveStyleRule('display', 'none');
expect(queryByRole('tablist')).not.toBeInTheDocument();
} finally {
urlParamSpy.mockRestore();
nativeFiltersSpy.mockRestore();
}
});
});
test('should render ParentSize wrapper with height 100% for tabs', async () => {

View File

@@ -414,8 +414,6 @@ const DashboardBuilder = () => {
: undefined;
const standaloneMode = getUrlParam(URL_PARAMS.standalone);
const isReport = standaloneMode === DashboardStandaloneMode.Report;
const showFiltersUrlParam = getUrlParam(URL_PARAMS.showFilters);
const hideFilterBar = isReport && showFiltersUrlParam !== true;
const hideDashboardHeader =
uiConfig.hideTitle ||
standaloneMode === DashboardStandaloneMode.HideNavAndTitle ||
@@ -513,12 +511,12 @@ const DashboardBuilder = () => {
filterBarOrientation === FilterBarOrientation.Horizontal && (
<FilterBar
orientation={FilterBarOrientation.Horizontal}
hidden={hideFilterBar}
hidden={isReport}
/>
)}
</>
),
[hideDashboardHeader, showFilterBar, filterBarOrientation, hideFilterBar],
[hideDashboardHeader, showFilterBar, filterBarOrientation, isReport],
);
const renderDraggableContent = useCallback(
@@ -580,7 +578,7 @@ const DashboardBuilder = () => {
return (
<FiltersPanel
width={filterBarWidth}
hidden={hideFilterBar}
hidden={isReport}
data-test="dashboard-filters-panel"
>
<StickyPanel ref={containerRef} width={filterBarWidth}>
@@ -605,7 +603,7 @@ const DashboardBuilder = () => {
toggleDashboardFiltersOpen,
filterBarHeight,
filterBarOffset,
hideFilterBar,
isReport,
],
);