Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove pid before update it #2677

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 36 additions & 31 deletions dinky-web/src/components/CallBackButton/CircleBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,51 @@
*
*/

import {TabsItemType, TaskDataType} from '@/pages/DataStudio/model';
import {Button} from 'antd';
import { TabsItemType, TaskDataType } from '@/pages/DataStudio/model';
import { Tab } from '@/pages/DataStudio/route';
import { Button } from 'antd';
import React from 'react';
import {Tab} from '@/pages/DataStudio/route';

export type CircleButtonProps = {
icon: React.ReactNode;
loading?: boolean;
onClick?: () => void;
title?: string;
key?: string;
icon: React.ReactNode;
loading?: boolean;
onClick?: () => void;
title?: string;
key?: string;
};
export type CircleBottomButtonProps = {
icon: React.ReactNode;
loading?: boolean;
onClick?: (tabs: Tab[], key: string, data: TaskDataType | undefined,refresh:any) => Promise<void>;
title?: string;
key?: string;
icon: React.ReactNode;
loading?: boolean;
onClick?: (
tabs: Tab[],
key: string,
data: TaskDataType | undefined,
refresh: any
) => Promise<void>;
title?: string;
key?: string;
};
export type CircleDataStudioButtonProps = {
icon: React.ReactNode;
loading?: boolean;
onClick?: (panes: TabsItemType[], activeKey: string) => void;
title?: string;
key?: string;
isShow?: boolean;
icon: React.ReactNode;
loading?: boolean;
onClick?: (panes: TabsItemType[], activeKey: string) => void;
title?: string;
key?: string;
isShow?: boolean;
};

export const CircleBtn: React.FC<CircleButtonProps> = (props) => {
const {onClick, title, icon, loading} = props;
const { onClick, title, icon, loading } = props;

return (
<Button
title={title}
loading={loading}
icon={icon}
block
type={'text'}
shape={'circle'}
onClick={onClick}
/>
);
return (
<Button
title={title}
loading={loading}
icon={icon}
block
type={'text'}
shape={'circle'}
onClick={onClick}
/>
);
};
126 changes: 66 additions & 60 deletions dinky-web/src/pages/DataStudio/BottomContainer/TableData/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,79 +17,85 @@
*
*/

import {SseData} from '@/models/Sse';
import {TaskDataType} from '@/pages/DataStudio/model';
import {SSE_TOPIC} from '@/pages/DevOps/constants';
import {postAll} from '@/services/api';
import {l} from '@/utils/intl';
import {useModel} from '@@/exports';
import {Modal, Select} from 'antd';
import { SseData } from '@/models/Sse';
import { TaskDataType } from '@/pages/DataStudio/model';
import { SSE_TOPIC } from '@/pages/DevOps/constants';
import { postAll } from '@/services/api';
import { l } from '@/utils/intl';
import { useModel } from '@@/exports';
import { Modal, Select } from 'antd';
import TextArea from 'antd/es/input/TextArea';
import {Tab} from 'rc-tabs/lib/interface.d';
import * as React from 'react';
import {useEffect, useState} from 'react';
import { Tab } from 'rc-tabs/lib/interface.d';
import { useEffect, useState } from 'react';

export async function getPrintTables(statement: string) {
return postAll('api/printTable/getPrintTables', {statement});
return postAll('api/printTable/getPrintTables', { statement });
}

/*--- Clear Console ---*/
export type PrintTable = {
tableName: string;
fullTableName: string;
tableName: string;
fullTableName: string;
};

export const DataPage = (props: any) => {
const {style, title} = props;
const [consoleInfo, setConsoleInfo] = useState<string>('');
const {subscribeTopic} = useModel('Sse', (model: any) => ({
subscribeTopic: model.subscribeTopic
}));
const [tableName, setTableName] = useState<string>('');
const { style, title } = props;
const [consoleInfo, setConsoleInfo] = useState<string>('');
const { subscribeTopic } = useModel('Sse', (model: any) => ({
subscribeTopic: model.subscribeTopic
}));
const [tableName, setTableName] = useState<string>('');

useEffect(() => {
if (title) {
setTableName(title.tableName);
const topic = `${SSE_TOPIC.PRINT_TABLE}/${title.fullTableName}`;
return subscribeTopic([topic], (data: SseData) => {
setConsoleInfo((preConsoleInfo) => preConsoleInfo + '\n' + data.data);
});
}
}, []);
useEffect(() => {
if (title) {
setTableName(title.tableName);
const topic = `${SSE_TOPIC.PRINT_TABLE}/${title.fullTableName}`;
return subscribeTopic([topic], (data: SseData) => {
setConsoleInfo((preConsoleInfo) => preConsoleInfo + '\n' + data.data);
});
}
}, []);

return <TextArea value={consoleInfo} style={{width: style.width, height: style.height}}/>;
return <TextArea value={consoleInfo} style={{ width: style.width, height: style.height }} />;
};

export const onAdd = async (tabs: Tab[], key: string, data: TaskDataType | undefined, refresh: any) => {
const statement = data?.statement;
export const onAdd = async (
tabs: Tab[],
key: string,
data: TaskDataType | undefined,
refresh: any
) => {
const statement = data?.statement;

if (!statement) return;
const tabNames = tabs.map((tab) => tab.label);
const result = await getPrintTables(statement);
const tables: PrintTable[] = result.data.filter((table: PrintTable) => !tabNames.includes(table.tableName));
if (!statement) return;
const tabNames = tabs.map((tab) => tab.label);
const result = await getPrintTables(statement);
const tables: PrintTable[] = result.data.filter(
(table: PrintTable) => !tabNames.includes(table.tableName)
);

let selectTable: PrintTable;
Modal.confirm({
title: l('pages.datastudio.print.table.inputTableName'),
content: (
<Select
defaultValue=''
style={{width: '90%'}}
onChange={(e, t: any) => {
selectTable = {tableName: t.label, fullTableName: t.value};
}}
options={tables.map((table) => ({label: table.tableName, value: table.fullTableName}))}
/>
),
onOk() {
tabs.push({
key: key + "/" + selectTable.tableName,
label: selectTable.tableName,
children: <DataPage title={selectTable} style={{width: '100%', height: '100%'}}/>
});
refresh()
// onOk(selectTable);
},
zIndex: 1000
});
}
let selectTable: PrintTable;
Modal.confirm({
title: l('pages.datastudio.print.table.inputTableName'),
content: (
<Select
defaultValue=''
style={{ width: '90%' }}
onChange={(e, t: any) => {
selectTable = { tableName: t.label, fullTableName: t.value };
}}
options={tables.map((table) => ({ label: table.tableName, value: table.fullTableName }))}
/>
),
onOk() {
tabs.push({
key: key + '/' + selectTable.tableName,
label: selectTable.tableName,
children: <DataPage title={selectTable} style={{ width: '100%', height: '100%' }} />
});
refresh();
// onOk(selectTable);
},
zIndex: 1000
});
};
Loading
Loading