You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/07/24 07:33:09 UTC
(superset) 01/01: fix: address numerous console errors and i18n table cleanup
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch console_fix
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 1a048c9b6e4566489094f9a6baa186b21557acf7
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Thu Jul 24 00:32:28 2025 -0700
fix: address numerous console errors and i18n table cleanup
---
.../src/components/EmptyState/index.tsx | 2 +-
.../src/components/Select/AsyncSelect.tsx | 18 +++++-
.../src/components/Select/Select.tsx | 20 ++++++-
.../src/components/Select/types.ts | 1 +
.../src/AgGridTable/index.tsx | 19 ++++++-
.../plugin-chart-ag-grid-table/src/consts.ts | 4 --
.../plugins/plugin-chart-ag-grid-table/src/i18n.ts | 66 ----------------------
.../plugins/plugin-chart-table/src/consts.ts | 5 +-
.../plugins/plugin-chart-table/src/i18n.ts | 66 ----------------------
.../components/Chart/MenuItemWithTruncation.tsx | 2 +-
.../src/components/ListView/Filters/Select.tsx | 8 ++-
superset-frontend/src/features/home/RightMenu.tsx | 20 ++++---
superset-frontend/webpack.config.js | 3 +
superset/app.py | 21 ++++++-
superset/db_engine_specs/__init__.py | 2 +-
superset/extensions/__init__.py | 12 +++-
16 files changed, 107 insertions(+), 162 deletions(-)
diff --git a/superset-frontend/packages/superset-ui-core/src/components/EmptyState/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/EmptyState/index.tsx
index b8f655c276..05e39eed9b 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/EmptyState/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/EmptyState/index.tsx
@@ -128,7 +128,7 @@ const ImageContainer = ({
<Empty
description={false}
image={mappedImage}
- imageStyle={getImageHeight(size)}
+ styles={{ image: getImageHeight(size) }}
/>
</div>
);
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
index f48f101e07..65f33c0445 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
@@ -144,7 +144,9 @@ const AsyncSelect = forwardRef(
getPopupContainer,
oneLine,
maxTagCount: propsMaxTagCount,
- ...props
+ dropdownStyle,
+ styles,
+ ...restProps
}: AsyncSelectProps,
ref: RefObject<AsyncSelectRef>,
) => {
@@ -229,6 +231,17 @@ const AsyncSelect = forwardRef(
: selectOptions;
}, [selectOptions, selectValue]);
+ // Handle backward compatibility for dropdownStyle -> styles migration
+ const selectStyles = useMemo(() => {
+ if (styles) {
+ return styles;
+ }
+ if (dropdownStyle) {
+ return { popup: { root: dropdownStyle } };
+ }
+ return undefined;
+ }, [styles, dropdownStyle]);
+
const handleOnSelect: SelectProps['onSelect'] = (selectedItem, option) => {
if (isSingleMode) {
// on select is fired in single value mode if the same value is selected
@@ -640,7 +653,8 @@ const AsyncSelect = forwardRef(
)
}
oneLine={oneLine}
- {...props}
+ styles={selectStyles}
+ {...restProps}
ref={ref}
/>
</StyledContainer>
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
index 48cb2cfe17..ddff321ad8 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
@@ -119,7 +119,9 @@ const Select = forwardRef(
oneLine,
maxTagCount: propsMaxTagCount,
virtual = undefined,
- ...props
+ dropdownStyle,
+ styles,
+ ...restProps
}: SelectProps,
ref: Ref<RefSelectProps>,
) => {
@@ -607,6 +609,17 @@ const Select = forwardRef(
actualMaxTagCount -= 1;
}
+ // Handle backward compatibility for dropdownStyle -> styles migration
+ const selectStyles = useMemo(() => {
+ if (styles) {
+ return styles;
+ }
+ if (dropdownStyle) {
+ return { popup: { root: dropdownStyle } };
+ }
+ return undefined;
+ }, [styles, dropdownStyle]);
+
const getPastedTextValue = useCallback(
(text: string) => {
const option = getOption(text, fullSelectOptions, true);
@@ -738,8 +751,9 @@ const Select = forwardRef(
options={visibleOptions}
optionRender={option => <Space>{option.label || option.value}</Space>}
oneLine={oneLine}
- css={props.css}
- {...props}
+ css={restProps.css}
+ styles={selectStyles}
+ {...restProps}
showSearch={shouldShowSearch}
ref={ref}
/>
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/types.ts b/superset-frontend/packages/superset-ui-core/src/components/Select/types.ts
index 2f52035b43..9c120eabd6 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/types.ts
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/types.ts
@@ -67,6 +67,7 @@ export type AntdExposedProps = Pick<
| 'placeholder'
| 'showArrow'
| 'showSearch'
+ | 'styles'
| 'tokenSeparators'
| 'virtual'
| 'getPopupContainer'
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx b/superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
index fc4e7b9000..bee8422fcf 100644
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
+++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
@@ -40,7 +40,7 @@ import {
} from 'ag-grid-community';
import { AgGridReact } from 'ag-grid-react';
import { type FunctionComponent } from 'react';
-import { JsonObject, DataRecordValue, DataRecord } from '@superset-ui/core';
+import { JsonObject, DataRecordValue, DataRecord, t } from '@superset-ui/core';
import { SearchOutlined } from '@ant-design/icons';
import { debounce, isEqual } from 'lodash';
import Pagination from './components/Pagination';
@@ -326,6 +326,23 @@ const AgGridDataTable: FunctionComponent<AgGridTableProps> = memo(
paginationPageSizeSelector={PAGE_SIZE_OPTIONS}
suppressDragLeaveHidesColumns
pinnedBottomRowData={showTotals ? [cleanedTotals] : undefined}
+ localeText={{
+ // Pagination controls
+ next: t('Next'),
+ previous: t('Previous'),
+ page: t('Page'),
+ more: t('More'),
+ to: t('to'),
+ of: t('of'),
+ first: t('First'),
+ last: t('Last'),
+ // Column menu and filters
+ columns: t('Columns'),
+ filters: t('Filters'),
+ sortAscending: t('Sort Ascending'),
+ sortDescending: t('Sort Descending'),
+ sortUnSort: t('Clear Sort'),
+ }}
context={{
onColumnHeaderClicked: handleColumnHeaderClick,
initialSortState: getInitialSortState(
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/src/consts.ts b/superset-frontend/plugins/plugin-chart-ag-grid-table/src/consts.ts
index d4db087c30..995e43ea67 100644
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/src/consts.ts
+++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/src/consts.ts
@@ -17,10 +17,6 @@
* under the License.
*/
import { formatSelectOptions } from '@superset-ui/chart-controls';
-import { addLocaleData } from '@superset-ui/core';
-import i18n from './i18n';
-
-addLocaleData(i18n);
export const SERVER_PAGE_SIZE_OPTIONS = formatSelectOptions<number>([
10, 20, 50, 100, 200,
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/src/i18n.ts b/superset-frontend/plugins/plugin-chart-ag-grid-table/src/i18n.ts
deleted file mode 100644
index 3ea82b00e0..0000000000
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/src/i18n.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { Locale } from '@superset-ui/core';
-
-const en = {
- 'Query Mode': [''],
- Aggregate: [''],
- 'Raw Records': [''],
- 'Emit Filter Events': [''],
- 'Show Cell Bars': [''],
- 'page_size.show': ['Show'],
- 'page_size.all': ['All'],
- 'page_size.entries': ['entries'],
- 'table.previous_page': ['Previous'],
- 'table.next_page': ['Next'],
- 'search.num_records': ['%s record', '%s records...'],
-};
-
-const translations: Partial<Record<Locale, typeof en>> = {
- en,
- fr: {
- 'Query Mode': [''],
- Aggregate: [''],
- 'Raw Records': [''],
- 'Emit Filter Events': [''],
- 'Show Cell Bars': [''],
- 'page_size.show': ['Afficher'],
- 'page_size.all': ['tous'],
- 'page_size.entries': ['entrées'],
- 'table.previous_page': ['Précédent'],
- 'table.next_page': ['Suivante'],
- 'search.num_records': ['%s enregistrement', '%s enregistrements...'],
- },
- zh: {
- 'Query Mode': ['查询模式'],
- Aggregate: ['分组聚合'],
- 'Raw Records': ['原始数据'],
- 'Emit Filter Events': ['关联看板过滤器'],
- 'Show Cell Bars': ['为指标添加条状图背景'],
- 'page_size.show': ['每页显示'],
- 'page_size.all': ['全部'],
- 'page_size.entries': ['条'],
- 'table.previous_page': ['上一页'],
- 'table.next_page': ['下一页'],
- 'search.num_records': ['%s条记录...'],
- },
-};
-
-export default translations;
diff --git a/superset-frontend/plugins/plugin-chart-table/src/consts.ts b/superset-frontend/plugins/plugin-chart-table/src/consts.ts
index c2cd9dfa66..58f60d049f 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/consts.ts
+++ b/superset-frontend/plugins/plugin-chart-table/src/consts.ts
@@ -17,10 +17,7 @@
* under the License.
*/
import { formatSelectOptions } from '@superset-ui/chart-controls';
-import { addLocaleData, t } from '@superset-ui/core';
-import i18n from './i18n';
-
-addLocaleData(i18n);
+import { t } from '@superset-ui/core';
export const PAGE_SIZE_OPTIONS = formatSelectOptions<number>([
[0, t('page_size.all')],
diff --git a/superset-frontend/plugins/plugin-chart-table/src/i18n.ts b/superset-frontend/plugins/plugin-chart-table/src/i18n.ts
deleted file mode 100644
index 3ea82b00e0..0000000000
--- a/superset-frontend/plugins/plugin-chart-table/src/i18n.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { Locale } from '@superset-ui/core';
-
-const en = {
- 'Query Mode': [''],
- Aggregate: [''],
- 'Raw Records': [''],
- 'Emit Filter Events': [''],
- 'Show Cell Bars': [''],
- 'page_size.show': ['Show'],
- 'page_size.all': ['All'],
- 'page_size.entries': ['entries'],
- 'table.previous_page': ['Previous'],
- 'table.next_page': ['Next'],
- 'search.num_records': ['%s record', '%s records...'],
-};
-
-const translations: Partial<Record<Locale, typeof en>> = {
- en,
- fr: {
- 'Query Mode': [''],
- Aggregate: [''],
- 'Raw Records': [''],
- 'Emit Filter Events': [''],
- 'Show Cell Bars': [''],
- 'page_size.show': ['Afficher'],
- 'page_size.all': ['tous'],
- 'page_size.entries': ['entrées'],
- 'table.previous_page': ['Précédent'],
- 'table.next_page': ['Suivante'],
- 'search.num_records': ['%s enregistrement', '%s enregistrements...'],
- },
- zh: {
- 'Query Mode': ['查询模式'],
- Aggregate: ['分组聚合'],
- 'Raw Records': ['原始数据'],
- 'Emit Filter Events': ['关联看板过滤器'],
- 'Show Cell Bars': ['为指标添加条状图背景'],
- 'page_size.show': ['每页显示'],
- 'page_size.all': ['全部'],
- 'page_size.entries': ['条'],
- 'table.previous_page': ['上一页'],
- 'table.next_page': ['下一页'],
- 'search.num_records': ['%s条记录...'],
- },
-};
-
-export default translations;
diff --git a/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx b/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx
index 0b0b87e89a..00311c38ad 100644
--- a/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx
+++ b/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx
@@ -109,7 +109,7 @@ export const MenuItemWithTruncation = ({
display: flex;
line-height: 1.5em;
`}
- eventKey={menuKey}
+ key={menuKey}
onClick={onClick}
style={style}
>
diff --git a/superset-frontend/src/components/ListView/Filters/Select.tsx b/superset-frontend/src/components/ListView/Filters/Select.tsx
index c7d4451159..f4552447a2 100644
--- a/superset-frontend/src/components/ListView/Filters/Select.tsx
+++ b/superset-frontend/src/components/ListView/Filters/Select.tsx
@@ -109,7 +109,9 @@ function SelectFilter(
onClear={onClear}
options={fetchAndFormatSelects}
placeholder={placeholder}
- dropdownStyle={dropdownStyle}
+ styles={
+ dropdownStyle ? { popup: { root: dropdownStyle } } : undefined
+ }
showSearch
value={selectedOption}
/>
@@ -123,7 +125,9 @@ function SelectFilter(
onClear={onClear}
options={selects}
placeholder={placeholder}
- dropdownStyle={dropdownStyle}
+ styles={
+ dropdownStyle ? { popup: { root: dropdownStyle } } : undefined
+ }
showSearch
value={selectedOption}
loading={loading}
diff --git a/superset-frontend/src/features/home/RightMenu.tsx b/superset-frontend/src/features/home/RightMenu.tsx
index 2623295d6e..0e72aadf74 100644
--- a/superset-frontend/src/features/home/RightMenu.tsx
+++ b/superset-frontend/src/features/home/RightMenu.tsx
@@ -437,12 +437,14 @@ const RightMenu = ({
key="sub1"
data-test="new-dropdown"
title={
- <Icons.PlusOutlined
- iconColor={theme.colorPrimary}
- data-test="new-dropdown-icon"
- />
+ <>
+ <Icons.PlusOutlined
+ iconColor={theme.colorPrimary}
+ data-test="new-dropdown-icon"
+ />
+ <Icons.CaretDownOutlined iconSize="xs" />
+ </>
}
- icon={<Icons.CaretDownOutlined iconSize="xs" />}
>
{dropdownItems?.map?.(menu => {
const canShowChild = menu.childs?.some(
@@ -507,8 +509,12 @@ const RightMenu = ({
<StyledSubMenu
key="sub3_settings"
- title={t('Settings')}
- icon={<Icons.CaretDownOutlined iconSize="xs" />}
+ title={
+ <>
+ {t('Settings')}
+ <Icons.CaretDownOutlined iconSize="xs" />
+ </>
+ }
>
{settings?.map?.((section, index) => [
<Menu.ItemGroup key={`${section.label}`} title={section.label}>
diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js
index fed420f2fa..088950e01a 100644
--- a/superset-frontend/webpack.config.js
+++ b/superset-frontend/webpack.config.js
@@ -234,6 +234,9 @@ const config = {
{
message: /Can't resolve.*superset_text/,
},
+ {
+ message: /Skipped not serializable cache item.*WorkerError/,
+ },
],
performance: {
assetFilter(assetFilename) {
diff --git a/superset/app.py b/superset/app.py
index 22d3a6ba7d..0a8f73d53e 100644
--- a/superset/app.py
+++ b/superset/app.py
@@ -30,7 +30,7 @@ else:
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
-from flask import Flask
+from flask import Flask, Response
from werkzeug.exceptions import NotFound
from superset.initialization import SupersetAppInitializer
@@ -77,7 +77,24 @@ def create_app(
class SupersetApp(Flask):
- pass
+ def send_static_file(self, filename: str) -> Response:
+ """Override to prevent webpack hot-update 404s from spamming logs.
+
+ Webpack HMR can create race conditions where the browser requests
+ hot-update files that no longer exist. Return 204 instead of 404
+ for these files to keep logs clean.
+ """
+ if ".hot-update." in filename:
+ # First try to serve it normally - it might exist
+ try:
+ return super().send_static_file(filename)
+ except NotFound:
+ logger.debug(
+ "Webpack hot-update file not found (likely HMR "
+ f"race condition): {filename}"
+ )
+ return Response("", status=204) # No Content
+ return super().send_static_file(filename)
class AppRootMiddleware:
diff --git a/superset/db_engine_specs/__init__.py b/superset/db_engine_specs/__init__.py
index 8fddccbb72..a68e8847be 100644
--- a/superset/db_engine_specs/__init__.py
+++ b/superset/db_engine_specs/__init__.py
@@ -154,7 +154,7 @@ def get_available_engine_specs() -> dict[type[BaseEngineSpec], set[str]]: # noq
try:
dialect = ep.load()
except Exception as ex: # pylint: disable=broad-except
- logger.warning("Unable to load SQLAlchemy dialect %s: %s", ep.name, ex)
+ logger.debug("Unable to load SQLAlchemy dialect %s: %s", ep.name, ex)
else:
backend = dialect.name
if isinstance(backend, bytes):
diff --git a/superset/extensions/__init__.py b/superset/extensions/__init__.py
index ffe9c79967..f72873a238 100644
--- a/superset/extensions/__init__.py
+++ b/superset/extensions/__init__.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import json
+import logging
import os
from typing import Any, Callable, Optional
@@ -57,6 +58,9 @@ class ResultsBackendManager:
return self._use_msgpack
+logger = logging.getLogger(__name__)
+
+
class UIManifestProcessor:
def __init__(self, app_dir: str) -> None:
self.app: Optional[Flask] = None
@@ -97,8 +101,12 @@ class UIManifestProcessor:
# templates
full_manifest = json.load(f)
self.manifest = full_manifest.get("entrypoints", {})
- except Exception: # pylint: disable=broad-except # noqa: S110
- pass
+ except FileNotFoundError:
+ logger.debug("Manifest file not found")
+ except json.JSONDecodeError:
+ logger.debug("Failed to parse manifest.json")
+ except Exception:
+ logger.debug("Unexpected error loading manifest.json")
def get_manifest_files(self, bundle: str, asset_type: str) -> list[str]:
if self.app and self.app.debug: