Skip to content

Commit

Permalink
hotfix datasource cannot save bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 committed Nov 15, 2023
1 parent f8610db commit a21e3de
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class DataBaseController {
* @param dataBaseDTO {@link DataBaseDTO}
* @return {@link Result}< {@link Void}>
*/
@PutMapping
@PutMapping("/saveOrUpdate")
@Log(title = "Insert Or Update DataBase", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Insert Or Update DataBase")
@ApiImplicitParam(
Expand Down
18 changes: 14 additions & 4 deletions dinky-web/src/components/Transfer/TreeTransfer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { Transfer, Tree } from 'antd';
import type { TransferDirection, TransferItem } from 'antd/es/transfer';
import type { DataNode } from 'antd/es/tree';
import React, { Key } from 'react';
import {WarningMessage} from "@/utils/messages";
import {l} from "@/utils/intl";

const { DirectoryTree } = Tree;
interface TreeTransferProps {
Expand Down Expand Up @@ -75,11 +77,19 @@ export const TreeTransfer: React.FC<TreeTransferProps> = ({
defaultExpandAll
checkedKeys={checkedKeys}
treeData={generateTree(dataSource, targetKeys)}
onCheck={(_, { node: { key } }) => {
onItemSelect(key as string, !isChecked(checkedKeys, key));
onCheck={ async (_, { node: { key,isLeaf } }) => {
if (isLeaf) {
onItemSelect(key as string, !isChecked(checkedKeys, key));
}else{
WarningMessage(l('rc.udf.register.select'))
}
}}
onSelect={(_, { node: { key } }) => {
onItemSelect(key as string, !isChecked(checkedKeys, key));
onSelect={ async (_, { node :{key,isLeaf}}) => {
if (isLeaf) {
onItemSelect(key as string, !isChecked(checkedKeys, key));
}else{
WarningMessage(l('rc.udf.register.select'))
}
}}
/>
);
Expand Down
1 change: 1 addition & 0 deletions dinky-web/src/locales/en-US/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ export default {
'rc.udf.register.className': 'Class Name',
'rc.udf.register.deleteConfirm': 'Are you sure you want to delete this UDF? ',
'rc.udf.register': 'Register UDF',
'rc.udf.register.select': 'Please select a non-directory node',
/**
*
* role
Expand Down
1 change: 1 addition & 0 deletions dinky-web/src/locales/zh-CN/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ export default {
'rc.udf.register.className': '类名',
'rc.udf.register.deleteConfirm': '确定删除该 UDF 吗?',
'rc.udf.register': '注册 UDF',
'rc.udf.register.select': '请选择非目录节点!',

/**
*
Expand Down
2 changes: 1 addition & 1 deletion dinky-web/src/pages/RegCenter/DataSource/service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export const handleTest = async (item: Partial<DataSources.DataSource>) => {
* @param item
*/
export const saveOrUpdateHandle = async (item: Partial<DataSources.DataSource>) => {
await handleAddOrUpdate(API_CONSTANTS.DATASOURCE, item);
await handleAddOrUpdate(API_CONSTANTS.DATASOURCE_ADD_OR_UPDATE, item);
};
1 change: 1 addition & 0 deletions dinky-web/src/services/endpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export enum API_CONSTANTS {

// datasource registries list
DATASOURCE = '/api/database/list',
DATASOURCE_ADD_OR_UPDATE = '/api/database/saveOrUpdate',
// datasource registries delete
DATASOURCE_DELETE = '/api/database/delete',
// datasource registries enable or disable
Expand Down

0 comments on commit a21e3de

Please sign in to comment.