This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch branch-1.5 in repository https://gitbox.apache.org/repos/asf/inlong.git
commit 933828234927489e7327d359f5213b47e3d1cc75 Author: Lizhen <[email protected]> AuthorDate: Fri Jan 6 18:55:14 2023 +0800 [INLONG-7176][Dashboard] Data flow group adds restart and stop state operations (#7177) --- inlong-dashboard/src/locales/cn.json | 6 ++++ inlong-dashboard/src/locales/en.json | 6 ++++ .../src/pages/GroupDashboard/config.tsx | 12 +++++++- .../src/pages/GroupDashboard/index.tsx | 36 +++++++++++++++++++++- 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json index bbb003abe..7b56eb441 100644 --- a/inlong-dashboard/src/locales/cn.json +++ b/inlong-dashboard/src/locales/cn.json @@ -453,9 +453,15 @@ "pages.GroupDashboard.config.WaitApproveCount": "待审批", "pages.GroupDashboard.config.Reject": "已驳回", "pages.GroupDashboard.config.ExecuteLog": "日志", + "pages.GroupDashboard.config.Restart": "重启", + "pages.GroupDashboard.config.Stop": "停止", "pages.GroupDashboard.ConfirmDelete": "确认删除吗", "pages.GroupDashboard.Create": "新建数据流组", "pages.GroupDashboard.SuccessfullyDeleted": "删除成功", + "pages.GroupDashboard.ConfirmRestart": "确认重启吗", + "pages.GroupDashboard.SuccessfullyRestart": "重启成功", + "pages.GroupDashboard.ConfirmStop": "确认停止吗", + "pages.GroupDashboard.SuccessfullyStop": "停止成功", "pages.GroupDetail.Info.Basic": "基础信息", "pages.GroupDetail.Info.Mq": "MQ 信息", "pages.GroupDetail.Info.Back": "返回", diff --git a/inlong-dashboard/src/locales/en.json b/inlong-dashboard/src/locales/en.json index 1b8551a20..d243632c9 100644 --- a/inlong-dashboard/src/locales/en.json +++ b/inlong-dashboard/src/locales/en.json @@ -453,9 +453,15 @@ "pages.GroupDashboard.config.WaitApproveCount": "WaitApproveCount", "pages.GroupDashboard.config.Reject": "Reject", "pages.GroupDashboard.config.ExecuteLog": "ExecuteLog", + "pages.GroupDashboard.config.Restart": "Restart", + "pages.GroupDashboard.config.Stop": "Stop", "pages.GroupDashboard.ConfirmDelete": "Confirm delete?", "pages.GroupDashboard.Create": "Create", "pages.GroupDashboard.SuccessfullyDeleted": "Successfully deleted", + "pages.GroupDashboard.ConfirmRestart": "Confirm restart?", + "pages.GroupDashboard.SuccessfullyRestart": "Successfully restart", + "pages.GroupDashboard.ConfirmStop": "Confirm stop?", + "pages.GroupDashboard.SuccessfullyStop": "Successfully stop", "pages.GroupDetail.Info.Basic": "Basic", "pages.GroupDetail.Info.Mq": "MQ", "pages.GroupDetail.Info.Back": "Back", diff --git a/inlong-dashboard/src/pages/GroupDashboard/config.tsx b/inlong-dashboard/src/pages/GroupDashboard/config.tsx index 7fb3a8dd3..049b9ca39 100644 --- a/inlong-dashboard/src/pages/GroupDashboard/config.tsx +++ b/inlong-dashboard/src/pages/GroupDashboard/config.tsx @@ -47,7 +47,7 @@ export const dashCardList = [ }, ]; -export const useColumns = ({ onDelete, openModal }) => { +export const useColumns = ({ onDelete, openModal, onRestart, onStop }) => { const { defaultValue } = useDefaultMeta('group'); const { Entity } = useLoadMeta<GroupMetaType>('group', defaultValue); @@ -86,6 +86,16 @@ export const useColumns = ({ onDelete, openModal }) => { <Button type="link" onClick={() => onDelete(record)}> {i18n.t('basic.Delete')} </Button> + {record?.status && (record?.status === 120 || record?.status === 130) && ( + <Button type="link" onClick={() => onRestart(record)}> + {i18n.t('pages.GroupDashboard.config.Restart')} + </Button> + )} + {record?.status && (record?.status === 120 || record?.status === 130) && ( + <Button type="link" onClick={() => onStop(record)}> + {i18n.t('pages.GroupDashboard.config.Stop')} + </Button> + )} {record?.status && (record?.status === 120 || record?.status === 130) && ( <Button type="link" onClick={() => openModal(record)}> {i18n.t('pages.GroupDashboard.config.ExecuteLog')} diff --git a/inlong-dashboard/src/pages/GroupDashboard/index.tsx b/inlong-dashboard/src/pages/GroupDashboard/index.tsx index c9b896fae..04642b0e4 100644 --- a/inlong-dashboard/src/pages/GroupDashboard/index.tsx +++ b/inlong-dashboard/src/pages/GroupDashboard/index.tsx @@ -85,6 +85,40 @@ const Comp: React.FC = () => { setGroupLogs({ visible: true, inlongGroupId: inlongGroupId }); }; + const onRestart = ({ inlongGroupId }) => { + Modal.confirm({ + title: i18n.t('pages.GroupDashboard.ConfirmRestart'), + onOk: async () => { + await request({ + url: `/group/restartProcess/${inlongGroupId}`, + method: 'POST', + data: { + groupId: inlongGroupId, + }, + }); + await getList(); + message.success(i18n.t('pages.GroupDashboard.SuccessfullyRestart')); + }, + }); + }; + + const onStop = ({ inlongGroupId }) => { + Modal.confirm({ + title: i18n.t('pages.GroupDashboard.ConfirmStop'), + onOk: async () => { + await request({ + url: `/group/suspendProcess/${inlongGroupId}`, + method: 'POST', + data: { + groupId: inlongGroupId, + }, + }); + await getList(); + message.success(i18n.t('pages.GroupDashboard.SuccessfullyStop')); + }, + }); + }; + const onChange = ({ current: pageNum, pageSize }) => { setOptions(prev => ({ ...prev, @@ -112,7 +146,7 @@ const Comp: React.FC = () => { title: summary[item.dataIndex] || 0, })); - const columns = useColumns({ onDelete, openModal }); + const columns = useColumns({ onDelete, openModal, onRestart, onStop }); const getFilterFormContent = useCallback( defaultValues => [
