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

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

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