Commit 5f16b751 authored by 薛智杰's avatar 薛智杰

Merge branch 'image' into 'master'

修复服务更新失败



See merge request !18
parents e72745ef 1efe9329
......@@ -115,7 +115,7 @@
</template>
</el-table-column>
<el-table-column
label="调试状态">
label="调试">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="控制台" placement="top">
<el-button type="primary" icon="el-icon-tickets" circle @click="linkShell(scope.row)"/>
......@@ -148,7 +148,7 @@
<svg-icon icon-class="restart"/>
重置服务
</el-dropdown-item>
<el-dropdown-item style="color: red" @click.native="deleteService(scope.row) ">
<el-dropdown-item style="color: red" @click.native="deleteService(scope.row, item) ">
<svg-icon icon-class="delete"/>
删除服务
</el-dropdown-item>
......@@ -194,13 +194,13 @@
v-for="(item,index) in tagOptions"
:key="index"
:label="item.tagName"
:value="item.tagName"/>
:value="item.repo_name + ':' +item.tagName"/>
</el-select>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="CreateClusterService">确 定</el-button>
<el-button type="primary" @click="createClusterService">确 定</el-button>
</span>
</el-dialog>
<!--更新服务的弹框-->
......@@ -217,7 +217,7 @@
<el-row :gutter="20">
<el-col :span="14">
<el-input
v-model="rename"
v-model="serviceName"
:disabled="true"
placeholder="请输入内容"/>
</el-col>
......@@ -230,7 +230,7 @@
v-for="(item,index) in tagOptions"
:key="index"
:label="item.tagName"
:value="item.tagName"/>
:value="item.repo_name + ':' +item.tagName"/>
</el-select>
</el-col>
</el-row>
......@@ -313,7 +313,7 @@ export default {
region: ''
},
updateDialog: false,
rename: '',
serviceName: '',
form: {
host: ''
},
......@@ -360,29 +360,27 @@ export default {
},
getTag() {
getHostName({ project_name: this.reponame.split('/')[1] }).then(res => {
if (res.data.data) {
this.domain = res.data.data.host_name
if (res.data) {
this.domain = res.data.host_name
}
})
fetchTaglist({ reponame: this.reponame }).then(res => {
return fetchTaglist({ reponame: this.reponame })
}).then(res => {
if (res.data.tagCount) {
this.tagOptions = res.data.tagInfo
}
})
},
CreateClusterService() {
createClusterService() {
const self = this
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,
image: this.tagName,
label: this.label,
type: this.type,
domain: this.domain.split('.')[0]
}).then(res => {
if (res.data.code === '0000') {
this.$message({
message: res.data,
type: 'success',
......@@ -392,12 +390,6 @@ export default {
self.getServicelist()
}
})
} else {
this.$message({
message: res.data.msg,
type: 'error'
})
}
})
},
handleDetail(data) {
......@@ -426,9 +418,6 @@ export default {
})
this.dialogHost = false
})
} else {
console.log('error submit!!')
return false
}
})
},
......@@ -439,9 +428,9 @@ export default {
updateService(value) {
this.tagName = ''
this.updateDialog = true
this.rename = value.serviceName
this.serviceName = value.serviceName
this.tagOptions = []
fetchTaglist({ reponame: 'qa-' + value.userLabels.type + '/' + this.rename }).then(res => {
fetchTaglist({ reponame: 'qa-' + value.userLabels.type + '/' + this.serviceName }).then(res => {
if (res.data.tagCount) {
this.tagOptions = res.data.tagInfo
this.server = res.data.server
......@@ -449,10 +438,8 @@ export default {
})
},
updateClusterService() {
const image = `${this.server}/${this.rename}:${this.tagName}`
const self = this
modifyCluService({ serviceName: this.rename, image: image, namespace: this.namespace }).then(res => {
if (res.data.code === '0000') {
modifyCluService({ serviceName: this.serviceName, image: this.tagName, namespace: this.namespace }).then(res => {
this.$message({
message: '更新成功',
type: 'success',
......@@ -462,27 +449,14 @@ export default {
self.getServicelist()
}
})
} else {
this.$message({
message: res.data.msg,
type: 'error'
})
}
})
},
restartService(data) {
redeployClusterService({ namespace: data.namespace, serviceName: data.serviceName }).then(res => {
if (res.data.code === '0000') {
this.$message({
type: 'success',
message: '服务重部署成功!'
})
} else {
this.$message({
type: 'error',
message: res.data.msg
})
}
})
},
syncDb() {
......@@ -510,30 +484,23 @@ export default {
this.form.host = res.data.body.spec.rules[0].host
})
},
deleteService(data) {
this.$confirm('此操作将永久此服务, 是否继续?', '提示', {
deleteService(data, item) {
this.$confirm(
'此操作将删除服务, 是否继续?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteClusterService({ serviceName: data.serviceName, namespace: data.namespace }).then((res) => {
if (res.data.code === '0000') {
}
).then(() => {
deleteClusterService({ serviceName: data.serviceName, namespace: data.namespace, type: data.userLabels.type })
.then((res) => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.getServicelist()
} else {
this.$message({
type: 'error',
message: res.data.msg
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
......
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