From 63c6bf124fa68291e29bc21d377ff38b96a5467b Mon Sep 17 00:00:00 2001 From: wohainilaodou Date: Tue, 12 Nov 2024 15:33:00 +0800 Subject: [PATCH] [INLONG-11485][Dashboard] Support multiple scheduling enginessearch --- .../plugins/sync/common/SyncDefaultInfo.ts | 41 ++++++++++++++++--- inlong-dashboard/src/ui/locales/cn.json | 4 ++ inlong-dashboard/src/ui/locales/en.json | 4 ++ .../pages/Clusters/AgentBatchUpdateModal.tsx | 2 - .../src/ui/pages/Clusters/HeartBeatModal.tsx | 4 +- .../src/ui/pages/Clusters/NodeEditModal.tsx | 29 +++++++------ .../src/ui/pages/Clusters/NodeManage.tsx | 2 - .../ui/pages/Clusters/OperationLogModal.tsx | 1 - .../ui/pages/ModuleAudit/IpModule/index.tsx | 1 - .../pages/SynchronizeDetail/Info/config.tsx | 2 + .../ui/pages/SynchronizeDetail/Info/index.tsx | 11 +++-- 11 files changed, 68 insertions(+), 33 deletions(-) diff --git a/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts b/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts index 1fbf1ecfdac..7bf18927d9a 100644 --- a/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts +++ b/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts @@ -73,7 +73,7 @@ export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList { }) @ColumnDecorator() @I18n('meta.Synchronize.GroupOwners') - inCharges: string; + inCharges: string[]; @FieldDecorator({ type: 'radio', @@ -120,22 +120,51 @@ export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList { @FieldDecorator({ type: 'radio', - initialValue: 0, + initialValue: 'Quartz', visible: values => values.inlongGroupMode === 2, rules: [{ required: true }], props: { options: [ { - label: i18n.t('meta.Synchronize.Conventional'), - value: 0, + label: i18n.t('meta.Synchronize.ScheduleQuartz'), + value: 'Quartz', }, { - label: i18n.t('meta.Synchronize.Crontab'), - value: 1, + label: i18n.t('meta.Synchronize.ScheduleAirflow'), + value: 'Airflow', + }, + { + label: i18n.t('meta.Synchronize.DolphinScheduler'), + value: 'DolphinScheduler', }, ], }, }) + @I18n('meta.Synchronize.ScheduleEngine') + scheduleEngine: string; + + @FieldDecorator({ + type: 'radio', + initialValue: 0, + visible: values => values.inlongGroupMode === 2, + + rules: [{ required: true }], + props: values => { + return { + disabled: values.scheduleEngine === 'DolphinScheduler', + options: [ + { + label: i18n.t('meta.Synchronize.Conventional'), + value: 0, + }, + { + label: i18n.t('meta.Synchronize.Crontab'), + value: 1, + }, + ], + }; + }, + }) @I18n('meta.Synchronize.ScheduleType') scheduleType: Number; @FieldDecorator({ diff --git a/inlong-dashboard/src/ui/locales/cn.json b/inlong-dashboard/src/ui/locales/cn.json index 7a8e2ea1ddf..8e498f8f2c3 100644 --- a/inlong-dashboard/src/ui/locales/cn.json +++ b/inlong-dashboard/src/ui/locales/cn.json @@ -432,6 +432,10 @@ "meta.Synchronize.OfflineSync": "离线同步", "meta.Synchronize.SchedulingRules": "调度规则", "meta.Synchronize.ScheduleType": "调度类型", + "meta.Synchronize.ScheduleEngine": "调度引擎", + "meta.Synchronize.ScheduleQuartz": "Quartz", + "meta.Synchronize.ScheduleAirflow": "Airflow", + "meta.Synchronize.DolphinScheduler": "DolphinScheduler", "meta.Synchronize.Conventional": "常规", "meta.Synchronize.Crontab": "Crontab", "meta.Synchronize.DelayTime": "延迟时间", diff --git a/inlong-dashboard/src/ui/locales/en.json b/inlong-dashboard/src/ui/locales/en.json index ce06b61f3c4..a176d810efb 100644 --- a/inlong-dashboard/src/ui/locales/en.json +++ b/inlong-dashboard/src/ui/locales/en.json @@ -432,6 +432,10 @@ "meta.Synchronize.OfflineSync": "Offline Sync", "meta.Synchronize.SchedulingRules": "Scheduling Rules", "meta.Synchronize.ScheduleType": "Schedule Type", + "meta.Synchronize.ScheduleEngine": "Schedule Engine", + "meta.Synchronize.ScheduleQuartz": "Quartz", + "meta.Synchronize.ScheduleAirflow": "Airflow", + "meta.Synchronize.DolphinScheduler": "DolphinScheduler", "meta.Synchronize.Conventional": "Conventional", "meta.Synchronize.Crontab": "Crontab", "meta.Synchronize.DelayTime": "Delay Time", diff --git a/inlong-dashboard/src/ui/pages/Clusters/AgentBatchUpdateModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/AgentBatchUpdateModal.tsx index e56a8cb7e39..561e65898e3 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/AgentBatchUpdateModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/AgentBatchUpdateModal.tsx @@ -216,7 +216,6 @@ const Comp: React.FC = ({ agentList, agentTotal, parentId, ...modalProps const submitList = []; valuesToSubmitList(agentList, values, submitList); - console.log('submitList', submitList); const baseBatchSize = Math.floor(submitList.length / values.batchNum) === 0 ? 1 @@ -224,7 +223,6 @@ const Comp: React.FC = ({ agentList, agentTotal, parentId, ...modalProps const remainder = submitList.length % values.batchNum; const map = new Map(); const batchNum = agentList.length < values.batchNum ? agentList.length : values.batchNum; - console.log('batchNum', batchNum, 'baseBatchSize', baseBatchSize, 'remainder', remainder); for (let i = 1; i <= batchNum; i++) { if (i === batchNum) { diff --git a/inlong-dashboard/src/ui/pages/Clusters/HeartBeatModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/HeartBeatModal.tsx index 3895f1f9862..01100f2864b 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/HeartBeatModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/HeartBeatModal.tsx @@ -51,9 +51,7 @@ const Comp: React.FC = ({ ...modalProps }) => { }, { refreshDeps: [options], - onSuccess: data => { - console.log(data); - }, + onSuccess: data => {}, }, ); diff --git a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx index 5a38817553d..0496e820cfe 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx @@ -76,23 +76,23 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m submitData.sshKey = ''; } } - if (type === 'AGENT') { - if (submitData.installer !== undefined) { - if (Array.isArray(submitData.moduleIdList)) { - submitData.moduleIdList = submitData.moduleIdList.concat(submitData.installer); - } else { - submitData.moduleIdList = [submitData.moduleIdList].concat(submitData.installer); - } + } + if (type === 'AGENT') { + if (submitData.installer !== undefined) { + if (Array.isArray(submitData.moduleIdList)) { + submitData.moduleIdList = submitData.moduleIdList.concat(submitData.installer); + } else { + submitData.moduleIdList = [submitData.moduleIdList].concat(submitData.installer); } } - await request({ - url: `/cluster/node/${isUpdate ? 'update' : 'save'}`, - method: 'POST', - data: submitData, - }); - await modalProps?.onOk(submitData); - message.success(i18n.t('basic.OperatingSuccess')); } + await request({ + url: `/cluster/node/${isUpdate ? 'update' : 'save'}`, + method: 'POST', + data: submitData, + }); + await modalProps?.onOk(submitData); + message.success(i18n.t('basic.OperatingSuccess')); }; const [agentInstaller, setAgentInstaller] = useState([]); @@ -105,7 +105,6 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m pageSize: 9999, }, }); - console.log('result', result); setAgentInstaller(result.list?.sort((a, b) => b.modifyTime - a.modifyTime)); return result; }; diff --git a/inlong-dashboard/src/ui/pages/Clusters/NodeManage.tsx b/inlong-dashboard/src/ui/pages/Clusters/NodeManage.tsx index 7e2a5587921..74ab2112e53 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/NodeManage.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/NodeManage.tsx @@ -308,7 +308,6 @@ const Comp: React.FC = () => { getModuleList().then(res => { agentInstallerList.current = res?.list; setAgentVersionObj(versionMap(res?.list)); - console.log(agentInstallerList.current, agentVersionObj); }); })(); }, [type]); @@ -324,7 +323,6 @@ const Comp: React.FC = () => { useEffect(() => { const handleResize = () => { - console.log('window.innerWidth', window.innerWidth); setIsSmall(window.innerWidth < 1600); }; diff --git a/inlong-dashboard/src/ui/pages/Clusters/OperationLogModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/OperationLogModal.tsx index 274fe01c4af..d829dc557ad 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/OperationLogModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/OperationLogModal.tsx @@ -65,7 +65,6 @@ const Comp: React.FC = ({ ...modalProps }) => { }; const onFilter = allValues => { - console.log(allValues); setOptions(prev => ({ ...prev, ...allValues, diff --git a/inlong-dashboard/src/ui/pages/ModuleAudit/IpModule/index.tsx b/inlong-dashboard/src/ui/pages/ModuleAudit/IpModule/index.tsx index 4e56b37ee5e..9aab3b903c6 100644 --- a/inlong-dashboard/src/ui/pages/ModuleAudit/IpModule/index.tsx +++ b/inlong-dashboard/src/ui/pages/ModuleAudit/IpModule/index.tsx @@ -69,7 +69,6 @@ const Comp: React.FC = ({ auditData }) => { ? sourceData[0] : sourceData[1]; const output = baseData?.auditSet?.reduce((acc, cur) => { - console.log('cur', cur, sourceData[0].auditId, baseData.auditId); acc[cur.inlongGroupId + cur.inlongStreamId] = { inlongGroupId: cur.inlongGroupId, inlongStreamId: cur.inlongStreamId, diff --git a/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/config.tsx b/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/config.tsx index 78aac3df652..9d227ecdd16 100644 --- a/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/config.tsx +++ b/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/config.tsx @@ -85,6 +85,7 @@ export const useFormContent = ({ mqType, editing, isCreate, isUpdate }) => { return ( !defaultGroupKeysI18nMap[formName] || [ + 'scheduleEngine', 'scheduleType', 'time', 'crontabExpression', @@ -149,6 +150,7 @@ function transType(editing: boolean, conf) { 'ttl', 'retentionTime', 'retentionSize', + 'scheduleEngine', 'scheduleType', 'scheduleUnit', 'scheduleInterval', diff --git a/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/index.tsx b/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/index.tsx index e6325dcf5dd..f5ed2767617 100644 --- a/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/index.tsx +++ b/inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/index.tsx @@ -138,11 +138,10 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly, isCreate }: Props, ref) const onOk = async () => { const values = await form.validateFields(); - let submitData = { ...values, version: data?.version, - inCharges: values.inCharges?.join(','), + inCharges: values.inCharges instanceof Array ? values.inCharges?.join(',') : values.inCharges, }; if (values.inlongGroupMode === 2) { submitData = { @@ -228,7 +227,13 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly, isCreate }: Props, ref) form={form} content={formContent} initialValues={data} - onValuesChange={(c, values) => setMqType(values.mqType)} + onValuesChange={(c, values) => { + setMqType(values.mqType); + if (c.scheduleEngine === 'DolphinScheduler') { + form.setFieldsValue({ scheduleType: 1 }); + values.scheduleType = 1; + } + }} useMaxWidth={1400} col={14} labelWrap