fix mock for cluster

This commit is contained in:
medcl 2021-02-21 10:54:45 +08:00
parent ed1fce4c1b
commit 553d65319a
5 changed files with 13 additions and 11 deletions

View File

@ -12,7 +12,7 @@ type ClusterConfig struct {
} `json:"basic_auth,omitempty" elastic_mapping:"basic_auth:{type:object}"`
Order int `json:"order,omitempty" elastic_mapping:"order:{type:integer}"`
Description string `json:"description,omitempty" elastic_mapping:"description:{type:text}"`
Enabled bool `json:"enabled,omitempty" elastic_mapping:"enabled:{type:boolean}"`
Enabled bool `json:"enabled" elastic_mapping:"enabled:{type:boolean}"`
Created time.Time `json:"created,omitempty" elastic_mapping:"created:{type:date}"`
Updated time.Time `json:"updated,omitempty" elastic_mapping:"updated:{type:date}"`
}

View File

@ -65,7 +65,7 @@ export default {
},
'POST /_search-center/system/cluster': function(req, res){
res.send({
"_id": "c0obhd4gq9s7akom0o60",
"_id": "c0oc4kkgq9s8qss2uk50",
"_source": {
"name": "cluster1",
"endpoint": "http://localhost:9200",
@ -83,7 +83,7 @@ export default {
},
'PUT /_search-center/system/cluster/:id': function(req, res){
res.send({
"_id": "c0obhd4gq9s7akom0o60",
"_id": "c0oc4kkgq9s8qss2uk50",
"_source": {
"basic_auth": {
"password": "456",
@ -92,6 +92,7 @@ export default {
"description": "xx业务集群2",
"endpoint": "http://localhost:9201",
"name": "cluster2",
"enabled": true,
"updated": "2021-02-20T15:25:12.159789+08:00"
},
"result": "updated"
@ -99,7 +100,7 @@ export default {
},
'DELETE /_search-center/system/cluster/:id': function(req, res){
res.send({
"_id": "c0obk7cgq9s7hi05aou0",
"_id": "c0oc4kkgq9s8qss2uk50",
"result": "deleted"
});
}

View File

@ -159,14 +159,14 @@ class ClusterForm extends React.Component{
/>
</Form.Item>
{this.state.needAuth === true ? (<div>
<Form.Item label="ES 用户名">
<Form.Item label="用户名">
{getFieldDecorator('username', {
initialValue: editValue.basic_auth.username,
rules: [
],
})(<Input autoComplete='off' />)}
</Form.Item>
<Form.Item label="ES 密码" hasFeedback>
<Form.Item label="密码" hasFeedback>
{getFieldDecorator('password', {
initialValue: editValue.basic_auth.password,
rules: [

View File

@ -21,7 +21,7 @@ class Index extends React.Component {
dataIndex: 'basic_auth',
key: 'username',
render: (val) => {
console.log(val)
//console.log(val)
return (val && typeof val.username !=='undefined' && val.username !== '')? '是': '否';
}
},{

View File

@ -61,6 +61,7 @@ export default {
let idx = data.findIndex((item)=>{
return item.id === res._id;
});
let originalEnabled = data[idx].enabled;
data[idx] = {
...data[idx],