Commit 4e40346b authored by 智勇's avatar 智勇

服务详情页面请求的接口更新为原生api

parent 520365cc
...@@ -47,10 +47,15 @@ export function formatStatus(tsatus) { ...@@ -47,10 +47,15 @@ export function formatStatus(tsatus) {
return '正常' return '正常'
case 'Abnormal' : case 'Abnormal' :
return '服务启动中' return '服务启动中'
case 'Pending':
case 'Waiting' : case 'Waiting' :
return '服务等待中' return '服务等待中'
case 'Paused' : case 'Paused' :
return '更新暂停中' return '更新暂停中'
case 'PodScheduling':
return 'Pod调度中'
case 'Initializing':
return '初始化中'
case 'Updating' : case 'Updating' :
return '服务更新中' return '服务更新中'
case 'RollingBack' : case 'RollingBack' :
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
label="服务端口" label="服务端口"
width="300px"> width="300px">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-for="item in scope.row.portMappings" :key="item.containerPort" class="port">{{ item.nodePort }} -> {{ item.containerPort }}</span> <span v-for="item in scope.row.portMappings" :key="item.port" class="port">{{ item.nodePort }} -> {{ item.port }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createdAt" prop="createdAt"
width="100" width="180"
label="创建时间" label="创建时间"
/> />
<el-table-column <el-table-column
...@@ -298,7 +298,7 @@ import { ...@@ -298,7 +298,7 @@ import {
CreateCluService, CreateCluService,
fetchServiceDetails, fetchServiceDetails,
modifyCluService, modifyCluService,
fetchServiceInstance, // fetchServiceInstance,
deleteClusterService, deleteClusterService,
redeployClusterService, redeployClusterService,
flushRedis, flushRedis,
...@@ -423,15 +423,17 @@ export default { ...@@ -423,15 +423,17 @@ export default {
}) })
}, },
handleDetail(data) { handleDetail(data) {
ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => { window.open(`http://${data.host}/`, '_blank')
const url = res.data.body.spec.rules[0].host
window.open(`http://${url}/`, '_blank') // ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => {
}) // const url = res.data.body.spec.rules[0].host
// window.open(`http://${url}/`, '_blank')
// })
}, },
getServiceDetails(value) { getServiceDetails(value) {
fetchServiceDetails({ serviceName: value.serviceName, namespace: value.namespace }).then(res => { fetchServiceDetails({ serviceName: value.serviceName, namespace: this.namespace }).then(res => {
this.centerDialogVisible = true this.centerDialogVisible = true
this.value = res.data.service this.value = res.data
}) })
}, },
submitHost(formName) { submitHost(formName) {
...@@ -459,8 +461,9 @@ export default { ...@@ -459,8 +461,9 @@ export default {
this.tagName = '' this.tagName = ''
this.updateDialog = true this.updateDialog = true
this.serviceName = value.serviceName this.serviceName = value.serviceName
this.type = value.labels.type
this.tagOptions = [] this.tagOptions = []
fetchTaglist({ reponame: 'qa-' + value.userLabels.type + '/' + this.serviceName }).then(res => { fetchTaglist({ reponame: 'qa-' + value.labels.type + '/' + this.serviceName }).then(res => {
if (res.data.tagCount) { if (res.data.tagCount) {
this.tagOptions = res.data.tagInfo this.tagOptions = res.data.tagInfo
this.server = res.data.server this.server = res.data.server
...@@ -469,7 +472,7 @@ export default { ...@@ -469,7 +472,7 @@ export default {
}, },
updateClusterService() { updateClusterService() {
const self = this const self = this
modifyCluService({ serviceName: this.serviceName, image: this.tagName, namespace: this.namespace }).then(res => { modifyCluService({ serviceName: this.serviceName, image: this.tagName, namespace: this.namespace, type: this.type }).then(res => {
this.$message({ this.$message({
message: '更新成功', message: '更新成功',
type: 'success', type: 'success',
...@@ -482,7 +485,7 @@ export default { ...@@ -482,7 +485,7 @@ export default {
}) })
}, },
restartService(data) { restartService(data) {
redeployClusterService({ namespace: data.namespace, serviceName: data.serviceName }).then(res => { redeployClusterService({ namespace: this.namespace, podName: data.podName }).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '服务重部署成功!' message: '服务重部署成功!'
...@@ -512,7 +515,7 @@ export default { ...@@ -512,7 +515,7 @@ export default {
this.dialogHost = true this.dialogHost = true
this.form.host = '' this.form.host = ''
this.ingressName = data.serviceName this.ingressName = data.serviceName
ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => { ingressHost({ namespace: this.namespace, serviceName: data.serviceName }).then(res => {
this.form.host = res.data.body.spec.rules[0].host this.form.host = res.data.body.spec.rules[0].host
}) })
}, },
...@@ -526,7 +529,7 @@ export default { ...@@ -526,7 +529,7 @@ export default {
type: 'warning' type: 'warning'
} }
).then(() => { ).then(() => {
deleteClusterService({ serviceName: data.serviceName, namespace: data.namespace, type: data.userLabels.type }) deleteClusterService({ namespace: this.namespace, serviceName: data.serviceName, podName: data.podName })
.then((res) => { .then((res) => {
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -538,24 +541,26 @@ export default { ...@@ -538,24 +541,26 @@ export default {
}) })
}) })
}, },
linkShell(scopeData) { linkShell(scopeData) {
fetchServiceInstance({ serviceName: scopeData.serviceName, namespace: scopeData.namespace }).then(res => { window.open(`http://172.30.220.24:9600/static/terminal.html?namespace=${this.namespace}&pod=${scopeData.podName}`, '_blank')
const podName = res.data.instances[0].name
window.open(`http://172.30.220.24:9600/static/terminal.html?namespace=${scopeData.namespace}&pod=${podName}`, '_blank') // fetchServiceInstance({ serviceName: scopeData.serviceName, namespace: scopeData.namespace }).then(res => {
}) // const podName = res.data.instances[0].name
// window.open(`http://172.30.220.24:9600/static/terminal.html?namespace=${scopeData.namespace}&pod=${podName}`, '_blank')
// })
}, },
linkLog(scopeData) { linkLog(scopeData) {
let path = '' let path = ''
if (scopeData.userLabels.type === 'ui') { if (scopeData.labels.type === 'ui') {
path = '/usr/local/openresty/nginx/logs/access.log /usr/local/openresty/nginx/logs/error.log' path = '/usr/local/openresty/nginx/logs/access.log /usr/local/openresty/nginx/logs/error.log'
} else { } else {
path = `/home/quant_group/logs/${scopeData.serviceName}.log` path = `/home/quant_group/logs/${scopeData.serviceName}.log`
} }
fetchServiceInstance({ serviceName: scopeData.serviceName, namespace: scopeData.namespace }).then(res => { window.open(`http://172.30.220.24:9600/static/logs.html?namespace=${this.namespace}&pod=${scopeData.podName}&paths=${path}`, '_blank')
const podName = res.data.instances[0].name
window.open(`http://172.30.220.24:9600/static/logs.html?namespace=${scopeData.namespace}&pod=${podName}&paths=${path}`, '_blank')
})
}, },
array2Object(original) { // 将数组转成对象存储 array2Object(original) { // 将数组转成对象存储
this.FormatTabledata = {} this.FormatTabledata = {}
original.forEach((item, index) => { original.forEach((item, index) => {
......
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