Pārlūkot izejas kodu

fix: 添加和修复部分功能

nobody 2 gadi atpakaļ
vecāks
revīzija
91956e5a93

+ 10 - 7
src/module/datasource/component/DatasourceAdd.jsx

@@ -25,12 +25,12 @@ export default function DatasourceAdd({updateDataSource}) {
   const [form] = Form.useForm()
   // 测试连接
   const testConnect = async () => {
-    const filds = ['datasource_name','datasource','database_name','jdbc_username','jdbc_password','jdbc_url','comments', 'tag']
+    const fields = ['datasource_name','datasource','database_name','jdbc_username','jdbc_password','jdbc_url','comments', 'tag']
     try {
-      await form.validateFields(filds)
+      await form.validateFields(fields)
       setLoading(true)
-      const testData = form.getFieldsValue(filds)
-      const { data } = await testDataSourceConnection(testData)
+      const testData = form.getFieldsValue(fields)
+      const { data } = await testDataSourceConnection({...testData, tag: form.getFieldValue('tag').join('/')})
       if (data.data) {
         message.success('连接成功')
       } else {
@@ -43,8 +43,8 @@ export default function DatasourceAdd({updateDataSource}) {
   }
   // 完成添加
   const finishAdd = async () => {
-    const filds = ['datasource_name','datasource','database_name','jdbc_username','jdbc_password','jdbc_url','comments', 'tag']
-    const { data } = await createDataSource(form.getFieldsValue(filds))
+    const fields = ['datasource_name','datasource','database_name','jdbc_username','jdbc_password','jdbc_url','comments', 'tag']
+    const { data } = await createDataSource({...form.getFieldsValue(fields), tag: form.getFieldValue('tag').join('/')})
     if (data.code === 200) {
       message.success('添加成功')
       updateDataSource()
@@ -96,7 +96,7 @@ export default function DatasourceAdd({updateDataSource}) {
           onChange: val => setDataType(val),
         }}
         valueEnum={{
-          mysql: 'My SQL',
+          mysql: 'mysql',
           hive: 'hive',
         }}
         rules={[
@@ -120,6 +120,9 @@ export default function DatasourceAdd({updateDataSource}) {
       <ProFormSelect
         label="数据源标签"
         name="tag"
+        fieldProps={{
+          mode: 'tags'
+        }}
         valueEnum={{
           '线上': '线上',
           '测试': '测试',

+ 73 - 19
src/module/datasource/component/StepFour.jsx

@@ -1,7 +1,27 @@
 import React, { useState } from 'react'
-import { Form, Select, Input, DatePicker, Row, Col, InputNumber } from 'antd'
+import { Form, Select, Input, DatePicker, Row, Col, InputNumber, Checkbox } from 'antd'
+const { Option } = Select
 export default function StepFour({ syncDataForm }) {
+  // 是否展示分区时间
   const [showPartitionTime, setShowPartitionTime] = useState(false)
+  // 是否展示定时规则高级配置
+  const [showRuleConfig, setShowRuleConfig] = useState(false)
+  // 定时规则单位选择
+  const suffixSelector = (
+    <Select
+      style={{
+        width: 70,
+      }}
+      defaultValue="秒"
+    >
+      <Option value="秒">秒</Option>
+      <Option value="分钟">分钟</Option>
+      <Option value="小时">小时</Option>
+      <Option value="日">日</Option>
+      <Option value="周">周</Option>
+      <Option value="月">月</Option>
+    </Select>
+  );
   return (
     <>
       <p
@@ -43,6 +63,7 @@ export default function StepFour({ syncDataForm }) {
               {label: '最后一个', value: 'LAST'}
             ]}
             allowClear
+            placeholder='请选择路由策略'
           />
         </Form.Item>
         <Form.Item
@@ -57,8 +78,11 @@ export default function StepFour({ syncDataForm }) {
           <Select
             options={[
               {label: '单机串行', value: 'SERIAL_EXECUTION'},
+              {label: '丢弃后续调度', value: 'SERIAL_EXECUTION1'},
+              {label: '覆盖之前调度', value: 'SERIAL_EXECUTION2'},
             ]}
             allowClear
+            placeholder='请选择阻塞处理方式'
           />
         </Form.Item>
         <Form.Item
@@ -66,14 +90,14 @@ export default function StepFour({ syncDataForm }) {
           name="executor_timeout"
           required
         >
-          <InputNumber min={0} />
+          <InputNumber min={0} addonAfter="秒"/>
         </Form.Item>
         <Form.Item
           label="失败重试次数"
           name="executor_fail_retry_count"
           required
         >
-          <InputNumber  min={0} />
+          <InputNumber  min={0} addonAfter="次" />
         </Form.Item>
         <Form.Item
           label="增量开始时间"
@@ -84,13 +108,13 @@ export default function StepFour({ syncDataForm }) {
               message: '请选择增量开始时间',
             },
           ]}>
-          <DatePicker showTime/>
+          <DatePicker showTime placeholder='请选择增量开始时间'/>
         </Form.Item>
         <Form.Item
           label="增量时间字段"
           name="replace_param"
         >
-          <Input />
+          <Input placeholder="-DlastTime='%s' -DcurrentTime='%s'"/>
         </Form.Item>
         <Row span={24}>
           <Col span={8}>
@@ -111,6 +135,7 @@ export default function StepFour({ syncDataForm }) {
                     setShowPartitionTime(false)
                   }
                 }}
+                placeholder='请输入区分字段'
               />
             </Form.Item>
           </Col>
@@ -126,28 +151,57 @@ export default function StepFour({ syncDataForm }) {
                   wrapperCol={{
                     span: 12,
                   }}>
-                  <Input placeholder="yyyy-MM-dd" />
+                  <Select
+                    options={[
+                      {label: 'yyyy-MM-dd', value: 'yyyy-MM-dd'},
+                      {label: 'yyyyMMdd', value: 'yyyyMMdd'},
+                      {label: 'yyyy/MM/dd', value: 'yyyy/MM/dd'},
+                    ]}
+                    allowClear
+                    defaultValue={'yyyy-MM-dd'}
+                  />
                 </Form.Item>
               </Col>
               <Col>
-                <InputNumber defaultValue={0} style={{ marginLeft: '10px' }} />
+                <InputNumber defaultValue={0} style={{ marginLeft: '10px' }} max={0}/>
               </Col>
             </>
           ) : (
             ''
           )}
         </Row>
-        <Form.Item
-          label="定时规则"
-          name="job_cron"
-          rules={[
-            {
-              required: true,
-              message: '请输入定时规则',
-            },
-          ]}>
-          <Input />
-        </Form.Item>
+        <Row span={24}>
+          <Col span={8}>
+            <Form.Item
+              label="定时规则"
+              name="job_cron"
+              labelCol={{
+                span: 6,
+              }}
+              wrapperCol={{
+                span: 18,
+              }}
+              rules={[
+                {
+                  required: true,
+                  message: '请输入定时规则',
+                },
+              ]}>
+              {showRuleConfig ? <InputNumber
+                min={0}
+                addonAfter={suffixSelector}
+                placeholder='请输入定时规则'
+                style={{ width: '100%',}}
+              /> : <Input placeholder='请输入定时规则'/>}
+            </Form.Item>
+          </Col>
+          <Col span={8} style={{marginLeft: '20px'}}>
+            <Form.Item labelCol={{span: 3}}>
+              <Checkbox checked={showRuleConfig} onChange={(e) => {setShowRuleConfig(e.target.checked)}}>高级配置</Checkbox>
+            </Form.Item>
+          </Col>
+        </Row>
+        
         <Form.Item
           label="同步任务名称"
           name="job_desc"
@@ -157,7 +211,7 @@ export default function StepFour({ syncDataForm }) {
               message: '请输入定时规则',
             },
           ]}>
-          <Input />
+          <Input placeholder='请输入同步任务名称' />
         </Form.Item>
       </Form>
     </>

+ 5 - 4
src/module/datasource/component/StepOne.jsx

@@ -94,6 +94,7 @@ export default function StepOne({ drawDataForm, dataSourceList, updateTableStruc
           <Select
             options={datasources}
             onSelect={selectDatasource}
+            placeholder="请选择数据源"
           />
         </Form.Item>
         <Form.Item
@@ -105,7 +106,7 @@ export default function StepOne({ drawDataForm, dataSourceList, updateTableStruc
               message: '请选择表',
             },
           ]}>
-          <Select options={tableList} allowClear onSelect={selectTable} />
+          <Select options={tableList} allowClear onSelect={selectTable} placeholder="请选择数据表"/>
         </Form.Item>
         {datasourceType === 'mysql' ? (
           <>
@@ -113,16 +114,16 @@ export default function StepOne({ drawDataForm, dataSourceList, updateTableStruc
               label="查询字段"
               name="query_sql"
               wrapperCol={{ span: 10 }}>
-              <Input.TextArea rows={5} />
+              <Input.TextArea rows={5} placeholder="sql查询,一般用于多表关联查询时才用"/>
             </Form.Item>
             <Form.Item label="切分主键" name="reader_split_pk">
-              <Input />
+              <Input placeholder='切分主键' />
             </Form.Item>
             <Form.Item
               label="条件语句"
               name="where_param"
               wrapperCol={{ span: 10 }}>
-              <Input.TextArea rows={5} />
+              <Input.TextArea rows={5} placeholder="where条件"/>
             </Form.Item>
           </>
         ) : (

+ 4 - 3
src/module/datasource/component/StepTwo.jsx

@@ -95,6 +95,7 @@ export default function LoadFormConfig({ loadDataForm, dataSourceList, updateTab
           <Select
             options={datasources}
             onSelect={selectDatasource}
+            placeholder='请选择数据源'
             allowClear
           />
         </Form.Item>
@@ -107,15 +108,15 @@ export default function LoadFormConfig({ loadDataForm, dataSourceList, updateTab
               message: '请选择表',
             },
           ]}>
-          <Select options={tableList} allowClear onSelect={selectTable} />
+          <Select options={tableList} allowClear onSelect={selectTable} placeholder='请选择数据表' />
         </Form.Item>
         {datasourceType === 'mysql' ? (
           <>
             <Form.Item label="pre_sql" name="pre_sql" wrapperCol={{ span: 10 }}>
-              <Input.TextArea rows={5} />
+              <Input.TextArea rows={5} placeholder='请输入pre_sql语句'/>
             </Form.Item>
             <Form.Item label="post_sql" name="post_sql" wrapperCol={{ span: 10 }}>
-              <Input.TextArea rows={5} />
+              <Input.TextArea rows={5} placeholder='请输入post_sql语句'/>
             </Form.Item>
           </>
         ) : (