Skip to content

Commit

Permalink
hotfix datasource cannot save bug (DataLinkDC#2527)
Browse files Browse the repository at this point in the history
* hotfix datasource cannot save bug

* Spotless Apply

* fix

---------

Co-authored-by: zhu-mingye <[email protected]>
  • Loading branch information
Zzm0809 and zhu-mingye authored Nov 15, 2023
1 parent f8610db commit 873ffed
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 44 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 @@ -17,6 +17,8 @@
*
*/

import { l } from '@/utils/intl';
import { WarningMessage } from '@/utils/messages';
import { Transfer, Tree } from 'antd';
import type { TransferDirection, TransferItem } from 'antd/es/transfer';
import type { DataNode } from 'antd/es/tree';
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
4 changes: 3 additions & 1 deletion dinky-web/src/locales/en-US/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ export default {
'devops.jobinfo.savepoint.stop': 'SavePoint Pause',
'devops.jobinfo.savepoint.trigger': 'SavePoint Triggers',
'devops.jobinfo.smart_stop': 'Smart Stop',
'devops.jobinfo.unable.obtain.status': 'Unable to connect to Flink cluster to obtain the latest job status information',
'devops.jobinfo.unable.obtain.status':
'Unable to connect to Flink cluster to obtain the latest job status information',
'devops.jobinfo.version.delete': 'Delete Version',
'devops.jobinfo.version.delete.sure': 'Are you sure you want to remove this version?V{version}',
'devops.jobinfo.version.latestVersion': 'Current Version',
Expand Down Expand Up @@ -857,6 +858,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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { transformTableDataToCsv } from '@/utils/function';
import { l } from '@/utils/intl';
import { SearchOutlined } from '@ant-design/icons';
import { Highlight } from '@ant-design/pro-layout/es/components/Help/Search';
import { Button, Empty, Input, InputRef, Space, Table, Tag } from 'antd';
import { Button, Empty, Input, InputRef, Space, Table } from 'antd';
import { ColumnsType, ColumnType } from 'antd/es/table';
import { FilterConfirmProps } from 'antd/es/table/interface';
import { DataIndex } from 'rc-table/es/interface';
Expand Down
52 changes: 30 additions & 22 deletions dinky-web/src/pages/DevOps/JobDetail/JobOverview/JobOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import FlinkDag from '@/components/FlinkDag';
import { JobProps } from '@/pages/DevOps/JobDetail/data';
import FlinkTable from '@/pages/DevOps/JobDetail/JobOverview/components/FlinkTable';
import JobDesc from '@/pages/DevOps/JobDetail/JobOverview/components/JobDesc';
import { l } from '@/utils/intl';
import { ProCard } from '@ant-design/pro-components';
import { Button, Empty, Result } from 'antd';
import { useState } from 'react';
import { isStatusDone } from '../../function';
import { l } from '@/utils/intl';

const JobConfigTab = (props: JobProps) => {
const { jobDetail } = props;
Expand All @@ -34,33 +34,41 @@ const JobConfigTab = (props: JobProps) => {

return (
<>
{
isStatusDone(jobDetail?.instance?.status as string) && !showHistory ? <Result
status="warning"
{isStatusDone(jobDetail?.instance?.status as string) && !showHistory ? (
<Result
status='warning'
title={l('devops.jobinfo.unable.obtain.status')}
extra={
<Button type="primary" key="console" onClick={()=>{setShowHistory(true)}}>
<Button
type='primary'
key='console'
onClick={() => {
setShowHistory(true);
}}
>
{l('devops.jobinfo.recently.job.status')}
</Button>
}
/> : undefined
}
{(showHistory || !isStatusDone(jobDetail?.instance?.status as string)) ?
<><JobDesc jobDetail={jobDetail}/>
<ProCard
style={{
height: '40vh'
}}
>
{job ? (
<FlinkDag job={job} checkPoints={jobDetail.jobDataDto.checkpoints}/>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
)}
</ProCard>
/>
) : undefined}
{showHistory || !isStatusDone(jobDetail?.instance?.status as string) ? (
<>
<JobDesc jobDetail={jobDetail} />
<ProCard
style={{
height: '40vh'
}}
>
{job ? (
<FlinkDag job={job} checkPoints={jobDetail.jobDataDto.checkpoints} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</ProCard>

<FlinkTable jobDetail={jobDetail} /></> : undefined
}
<FlinkTable jobDetail={jobDetail} />
</>
) : undefined}
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion dinky-web/src/pages/DevOps/JobDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import JobLifeCycleTag from '@/components/JobTags/JobLifeCycleTag';
import StatusTag from '@/components/JobTags/StatusTag';
import AlertHistory from '@/pages/DevOps/JobDetail/AlertHistory';
import CheckPoints from '@/pages/DevOps/JobDetail/CheckPointsTab';
import JobLineage from '@/pages/DevOps/JobDetail/JobLineage';
Expand All @@ -36,7 +37,6 @@ import { useRequest } from '@umijs/max';
import { Tag } from 'antd';
import { useState } from 'react';
import { connect, useLocation } from 'umi';
import StatusTag from "@/components/JobTags/StatusTag";

/**
* Enum defining different operators for the JobDetail component.
Expand Down
26 changes: 13 additions & 13 deletions dinky-web/src/pages/RegCenter/DataSource/service.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

Expand All @@ -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);
};
3 changes: 2 additions & 1 deletion dinky-web/src/services/endpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ export enum API_CONSTANTS {
CLUSTER_CONFIGURATION_START = '/api/cluster/deploySessionClusterInstance',
// cluster configuration list
CLUSTER_CONFIGURATION = '/api/clusterConfiguration/list',
CLUSTER_CONFIGURATION_ADD_OR_UPDATE = '/api/clusterConfiguration/addOrUpdate',
CLUSTER_CONFIGURATION_ADD_OR_UPDATE = '/api/clusterConfiguration/saveOrUpdate',
CLUSTER_CONFIGURATION_DELETE = '/api/clusterConfiguration/delete',
CLUSTER_CONFIGURATION_ENABLE = '/api/clusterConfiguration/enable',
CLUSTER_CONFIGURATION_TEST = '/api/clusterConfiguration/testConnect',

// 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 873ffed

Please sign in to comment.