enable cluster mock, fix less compile issue

This commit is contained in:
medcl 2021-02-21 08:50:15 +08:00
parent 31509eab09
commit 2c877b4de9
2 changed files with 112 additions and 81 deletions

View File

@ -67,13 +67,13 @@ export default {
// pathRewrite: { '^/server': '' }, // pathRewrite: { '^/server': '' },
// }, // },
// }, // },
proxy: { // proxy: {
'/_search-center/': { // '/_search-center/': {
target: 'http://localhost:9000', // target: 'http://localhost:9000',
changeOrigin: true, // changeOrigin: true,
// pathRewrite: { '^/server': '' }, // // pathRewrite: { '^/server': '' },
}, // },
}, // },
ignoreMomentLocale: true, ignoreMomentLocale: true,
lessLoaderOptions: { lessLoaderOptions: {
javascriptEnabled: true, javascriptEnabled: true,
@ -102,7 +102,7 @@ export default {
}, },
}, },
chainWebpack: webpackPlugin, // chainWebpack: webpackPlugin,
cssnano: { cssnano: {
mergeRules: false, mergeRules: false,
}, },

View File

@ -1,75 +1,106 @@
export default { export default {
// 'post /_search-center/system/cluster/_search': function(req, res){ 'GET /_search-center/system/cluster/_search': function(req, res){
// res.send({ res.send({
// "took": 0, "took": 0,
// "timed_out": false, "timed_out": false,
// "hits": { "hits": {
// "total": { "total": {
// "relation": "eq", "relation": "eq",
// "value": 1 "value": 1
// }, },
// "max_score": 1, "max_score": 1,
// "hits": [ "hits": [
// { {
// "_index": ".infini-search-center_cluster", "_index": ".infini-search-center_cluster",
// "_type": "_doc", "_type": "_doc",
// "_id": "c0oc4kkgq9s8qss2uk50", "_id": "c0oc4kkgq9s8qss2uk50",
// "_source": { "_source": {
// "basic_auth": { "basic_auth": {
// "password": "123", "password": "123",
// "username": "medcl" "username": "medcl"
// }, },
// "created": "2021-02-20T16:03:30.867084+08:00", "created": "2021-02-20T16:03:30.867084+08:00",
// "description": "xx业务集群1", "description": "xx业务集群1",
// "enabled": false, "enabled": false,
// "endpoint": "http://localhost:9200", "endpoint": "http://localhost:9200",
// "name": "cluster1", "name": "cluster1",
// "updated": "2021-02-20T16:03:30.867084+08:00" "updated": "2021-02-20T16:03:30.867084+08:00"
// } }
// } }
// ] ]
// } }
// }) })
// }, },
// 'post /_search-center/system/cluster': function(req, res){ 'POST /_search-center/system/cluster/_search': function(req, res){
// res.send({ res.send({
// "_id": "c0obhd4gq9s7akom0o60", "took": 0,
// "_source": { "timed_out": false,
// "name": "cluster1", "hits": {
// "endpoint": "http://localhost:9200", "total": {
// "basic_auth": { "relation": "eq",
// "username": "medcl", "value": 1
// "password": "123" },
// }, "max_score": 1,
// "description": "xx业务集群1", "hits": [
// "enabled": false, {
// "created": "2021-02-20T15:12:50.984062+08:00", "_index": ".infini-search-center_cluster",
// "updated": "2021-02-20T15:12:50.984062+08:00" "_type": "_doc",
// }, "_id": "c0oc4kkgq9s8qss2uk50",
// "result": "created" "_source": {
// }); "basic_auth": {
// }, "password": "123",
// 'put /_search-center/system/cluster/:id': function(req, res){ "username": "medcl"
// res.send({ },
// "_id": "c0obhd4gq9s7akom0o60", "created": "2021-02-20T16:03:30.867084+08:00",
// "_source": { "description": "xx业务集群1",
// "basic_auth": { "enabled": false,
// "password": "456", "endpoint": "http://localhost:9200",
// "username": "medcl" "name": "cluster1",
// }, "updated": "2021-02-20T16:03:30.867084+08:00"
// "description": "xx业务集群2", }
// "endpoint": "http://localhost:9201", }
// "name": "cluster2", ]
// "updated": "2021-02-20T15:25:12.159789+08:00" }
// }, })
// "result": "updated" },
// }); 'POST /_search-center/system/cluster': function(req, res){
// }, res.send({
// "_id": "c0obhd4gq9s7akom0o60",
// 'delete /_search-center/system/cluster/:id': function(req, res){ "_source": {
// res.send({ "name": "cluster1",
// "_id": "c0obk7cgq9s7hi05aou0", "endpoint": "http://localhost:9200",
// "result": "deleted" "basic_auth": {
// }); "username": "medcl",
// } "password": "123"
},
"description": "xx业务集群1",
"enabled": false,
"created": "2021-02-20T15:12:50.984062+08:00",
"updated": "2021-02-20T15:12:50.984062+08:00"
},
"result": "created"
});
},
'PUT /_search-center/system/cluster/:id': function(req, res){
res.send({
"_id": "c0obhd4gq9s7akom0o60",
"_source": {
"basic_auth": {
"password": "456",
"username": "medcl"
},
"description": "xx业务集群2",
"endpoint": "http://localhost:9201",
"name": "cluster2",
"updated": "2021-02-20T15:25:12.159789+08:00"
},
"result": "updated"
});
},
'DELETE /_search-center/system/cluster/:id': function(req, res){
res.send({
"_id": "c0obk7cgq9s7hi05aou0",
"result": "deleted"
});
}
} }