Skip to content

Commit

Permalink
fix-result-not-scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 committed Dec 27, 2023
1 parent 8e93af6 commit bf3fc0d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
mapDispatchToProps
} from '@/pages/DataStudio/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 { DIALECT } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints';
Expand Down Expand Up @@ -53,7 +53,7 @@ const Result = (props: any) => {
const [dataList, setDataList] = useState<DataList>([]);
const [loading, setLoading] = useState<boolean>(true);
const currentTabs = getCurrentTab(panes, activeKey);
const current = getCurrentData(panes, activeKey) ?? {};
const current = getCurrentData(panes, activeKey) as TaskDataType;

const [searchText, setSearchText] = useState('');
const [searchedColumn, setSearchedColumn] = useState('');
Expand Down Expand Up @@ -135,10 +135,10 @@ const Result = (props: any) => {
} else if (consoleData.results && !isRefresh) {
setDataList(consoleData.results);
} else {
if (current.dialect && current.dialect.toLowerCase() == DIALECT.FLINK_SQL) {
if (current?.dialect && current?.dialect.toLowerCase() == DIALECT.FLINK_SQL) {
// flink sql
// 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, {
id: current.id
});
Expand Down Expand Up @@ -173,7 +173,7 @@ const Result = (props: any) => {
loadData();
}, [currentTabs?.console?.result, currentTabs?.console?.results]);

const getColumns = (columns: string[]) => {
const getColumns = (columns: string[] =[]) => {
return columns?.map((item) => {
return {
title: item,
Expand Down Expand Up @@ -230,12 +230,13 @@ const Result = (props: any) => {
<div style={{ width: '100%' }}>
<div style={{ direction: 'rtl' }}>
{renderDownloadButton()}
{current ? isSql(current.dialect) ? <></> : renderFlinkSQLContent() : undefined}
{current ? isSql(current?.dialect) ? <></> : renderFlinkSQLContent() : undefined}
</div>
{data.columns ? (
<Table
columns={getColumns(data.columns)}
size='small'
scroll={{ x: 'max-content' }}
dataSource={data.rowData?.map((item: any, index: number) => {
return { ...item, key: index };
})}
Expand Down

0 comments on commit bf3fc0d

Please sign in to comment.