Unverified Commit 390f8d8a authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Improvement-2809] Improvement result not scroll (#2819)

* improve-result-scroll * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent abc78693
...@@ -24,7 +24,7 @@ import { ...@@ -24,7 +24,7 @@ import {
mapDispatchToProps mapDispatchToProps
} from '@/pages/DataStudio/function'; } from '@/pages/DataStudio/function';
import { isSql } from '@/pages/DataStudio/HeaderContainer/function'; import { isSql } from '@/pages/DataStudio/HeaderContainer/function';
import { StateType } from '@/pages/DataStudio/model'; import { StateType, TaskDataType } from '@/pages/DataStudio/model';
import { handleGetOption, handleGetOptionWithoutMsg } from '@/services/BusinessCrud'; import { handleGetOption, handleGetOptionWithoutMsg } from '@/services/BusinessCrud';
import { DIALECT } from '@/services/constants'; import { DIALECT } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
...@@ -53,7 +53,7 @@ const Result = (props: any) => { ...@@ -53,7 +53,7 @@ const Result = (props: any) => {
const [dataList, setDataList] = useState<DataList>([]); const [dataList, setDataList] = useState<DataList>([]);
const [loading, setLoading] = useState<boolean>(true); const [loading, setLoading] = useState<boolean>(true);
const currentTabs = getCurrentTab(panes, activeKey); const currentTabs = getCurrentTab(panes, activeKey);
const current = getCurrentData(panes, activeKey) ?? {}; const current = getCurrentData(panes, activeKey) as TaskDataType;
const [searchText, setSearchText] = useState(''); const [searchText, setSearchText] = useState('');
const [searchedColumn, setSearchedColumn] = useState(''); const [searchedColumn, setSearchedColumn] = useState('');
...@@ -135,10 +135,10 @@ const Result = (props: any) => { ...@@ -135,10 +135,10 @@ const Result = (props: any) => {
} else if (consoleData.results && !isRefresh) { } else if (consoleData.results && !isRefresh) {
setDataList(consoleData.results); setDataList(consoleData.results);
} else { } else {
if (current.dialect && current.dialect.toLowerCase() == DIALECT.FLINK_SQL) { if (current?.dialect && current?.dialect?.toLowerCase() == DIALECT.FLINK_SQL) {
// flink sql // flink sql
// to do: get job data by history id list, not flink jid // to do: get job data by history id list, not flink jid
if (current.id) { if (current?.id) {
const res = await handleGetOptionWithoutMsg(API_CONSTANTS.GET_LATEST_HISTORY_BY_ID, { const res = await handleGetOptionWithoutMsg(API_CONSTANTS.GET_LATEST_HISTORY_BY_ID, {
id: current.id id: current.id
}); });
...@@ -173,7 +173,7 @@ const Result = (props: any) => { ...@@ -173,7 +173,7 @@ const Result = (props: any) => {
loadData(); loadData();
}, [currentTabs?.console?.result, currentTabs?.console?.results]); }, [currentTabs?.console?.result, currentTabs?.console?.results]);
const getColumns = (columns: string[]) => { const getColumns = (columns: string[] = []) => {
return columns?.map((item) => { return columns?.map((item) => {
return { return {
title: item, title: item,
...@@ -236,6 +236,7 @@ const Result = (props: any) => { ...@@ -236,6 +236,7 @@ const Result = (props: any) => {
<Table <Table
columns={getColumns(data.columns)} columns={getColumns(data.columns)}
size='small' size='small'
scroll={{ x: 'max-content' }}
dataSource={data.rowData?.map((item: any, index: number) => { dataSource={data.rowData?.map((item: any, index: number) => {
return { ...item, key: index }; return { ...item, key: index };
})} })}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment