peng.peng
2 years ago
10 changed files with 180 additions and 47 deletions
@ -0,0 +1,24 @@ |
|||
'use strict'; |
|||
|
|||
// 新增数据源
|
|||
function addDataSource(opts) { |
|||
return async function (ctx, next) { |
|||
|
|||
const models = ctx.fs.dc.models; |
|||
try { |
|||
let rslt = ctx.request.body; |
|||
await models.DataSource.create(Object.assign({}, rslt)) |
|||
ctx.status = 204; |
|||
ctx.body = { message: '新建数据源成功' } |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { message: '新建数据源失败' } |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
module.exports = { |
|||
addDataSource, |
|||
} |
@ -1,12 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
const model = require('../../controllers/adapter/index'); |
|||
|
|||
module.exports = function (app, router, opts, AuthCode) { |
|||
|
|||
app.fs.api.logAttr['POST/adapter/check/connect'] = { content: '增加模型信息', visible: true }; |
|||
router.post('/adapter/check/connect', model.checkConnect(opts)) |
|||
|
|||
|
|||
|
|||
}; |
@ -0,0 +1,14 @@ |
|||
'use strict'; |
|||
|
|||
const adapter = require('../../controllers/metadataAcquisition/adapter'); |
|||
|
|||
module.exports = function (app, router, opts, AuthCode) { |
|||
|
|||
app.fs.api.logAttr['POST/adapter/check/connect'] = { content: '测试适配器连接', visible: true }; |
|||
router.post('/adapter/check/connect', adapter.checkConnect(opts)) |
|||
|
|||
app.fs.api.logAttr['POST/adapter'] = { content: '增加适配器', visible: true }; |
|||
router.post('/adapter', adapter.addAdapter(opts)) |
|||
|
|||
|
|||
}; |
@ -0,0 +1,12 @@ |
|||
'use strict'; |
|||
|
|||
const dataSource = require('../../controllers/metadataAcquisition/dataSource'); |
|||
|
|||
module.exports = function (app, router, opts, AuthCode) { |
|||
|
|||
app.fs.api.logAttr['POST/meta/acq/dataSource'] = { content: '增加模型信息', visible: true }; |
|||
router.post('/meta/acq/dataSource', dataSource.addDataSource(opts)) |
|||
|
|||
|
|||
|
|||
}; |
@ -1,17 +1,96 @@ |
|||
import React, { useEffect, useState } from 'react' |
|||
import { Button } from 'antd'; |
|||
import '../../style.less'; |
|||
import { Button, Form, Input, Row, Col } from 'antd'; |
|||
import { |
|||
ProForm, |
|||
ProFormSelect, |
|||
ProFormTextArea, |
|||
ProFormText, |
|||
ProFormDigit |
|||
} from '@ant-design/pro-form'; |
|||
|
|||
import '../../style.less'; |
|||
function StepThree(props) { |
|||
const { prev, next } = props; |
|||
const { prev, next, stepOneValues, stepOneValuesFinish } = props; |
|||
const formRef = React.createRef(); |
|||
const initialValues = stepOneValues ? stepOneValues : { |
|||
|
|||
} |
|||
const formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 10 } }; |
|||
return <> |
|||
<div className='step-footer'> |
|||
<Button style={{ margin: '0 8px', }} onClick={() => prev()}>上一步</Button> |
|||
<Button type="primary" onClick={() => {next()}}> |
|||
完成 |
|||
</Button> |
|||
</div> |
|||
<ProForm |
|||
title={''} |
|||
initialValues={initialValues} |
|||
layout="horizontal" |
|||
grid={true} |
|||
{...formItemLayout} |
|||
modalProps={{ |
|||
destroyOnClose: true, |
|||
onCancel: () => { }, |
|||
}} |
|||
onFinish={async (values) => { |
|||
next() |
|||
stepOneValuesFinish(values) |
|||
return true; |
|||
}} |
|||
style={{ marginTop: 20 }} |
|||
submitter={{ |
|||
render: (props, defaultDoms) => { |
|||
return null; |
|||
}, |
|||
}} |
|||
> |
|||
<ProForm.Group title="请输入该计划任务执行时间"> |
|||
<ProFormText |
|||
rules={[{ required: true, message: '请输入数据源名称' }, |
|||
{ max: 255, message: '数据源名称长度不能大于255个字符' }, |
|||
]} |
|||
name="name" |
|||
label="名称" |
|||
style={{ |
|||
minWidth: 140, |
|||
}} |
|||
/> |
|||
|
|||
<ProFormText |
|||
rules={[{ required: true, message: '请输入cron表达式' }, |
|||
{ max: 255, message: 'cron表达式长度不能大于255个字符' }, |
|||
]} |
|||
name="name" |
|||
label="请输入cron表达式" |
|||
style={{ |
|||
minWidth: 140, |
|||
}} |
|||
/> |
|||
|
|||
<ProFormDigit |
|||
rules={[{ required: true, message: '请输入重试次数' }, |
|||
{ max: 10, message: '重试次数不能大于10个字符' }, |
|||
]} |
|||
name="name" |
|||
label="重试次数" |
|||
fieldProps={{ precision: 0, max: 10, }} |
|||
/> |
|||
|
|||
<ProFormText |
|||
rules={[{ required: true, message: '请输入时间间隔' }, |
|||
{ max: 255, message: '时间间隔长度不能大于255个字符' }, |
|||
]} |
|||
name="name" |
|||
label="时间间隔" |
|||
addonAfter={'分钟'} |
|||
/> |
|||
|
|||
</ProForm.Group> |
|||
|
|||
<div className='step-footer'> |
|||
<Button style={{ margin: '0 8px', }} onClick={() => prev()}>上一步</Button> |
|||
<Button type="primary" htmlType="submit"> |
|||
完成 |
|||
</Button> |
|||
</div> |
|||
</ProForm> |
|||
</> |
|||
} |
|||
|
|||
export default StepThree; |
|||
export default StepThree |
|||
|
|||
|
Loading…
Reference in new issue