diff --git a/web/config/config.js b/web/config/config.js index 08b140ea..e28c8c52 100644 --- a/web/config/config.js +++ b/web/config/config.js @@ -67,13 +67,13 @@ export default { // pathRewrite: { '^/server': '' }, // }, // }, - proxy: { - '/_search-center/': { - target: 'http://localhost:9000', - changeOrigin: true, - // pathRewrite: { '^/server': '' }, - }, - }, + // proxy: { + // '/_search-center/': { + // target: 'http://localhost:9000', + // changeOrigin: true, + // // pathRewrite: { '^/server': '' }, + // }, + // }, ignoreMomentLocale: true, lessLoaderOptions: { javascriptEnabled: true, @@ -102,7 +102,7 @@ export default { }, }, - chainWebpack: webpackPlugin, + // chainWebpack: webpackPlugin, cssnano: { mergeRules: false, }, diff --git a/web/mock/system/cluster.js b/web/mock/system/cluster.js index c6677b8b..40619968 100644 --- a/web/mock/system/cluster.js +++ b/web/mock/system/cluster.js @@ -1,75 +1,106 @@ export default { - // 'post /_search-center/system/cluster/_search': function(req, res){ - // res.send({ - // "took": 0, - // "timed_out": false, - // "hits": { - // "total": { - // "relation": "eq", - // "value": 1 - // }, - // "max_score": 1, - // "hits": [ - // { - // "_index": ".infini-search-center_cluster", - // "_type": "_doc", - // "_id": "c0oc4kkgq9s8qss2uk50", - // "_source": { - // "basic_auth": { - // "password": "123", - // "username": "medcl" - // }, - // "created": "2021-02-20T16:03:30.867084+08:00", - // "description": "xx业务集群1", - // "enabled": false, - // "endpoint": "http://localhost:9200", - // "name": "cluster1", - // "updated": "2021-02-20T16:03:30.867084+08:00" - // } - // } - // ] - // } - // }) - // }, - // 'post /_search-center/system/cluster': function(req, res){ - // res.send({ - // "_id": "c0obhd4gq9s7akom0o60", - // "_source": { - // "name": "cluster1", - // "endpoint": "http://localhost:9200", - // "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" - // }); - // } + 'GET /_search-center/system/cluster/_search': function(req, res){ + res.send({ + "took": 0, + "timed_out": false, + "hits": { + "total": { + "relation": "eq", + "value": 1 + }, + "max_score": 1, + "hits": [ + { + "_index": ".infini-search-center_cluster", + "_type": "_doc", + "_id": "c0oc4kkgq9s8qss2uk50", + "_source": { + "basic_auth": { + "password": "123", + "username": "medcl" + }, + "created": "2021-02-20T16:03:30.867084+08:00", + "description": "xx业务集群1", + "enabled": false, + "endpoint": "http://localhost:9200", + "name": "cluster1", + "updated": "2021-02-20T16:03:30.867084+08:00" + } + } + ] + } + }) + }, + 'POST /_search-center/system/cluster/_search': function(req, res){ + res.send({ + "took": 0, + "timed_out": false, + "hits": { + "total": { + "relation": "eq", + "value": 1 + }, + "max_score": 1, + "hits": [ + { + "_index": ".infini-search-center_cluster", + "_type": "_doc", + "_id": "c0oc4kkgq9s8qss2uk50", + "_source": { + "basic_auth": { + "password": "123", + "username": "medcl" + }, + "created": "2021-02-20T16:03:30.867084+08:00", + "description": "xx业务集群1", + "enabled": false, + "endpoint": "http://localhost:9200", + "name": "cluster1", + "updated": "2021-02-20T16:03:30.867084+08:00" + } + } + ] + } + }) + }, + 'POST /_search-center/system/cluster': function(req, res){ + res.send({ + "_id": "c0obhd4gq9s7akom0o60", + "_source": { + "name": "cluster1", + "endpoint": "http://localhost:9200", + "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" + }); + } } \ No newline at end of file