Skip to content

Commit

Permalink
[Optimization]Cluster config restore Test Connection (#3123)
Browse files Browse the repository at this point in the history
Co-authored-by: gaoyan1998 <gaoyan1998@users.noreply.github.com>
  • Loading branch information
gaoyan1998 and gaoyan1998 authored Feb 1, 2024
1 parent 6e36d76 commit a254632
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions dinky-web/src/locales/en-US/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default {
'button.collapse-all': 'Collapse All',
'button.position': 'Position',
'button.test': 'Test',
'button.test.connection': 'Test Connection',
'button.clear': 'Clear',
'button.copy': 'Copy',
'button.refreshData': 'Refresh Data',
Expand Down
1 change: 1 addition & 0 deletions dinky-web/src/locales/zh-CN/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default {
'button.collapse-all': '全部折叠',
'button.position': '定位',
'button.test': '测试',
'button.test.connection': '测试连接',
'button.clear': '清除',
'button.copy': '复制',
'button.refreshData': '刷新数据',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ const Project: React.FC = (props: connect) => {
payload: getRightSelectKeyFromNodeClickJobType(type)
});
const bottomKey = getBottomSelectKeyFromNodeClickJobType(type);
dispatch({
type: STUDIO_MODEL.updateSelectBottomKey,
payload: bottomKey
});

if (bottomKey === LeftBottomKey.TOOLS_KEY) {
dispatch({
type: STUDIO_MODEL.updateSelectBottomSubKey,
Expand Down
6 changes: 0 additions & 6 deletions dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ const MiddleContainer = (props: any) => {
payload: getRightSelectKeyFromNodeClickJobType(subType ?? '')
});

// 根据 作业类型渲染 左下角选中菜单 key
dispatch({
type: STUDIO_MODEL.updateSelectBottomKey,
payload: getBottomSelectKeyFromNodeClickJobType(subType ?? '')
});

// 这里如果加此项功能和定位功能重复 , 暂时注释
// if (item.type === TabsPageType.project) {
// 更新左侧树选中的 key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export default () => {
onClose={handleCancel}
value={{}}
onSubmit={handleSubmit}
onHeartBeat={handleCheckHeartBeat}
/>
{/*modify*/}
{clusterConfigState.editOpen && (
Expand All @@ -311,6 +312,7 @@ export default () => {
onClose={handleCancel}
value={clusterConfigState.value}
onSubmit={handleSubmit}
onHeartBeat={handleCheckHeartBeat}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
*/

import { LoadingBtn } from '@/components/CallBackButton/LoadingBtn';
import { FormContextValue } from '@/components/Context/FormContext';
import { STUDIO_MODEL_ASYNC } from '@/pages/DataStudio/model';
import ConfigurationForm from '@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm';
Expand All @@ -32,9 +33,10 @@ type ConfigurationModalProps = {
onClose: () => void;
value: Partial<Cluster.Config>;
onSubmit: (values: Partial<Cluster.Config>) => void;
onHeartBeat: (values: Partial<Cluster.Config>) => void;
};
const ConfigurationModal: React.FC<ConfigurationModalProps & connect> = (props) => {
const { visible, onClose, onSubmit, value, dispatch } = props;
const { visible, onClose, onSubmit, value, onHeartBeat, dispatch } = props;

/**
* init form
Expand Down Expand Up @@ -82,6 +84,14 @@ const ConfigurationModal: React.FC<ConfigurationModalProps & connect> = (props)
handleCancel();
};

/**
* handle test connect
* */
const handleTestConnect = async () => {
const fieldsValue = await form.validateFields();
await onHeartBeat(fieldsValue);
};

/**
* render footer
* @returns {[JSX.Element, JSX.Element]}
Expand All @@ -91,6 +101,16 @@ const ConfigurationModal: React.FC<ConfigurationModalProps & connect> = (props)
<Button key={'cancel'} onClick={() => handleCancel()}>
{l('button.cancel')}
</Button>,
<LoadingBtn
key={'test'}
props={{
size: 'middle',
type: 'primary',
style: { background: '#52c41a' }
}}
click={handleTestConnect}
title={l('button.test.connection')}
/>,
<Button
key={'finish'}
loading={submitting}
Expand All @@ -99,7 +119,7 @@ const ConfigurationModal: React.FC<ConfigurationModalProps & connect> = (props)
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')}
{l('button.save')}
</Button>
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const InstanceModal: React.FC<InstanceModalProps> = (props) => {
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')}
{l('button.save')}
</Button>
];
};
Expand Down

0 comments on commit a254632

Please sign in to comment.