search template update

This commit is contained in:
shiyang 2021-04-14 01:08:15 +08:00 committed by medcl
parent e6be0c7534
commit 338d0bd4d9
2 changed files with 11 additions and 1 deletions

View File

@ -19,7 +19,10 @@ export default {
console.log("fetchList response:",res); console.log("fetchList response:",res);
if (res.hits) { if (res.hits) {
let newList = []; let newList = [];
let hits = res.hits.hits; let hits = res.hits.hits || [];
if (!hits.length) {
return;
}
for (let item of hits) { for (let item of hits) {
item._source.id = item._id; item._source.id = item._id;
newList.push(item._source); newList.push(item._source);

View File

@ -76,6 +76,12 @@ const UpdateForm = Form.create()(props => {
onOk={okHandle} onOk={okHandle}
onCancel={() => handleUpdateModalVisible()} onCancel={() => handleUpdateModalVisible()}
> >
<FormItem>
{form.getFieldDecorator('id', {
initialValue: values.id,
})(<Input type="hidden" />)}
</FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称"> <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称">
{form.getFieldDecorator('name', { {form.getFieldDecorator('name', {
initialValue: values.name, initialValue: values.name,
@ -278,6 +284,7 @@ class SearchTemplate extends PureComponent {
type: 'searchTemplate/update', type: 'searchTemplate/update',
payload: { payload: {
cluster_id: clusterID, cluster_id: clusterID,
id: fields.id,
name: fields.name, name: fields.name,
source: fields.source, source: fields.source,
}, },