Commit f65ec19f authored by kewei.jia's avatar kewei.jia

添加多个mysql服务后 查看详细信息报错,已修改

parent d4d47c7d
...@@ -60,9 +60,10 @@ router.post('/details', async (ctx) => { ...@@ -60,9 +60,10 @@ router.post('/details', async (ctx) => {
ctx.validate(ctx.Joi.object().keys({ ctx.validate(ctx.Joi.object().keys({
serviceName: ctx.Joi.string().required(), serviceName: ctx.Joi.string().required(),
namespace: ctx.Joi.string().required(), namespace: ctx.Joi.string().required(),
type: ctx.Joi.string().required(),
})) }))
const data = await getServiceDetail(ctx.request.body.namespace, ctx.request.body.serviceName) const data = await getServiceDetail(ctx.request.body.namespace, ctx.request.body.serviceName, ctx.request.body.type)
ctx.body = ctx.ok(data) ctx.body = ctx.ok(data)
}) })
......
...@@ -201,7 +201,7 @@ const getServicesFormat = async (namespace) => { ...@@ -201,7 +201,7 @@ const getServicesFormat = async (namespace) => {
return ret return ret
} }
const getServiceDetail = async (namespace, name) => { const getServiceDetail = async (namespace, name, type) => {
const res = await Promise.all([ const res = await Promise.all([
client.api.v1.namespaces(namespace).pods.get({ qs: { labelSelector: `qcloud-app=${name}` } }), client.api.v1.namespaces(namespace).pods.get({ qs: { labelSelector: `qcloud-app=${name}` } }),
client.api.v1.namespaces(namespace).services(name).get(), client.api.v1.namespaces(namespace).services(name).get(),
...@@ -210,7 +210,8 @@ const getServiceDetail = async (namespace, name) => { ...@@ -210,7 +210,8 @@ const getServiceDetail = async (namespace, name) => {
res[0] = formatPodInfo(res[0].body.items[0]) res[0] = formatPodInfo(res[0].body.items[0])
res[1] = formatServiceInfo(res[1].body) res[1] = formatServiceInfo(res[1].body)
if (!dict.commonService.includes(name)) { // if (!dict.commonService.includes(name)) {
if (type !== 'base') {
res[2] = await client.apis.extensions.v1beta1.namespaces(namespace).ingresses(name).get() res[2] = await client.apis.extensions.v1beta1.namespaces(namespace).ingresses(name).get()
res[2] = formatIngressInfo(res[2].body) res[2] = formatIngressInfo(res[2].body)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment