mirror of
https://github.com/apache/superset.git
synced 2026-06-01 05:39:17 +00:00
fix: navigate to SQL Lab due to router api updates (#34569)
This commit is contained in:
@@ -154,7 +154,8 @@ test('navigates to SQL Lab when View in SQL Lab button is clicked', () => {
|
||||
const viewInSQLLabButton = screen.getByText('View in SQL Lab');
|
||||
fireEvent.click(viewInSQLLabButton);
|
||||
|
||||
expect(mockHistoryPush).toHaveBeenCalledWith('/sqllab', {
|
||||
expect(mockHistoryPush).toHaveBeenCalledWith({
|
||||
pathname: '/sqllab',
|
||||
state: {
|
||||
requestedQuery: {
|
||||
datasourceKey: mockProps.datasource,
|
||||
@@ -174,7 +175,7 @@ test('opens SQL Lab in a new tab when View in SQL Lab button is clicked with met
|
||||
|
||||
const { datasource, sql } = mockProps;
|
||||
expect(window.open).toHaveBeenCalledWith(
|
||||
`/sqllab?datasourceKey=${datasource}&sql=${sql}`,
|
||||
`/sqllab?datasourceKey=${datasource}&sql=${encodeURIComponent(sql)}`,
|
||||
'_blank',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -125,11 +125,11 @@ const ViewQuery: FC<ViewQueryProps> = props => {
|
||||
if (domEvent.metaKey || domEvent.ctrlKey) {
|
||||
domEvent.preventDefault();
|
||||
window.open(
|
||||
`/sqllab?datasourceKey=${datasource}&sql=${currentSQL}`,
|
||||
`/sqllab?datasourceKey=${datasource}&sql=${encodeURIComponent(currentSQL)}`,
|
||||
'_blank',
|
||||
);
|
||||
} else {
|
||||
history.push('/sqllab', { state: { requestedQuery } });
|
||||
history.push({ pathname: '/sqllab', state: { requestedQuery } });
|
||||
}
|
||||
},
|
||||
[history, datasource, currentSQL],
|
||||
|
||||
Reference in New Issue
Block a user