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

添加域名 删除基础服务点击功能 去掉 console

parent 6095a29e
......@@ -23,3 +23,10 @@ export function deleteProject(query) {
params: query
})
}
export function getHostName(query) {
return request({
url: '/proconfig/getHostName',
method: 'get',
params: query
})
}
......@@ -31,11 +31,7 @@
<el-table-column
prop="serviceName"
label="服务名"
>
<template slot-scope="scope">
<span class="link-type" @click="handleDetail(scope.row)">{{ scope.row.serviceName }}</span>
</template>
</el-table-column>
/>
<el-table-column
prop="createdAt"
label="日期"
......@@ -65,7 +61,7 @@
<svg-icon icon-class="service"/>
{{ item._id }}服务
<div style="float: right">
<el-button type="warning" size="mini" round @click="getRepository(item._id,item)">新增服务</el-button>
<el-button type="warning" size="mini" round @click="getRepository(item._id)">新增服务</el-button>
<el-button type="warning" size="mini" round @click="refresh">刷新状态</el-button>
</div>
</div>
......@@ -262,6 +258,8 @@ import {
} from '@/api/docker'
import JsonEditor from '@/components/JsonEditor'
import { getHostName } from '@/api/proconfig'
export default {
components: { JsonEditor },
data() {
......@@ -277,6 +275,8 @@ export default {
typeList: [],
tagName: '',
server: '',
lable: '',
domain: '',
type: '',
value: null,
images: null,
......@@ -321,20 +321,24 @@ export default {
type: 'success'
})
},
getRepository(type, item) {
this.type = type
getRepository(label) {
this.label = label
this.reponame = ''
this.tagName = ''
this.options = []
this.tagOptions = []
fetchUserrepository({ 'namespace': 'qa-' + type }).then(res => {
fetchUserrepository({ 'namespace': 'qa-' + label }).then(res => {
this.options = res.data.data.repoInfo
this.server = res.data.data.server
})
// fetchHost({ system_name: 'xjd-ui', namespace: this.namespace }).then(res => { console.log(res) })
this.dialogVisible = true
},
getTag() {
getHostName({ project_name: this.reponame.split('/')[1] }).then(res => {
if (res.data.data) {
this.domain = res.data.data.host_name
}
})
fetchTaglist({ reponame: this.reponame }).then(res => {
if (res.data.data.tagCount) {
this.tagOptions = res.data.data.tagInfo
......@@ -343,12 +347,15 @@ export default {
},
CreateClusterService() {
const self = this
const image = `${this.server}/${this.reponame}:${this.tagName}`
const image = `${this.reponame}:${this.tagName}`
this.type = this.label === 'base' ? this.reponame.split('/')[1] : this.label
CreateCluService({
serviceName: this.reponame.split('/')[1],
namespace: this.namespace,
image: image,
type: this.type
label: this.label,
type: this.type,
domain: this.domain.split('.')[0]
}).then(res => {
if (res.data.code === '0000') {
this.$message({
......@@ -370,7 +377,6 @@ export default {
},
handleDetail(data) {
ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => {
// console.log(res.data.data.body.spec.rules[0].host)
const url = res.data.data.body.spec.rules[0].host
window.open(`http://${url}/`, '_blank')
})
......@@ -476,7 +482,6 @@ export default {
this.form.host = ''
this.ingressName = data.serviceName
ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => {
// console.log(res.data.data.body.spec.rules[0].host)
this.form.host = res.data.data.body.spec.rules[0].host
})
},
......
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