diff --git a/web/mock/datamanagement/pipeline.js b/web/mock/datamanagement/pipeline.js new file mode 100644 index 00000000..9b2e587a --- /dev/null +++ b/web/mock/datamanagement/pipeline.js @@ -0,0 +1,101 @@ +var pipelineList = [{ + name:"fix_locales", + desc: "test fix_locales", + processors: ` [ + { + "set": { + "if": "ctx['locales'].empty", + "field": "locales", + "value": "en-en" + } + }, + { + "set": { + "field": "reindexBatch", + "value": 3 + } + }, + { + "split": { + "field": "locales", + "separator": "," + } + } + ]` + },{ + name:"fix_locales", + desc: "test fix_locales", + processors: ` [ + { + "set": { + "if": "ctx['locales'].empty", + "field": "locales", + "value": "en-en" + } + }, + { + "set": { + "field": "reindexBatch", + "value": 3 + } + }, + { + "split": { + "field": "locales", + "separator": "," + } + } + ]` + }]; +export default { + 'get /data/pipeline': function (req, res) { + res.json(pipelineList); + }, + 'POST /data/pipeline/add': (req, res) => { + pipelineList.push(req.body); + setTimeout(() => { + res.send({ message: 'Ok' }); + },2000); + }, + 'PUT /data/pipeline/update': (req, res) => { + var targetIdx = -1; + pipelineList.forEach(function(p, i){ + if(p.name == req.body.name){ + targetIdx = i; + } + }); + console.log(req.body); + if(targetIdx > -1) { + pipelineList[targetIdx] = req.body + setTimeout(() => { + res.send({ message: 'Ok' }); + },2000); + return; + } + res.send({ message: 'Fail' }); + }, + //delete /data/pipeline/:name + 'POST /data/pipeline': (req, res) => { + var keys = req.body.key || []; + var hasDeleted = false; + for(let i=0; i< keys.length; i++){ + var targetIdx = -1; + pipelineList.forEach(function(p, j){ + if(keys[i] == p.name){ + targetIdx = j; + } + }); + if(targetIdx > -1) { + pipelineList.splice(targetIdx, 1); + hasDeleted = true; + } + } + if(hasDeleted) { + setTimeout(() => { + res.send({ message: 'Ok' }); + },2000); + return; + } + res.send({ message: 'Fail' }); + }, + }; \ No newline at end of file diff --git a/web/src/pages/DataManagement/IngestPipeline.js b/web/src/pages/DataManagement/IngestPipeline.js index 0d238ed7..2834a035 100644 --- a/web/src/pages/DataManagement/IngestPipeline.js +++ b/web/src/pages/DataManagement/IngestPipeline.js @@ -1,80 +1,386 @@ -import React, { Component,Fragment } from 'react'; +import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; -import { Card,Form,Input, Select,Button } from 'antd'; -const { Option } = Select; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import DescriptionList from '@/components/DescriptionList'; -import styles from '../profile/AdvancedProfile.less'; -const { Description } = DescriptionList; +import moment from 'moment'; +import { + Row, + Col, + Card, + Form, + Input, + Select, + Icon, + Button, + Dropdown, + Menu, + InputNumber, + DatePicker, + Modal, + message, + Badge, + Divider, + Steps, + Radio, +} from 'antd'; +import StandardTable from '@/components/StandardTable'; +import PageHeaderWrapper from '@/components/PageHeaderWrapper'; + +import styles from '../List/TableList.less'; + const FormItem = Form.Item; +const { Step } = Steps; const { TextArea } = Input; +const { Option } = Select; +const getValue = obj => + Object.keys(obj) + .map(key => obj[key]) + .join(','); +const statusMap = ['default', 'processing', 'success', 'error']; +const status = ['关闭', '运行中', '已上线', '异常']; -@connect(({ profile, loading }) => ({ - profile, - loading: loading.effects['profile/fetchBasic'], +const CreateForm = Form.create()(props => { + const { modalVisible, form, handleAdd, handleModalVisible } = props; + const okHandle = () => { + form.validateFields((err, fieldsValue) => { + if (err) return; + form.resetFields(); + handleAdd(fieldsValue); + }); + }; + return ( + handleModalVisible()} + > + + {form.getFieldDecorator('name', { + rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }], + })()} + + + {form.getFieldDecorator('desc', { + rules: [{ required: false }], + })()} + + + {form.getFieldDecorator('processors', { + rules: [{ required: true }], + })(