Unverified Commit ed7e4557 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Fix][web] fix when switch flink cluster the query is error (#1427)

parent d31d1b36
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
* *
*/ */
import {Button, Divider, Dropdown, Empty, Menu, message, Modal, Select, Space, Tag, Tooltip} from "antd"; import {Button, Divider, Dropdown, Empty, Menu, message, Modal, Select, Space, Tag, Tooltip} from "antd";
import {StateType} from "@/pages/DataStudio/model"; import {StateType} from "@/pages/DataStudio/model";
import {connect} from "umi"; import {connect} from "umi";
...@@ -27,6 +26,7 @@ import ProTable from '@ant-design/pro-table'; ...@@ -27,6 +26,7 @@ import ProTable from '@ant-design/pro-table';
import {cancelJob, savepointJob, showFlinkJobs} from "../../StudioEvent/DDL"; import {cancelJob, savepointJob, showFlinkJobs} from "../../StudioEvent/DDL";
import JobStatus from "@/components/Common/JobStatus"; import JobStatus from "@/components/Common/JobStatus";
import {parseSecondStr} from "@/components/Common/function"; import {parseSecondStr} from "@/components/Common/function";
import {l} from "@/utils/intl";
const {Option} = Select; const {Option} = Select;
...@@ -38,8 +38,8 @@ const StudioProcess = (props: any) => { ...@@ -38,8 +38,8 @@ const StudioProcess = (props: any) => {
const savepoint = (key: string | number, currentItem: {}) => { const savepoint = (key: string | number, currentItem: {}) => {
Modal.confirm({ Modal.confirm({
title: key + '任务', title: l('pages.devops.jobinfo.job.key','',{key: key}),
content: `确定${key}该作业吗?`, content: l('pages.devops.jobinfo.job.keyConfirm','',{key: key}),
okText: l('button.confirm'), okText: l('button.confirm'),
cancelText: l('button.cancel'), cancelText: l('button.cancel'),
onOk: async () => { onOk: async () => {
...@@ -47,10 +47,10 @@ const StudioProcess = (props: any) => { ...@@ -47,10 +47,10 @@ const StudioProcess = (props: any) => {
let res = savepointJob(clusterId, currentItem.jid, key, key, 0); let res = savepointJob(clusterId, currentItem.jid, key, key, 0);
res.then((result) => { res.then((result) => {
if (result.datas == true) { if (result.datas == true) {
message.success(key + "成功"); message.success(l('pages.devops.jobinfo.job.key.success','',{key:key}));
onRefreshJobs(); onRefreshJobs();
} else { } else {
message.error(key + "失败"); message.error(l('pages.devops.jobinfo.job.key.failed','',{key:key}));
} }
}); });
} }
...@@ -63,52 +63,52 @@ const StudioProcess = (props: any) => { ...@@ -63,52 +63,52 @@ const StudioProcess = (props: any) => {
<Dropdown <Dropdown
overlay={ overlay={
<Menu onClick={({key}) => savepoint(key, item)}> <Menu onClick={({key}) => savepoint(key, item)}>
<Menu.Item key="trigger">Trigger</Menu.Item> <Menu.Item key="trigger">{l('pages.datastudio.label.process.trigger')}</Menu.Item>
<Menu.Item key="stop">Stop</Menu.Item> <Menu.Item key="stop">{l('pages.datastudio.label.process.stop')}</Menu.Item>
<Menu.Item key="cancel">Cancel</Menu.Item> <Menu.Item key="cancel">{l('pages.datastudio.label.process.cancel')}</Menu.Item>
</Menu> </Menu>
} }
> >
<a> <a>
SavePoint <DownOutlined/> {l('pages.datastudio.label.process.savepoint')} <DownOutlined/>
</a> </a>
</Dropdown> </Dropdown>
); );
const getColumns = () => { const getColumns = () => {
let columns: any = [{ let columns: any = [{
title: "作业ID", title: l('pages.devops.baseinfo.taskid'),
dataIndex: "jid", dataIndex: "jid",
key: "jid", key: "jid",
sorter: true, sorter: true,
}, { }, {
title: "作业名", title: l('pages.devops.baseinfo.name'),
dataIndex: "name", dataIndex: "name",
sorter: true, sorter: true,
}, { }, {
title: "状态", title: l('pages.devops.baseinfo.status'),
dataIndex: "state", dataIndex: "state",
sorter: true, sorter: true,
render: (_, row) => { render: (_, row) => {
return (<JobStatus status={row.state}/>); return (<JobStatus status={row.state}/>);
} }
}, { }, {
title: "开始时间", title: l('global.table.startTime'),
dataIndex: "start-time", dataIndex: "start-time",
sorter: true, sorter: true,
valueType: 'dateTime', valueType: 'dateTime',
}, { }, {
title: "最近修改时间", title: l('global.table.lastUpdateTime'),
dataIndex: "last-modification", dataIndex: "last-modification",
sorter: true, sorter: true,
valueType: 'dateTime', valueType: 'dateTime',
}, { }, {
title: "结束时间", title: l('global.table.endTime'),
dataIndex: "end-time", dataIndex: "end-time",
sorter: true, sorter: true,
valueType: 'dateTime', valueType: 'dateTime',
}, { }, {
title: "耗时", title: l('global.table.useTime'),
sorter: true, sorter: true,
render: (_, row) => { render: (_, row) => {
return (parseSecondStr(row.duration)) return (parseSecondStr(row.duration))
...@@ -151,7 +151,7 @@ const StudioProcess = (props: any) => { ...@@ -151,7 +151,7 @@ const StudioProcess = (props: any) => {
message.success(l('global.stay.tuned')); message.success(l('global.stay.tuned'));
}} }}
> >
详情 {l('pages.datastudio.label.process.detail')}
</a>]; </a>];
if (record.state == 'RUNNING' || record.state == 'RECONCILING' || record.state == 'SCHEDULED') { if (record.state == 'RUNNING' || record.state == 'RECONCILING' || record.state == 'SCHEDULED') {
option.push(<Divider type="vertical"/>); option.push(<Divider type="vertical"/>);
...@@ -160,7 +160,7 @@ const StudioProcess = (props: any) => { ...@@ -160,7 +160,7 @@ const StudioProcess = (props: any) => {
onCancel(record.jid); onCancel(record.jid);
}} }}
> >
停止 {l('pages.datastudio.label.process.stop')}
</a>); </a>);
} }
option.push(<SavePointBtn key="savepoint" item={record}/>,) option.push(<SavePointBtn key="savepoint" item={record}/>,)
...@@ -172,18 +172,18 @@ const StudioProcess = (props: any) => { ...@@ -172,18 +172,18 @@ const StudioProcess = (props: any) => {
const onCancel = (jobId: string) => { const onCancel = (jobId: string) => {
Modal.confirm({ Modal.confirm({
title: `确认停止作业【${jobId}】?`, title: l('pages.datastudio.label.process.stopconfirm','',{jobid:jobId}),
okText: '停止', okText: l('pages.datastudio.label.process.stop'),
cancelText: '取消', cancelText: l('button.cancel'),
onOk: async () => { onOk: async () => {
if (!clusterId) return; if (!clusterId) return;
let res = cancelJob(clusterId, jobId); let res = cancelJob(clusterId, jobId);
res.then((result) => { res.then((result) => {
if (result.datas == true) { if (result.datas == true) {
message.success("停止成功"); message.success(l('pages.datastudio.label.process.stopsuccess'));
onRefreshJobs(); onRefreshJobs();
} else { } else {
message.error("停止失败"); message.error(l('pages.datastudio.label.process.stopfailed'));
} }
}); });
} }
...@@ -226,7 +226,7 @@ const StudioProcess = (props: any) => { ...@@ -226,7 +226,7 @@ const StudioProcess = (props: any) => {
<Space> <Space>
<Select <Select
// style={{width: '100%'}} // style={{width: '100%'}}
placeholder="选择Flink集群" placeholder={l('pages.datastudio.label.process.switchcluster')}
optionLabelProp="label" optionLabelProp="label"
onChange={onChangeCluster} onChange={onChangeCluster}
> >
......
...@@ -225,6 +225,16 @@ export default { ...@@ -225,6 +225,16 @@ export default {
'pages.metadata.help.exec': "exec sql", 'pages.metadata.help.exec': "exec sql",
'pages.datastudio.label.process': 'Process', 'pages.datastudio.label.process': 'Process',
'pages.datastudio.label.process.detail': 'Detail',
'pages.datastudio.label.process.savepoint': 'SavePoint',
'pages.datastudio.label.process.trigger': 'Trigger',
'pages.datastudio.label.process.cancel': 'Cancel',
'pages.datastudio.label.process.stop': 'Stop',
'pages.datastudio.label.process.stopconfirm': 'Are you sure to stop [{jobid}]?',
'pages.datastudio.label.process.stopsuccess': 'Stop Succeeded',
'pages.datastudio.label.process.stopfailed': 'Stop Failed',
'pages.datastudio.label.process.switchcluster': 'Select Flink cluster',
'pages.datastudio.label.history': 'History', 'pages.datastudio.label.history': 'History',
'pages.datastudio.label.function': 'Function', 'pages.datastudio.label.function': 'Function',
...@@ -666,6 +676,7 @@ export default { ...@@ -666,6 +676,7 @@ export default {
'pages.devops.jobinfo.job.key.failed':'{key} Failed', 'pages.devops.jobinfo.job.key.failed':'{key} Failed',
'pages.devops.jobinfo.job.keyConfirm': 'Are you sure {key} this job?', 'pages.devops.jobinfo.job.keyConfirm': 'Are you sure {key} this job?',
'pages.devops.baseinfo.taskid': 'Task Id',
'pages.devops.baseinfo.name': 'Name', 'pages.devops.baseinfo.name': 'Name',
'pages.devops.baseinfo.status': 'Status', 'pages.devops.baseinfo.status': 'Status',
'pages.devops.baseinfo.readbytes': 'Receive Bytes', 'pages.devops.baseinfo.readbytes': 'Receive Bytes',
......
...@@ -228,6 +228,16 @@ export default { ...@@ -228,6 +228,16 @@ export default {
'pages.datastudio.label.lineage.collapse.lineage': '展开血缘', 'pages.datastudio.label.lineage.collapse.lineage': '展开血缘',
'pages.datastudio.label.process': '进程', 'pages.datastudio.label.process': '进程',
'pages.datastudio.label.process.detail': '详情',
'pages.datastudio.label.process.savepoint': '保存点',
'pages.datastudio.label.process.trigger': '触发',
'pages.datastudio.label.process.cancel': 'Cancel',
'pages.datastudio.label.process.stop': '停止',
'pages.datastudio.label.process.stopconfirm': '确定停止 【{jobid}】?',
'pages.datastudio.label.process.stopsuccess': '停止成功',
'pages.datastudio.label.process.stopfailed': '停止失败',
'pages.datastudio.label.process.switchcluster': '选择Flink集群',
'pages.datastudio.label.history': '历史', 'pages.datastudio.label.history': '历史',
'pages.datastudio.label.function': '函数', 'pages.datastudio.label.function': '函数',
...@@ -667,6 +677,7 @@ export default { ...@@ -667,6 +677,7 @@ export default {
'pages.devops.jobinfo.job.key.failed':'{key} 失败', 'pages.devops.jobinfo.job.key.failed':'{key} 失败',
'pages.devops.jobinfo.job.keyConfirm':'确定{key} 该作业吗?', 'pages.devops.jobinfo.job.keyConfirm':'确定{key} 该作业吗?',
'pages.devops.baseinfo.taskid': '任务ID',
'pages.devops.baseinfo.name': '名称', 'pages.devops.baseinfo.name': '名称',
'pages.devops.baseinfo.status': '状态', 'pages.devops.baseinfo.status': '状态',
'pages.devops.baseinfo.readbytes': '接收字节', 'pages.devops.baseinfo.readbytes': '接收字节',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment