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

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

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