diff --git a/web/mock/search/alias.js b/web/mock/search/alias.js index 6265e581..5faac860 100644 --- a/web/mock/search/alias.js +++ b/web/mock/search/alias.js @@ -3,54 +3,173 @@ export default { res.send({ ".kibana": { "alias": ".kibana", - "index": [ - ".kibana_1" + "indexes": [ + { + "index": ".kibana_1", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + } ] }, ".kibana-event-log-7.10.0": { "alias": ".kibana-event-log-7.10.0", - "index": [ - ".kibana-event-log-7.10.0-000003", - ".kibana-event-log-7.10.0-000005", - ".kibana-event-log-7.10.0-000004", - ".kibana-event-log-7.10.0-000002" + "indexes": [ + { + "index": ".kibana-event-log-7.10.0-000006", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": true + }, + { + "index": ".kibana-event-log-7.10.0-000004", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + }, + { + "index": ".kibana-event-log-7.10.0-000003", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + }, + { + "index": ".kibana-event-log-7.10.0-000005", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + } ], - "write_index": ".kibana-event-log-7.10.0-000005" + "write_index": ".kibana-event-log-7.10.0-000006" }, ".kibana_task_manager": { "alias": ".kibana_task_manager", - "index": [ - ".kibana_task_manager_1" + "indexes": [ + { + "index": ".kibana_task_manager_1", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + } ] }, "custom": { "alias": "custom", - "index": [ - "test-custom" + "indexes": [ + { + "index": "test-custom", + "filter": { + "match": { + "name": "test" + } + }, + "index_routing": "1", + "search_routing": "1", + "is_hidden": false, + "is_write_index": false + }, + { + "index": "test-custom8", + "filter": { + "match": { + "name": "test" + } + }, + "index_routing": "1", + "search_routing": "1", + "is_hidden": false, + "is_write_index": false + } ] }, "ilm-history-3": { "alias": "ilm-history-3", - "index": [ - "ilm-history-3-000004", - "ilm-history-3-000005", - "ilm-history-3-000003", - "ilm-history-3-000002" + "indexes": [ + { + "index": "ilm-history-3-000004", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": true, + "is_write_index": false + }, + { + "index": "ilm-history-3-000006", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": true, + "is_write_index": true + }, + { + "index": "ilm-history-3-000003", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": true, + "is_write_index": false + }, + { + "index": "ilm-history-3-000005", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": true, + "is_write_index": false + } ], - "write_index": "ilm-history-3-000005" + "write_index": "ilm-history-3-000006" }, "metricbeat-7.10.0": { "alias": "metricbeat-7.10.0", - "index": [ - "metricbeat-7.10.0-2021.04.07-000003", - "metricbeat-7.10.0-2021.02.03-000001", - "metricbeat-7.10.0-2021.03.06-000002" + "indexes": [ + { + "index": "metricbeat-7.10.0-2021.04.07-000003", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": true + }, + { + "index": "metricbeat-7.10.0-2021.02.03-000001", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + }, + { + "index": "metricbeat-7.10.0-2021.03.06-000002", + "filter": null, + "index_routing": "", + "search_routing": "", + "is_hidden": false, + "is_write_index": false + } ], "write_index": "metricbeat-7.10.0-2021.04.07-000003" } }) }, 'POST /elasticsearch/:id/alias': function (req, res) { + //curl add example + // curl -X POST -d '{ "actions" : [{ "add": { "index" : "test-custom", "alias" : "custom" } }]}' + //curl delete example + // curl -X POST -d '{ "actions" : [{ "remove": { "index" : "test-custom", "alias" : "custom" } }]}' + res.send({ "acknowledged": true }) diff --git a/web/src/pages/SearchManage/alias/AliasManage.js b/web/src/pages/SearchManage/alias/AliasManage.js index 2940dddf..9577c649 100644 --- a/web/src/pages/SearchManage/alias/AliasManage.js +++ b/web/src/pages/SearchManage/alias/AliasManage.js @@ -10,9 +10,8 @@ import { Modal, message, Divider, + Table, AutoComplete, Switch, } from 'antd'; -import StandardTable from '@/components/StandardTable'; -import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import styles from '../../List/TableList.less'; @@ -56,7 +55,7 @@ const CreateForm = Form.create()(props => { }); const UpdateForm = Form.create()(props => { - const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form } = props; + const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form, indices } = props; const okHandle = () => { form.validateFields((err, fieldsValue) => { @@ -69,36 +68,67 @@ const UpdateForm = Form.create()(props => { return ( handleUpdateModalVisible()} > - - {form.getFieldDecorator('index', { - initialValue: values.index, - rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }], - })()} - - - {form.getFieldDecorator('settings', { - initialValue: values.processors, + + {form.getFieldDecorator('alias', { + initialValue: values.alias, rules: [{ required: true }], + })()} + + + {form.getFieldDecorator('index', { + initialValue: values.index, + rules: [{ required: true }], + })()} + + + {form.getFieldDecorator('is_write_index', { + valuePropName: 'checked', + initialValue: values.is_write_index, + rules: [], + })()} + + + {form.getFieldDecorator('filter', { + initialValue: values.filter? JSON.stringify(values.filter, '', 2):'', + rules: [{ }], })(