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

Merge branch 'image' into 'master'

修复服务更新失败



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