This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 09c1987de4 chore(fe): correct typing for sheetsColumnNames (#32007)
09c1987de4 is described below
commit 09c1987de4b734df7308b37f55c5a9aa7b8f58a6
Author: Đỗ Trọng Hải <[email protected]>
AuthorDate: Tue Jan 28 13:09:27 2025 +0700
chore(fe): correct typing for sheetsColumnNames (#32007)
Signed-off-by: hainenber <[email protected]>
---
.../src/features/databases/UploadDataModel/index.tsx | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/superset-frontend/src/features/databases/UploadDataModel/index.tsx
b/superset-frontend/src/features/databases/UploadDataModel/index.tsx
index 37f9e6a5e3..cc3215a68e 100644
--- a/superset-frontend/src/features/databases/UploadDataModel/index.tsx
+++ b/superset-frontend/src/features/databases/UploadDataModel/index.tsx
@@ -137,11 +137,6 @@ interface UploadInfo {
column_data_types: string;
}
-interface SheetColumnNames {
- sheet_name: string;
- column_names: string[];
-}
-
const defaultUploadInfo: UploadInfo = {
table_name: '',
schema: '',
@@ -225,8 +220,8 @@ const UploadDataModal:
FunctionComponent<UploadDataModalProps> = ({
const [columns, setColumns] = useState<string[]>([]);
const [sheetNames, setSheetNames] = useState<string[]>([]);
const [sheetsColumnNames, setSheetsColumnNames] = useState<
- SheetColumnNames[]
- >([]);
+ Record<string, string[]>
+ >({});
const [delimiter, setDelimiter] = useState<string>(',');
const [isLoading, setIsLoading] = useState<boolean>(false);
const [currentSchema, setCurrentSchema] = useState<string | undefined>();
@@ -334,7 +329,7 @@ const UploadDataModal:
FunctionComponent<UploadDataModalProps> = ({
setDelimiter(',');
setPreviewUploadedFile(true);
setFileLoading(false);
- setSheetsColumnNames([]);
+ setSheetsColumnNames({});
form.resetFields();
};
@@ -408,10 +403,10 @@ const UploadDataModal:
FunctionComponent<UploadDataModalProps> = ({
const { allSheetNames, sheetColumnNamesMap } = items.reduce(
(
acc: {
- allSheetNames: any[];
+ allSheetNames: string[];
sheetColumnNamesMap: Record<string, string[]>;
},
- item: { sheet_name: any; column_names: any },
+ item: { sheet_name: string; column_names: string[] },
) => {
acc.allSheetNames.push(item.sheet_name);
acc.sheetColumnNamesMap[item.sheet_name] = item.column_names;