Commit 2cb6d6a4 authored by 黎博's avatar 黎博

update

parent 142ffbcc
......@@ -63,10 +63,10 @@ export function serviceRedeploy(data) {
})
}
// 更新部署
export function serviceModify(data) {
// 更新服务
export function serviceUpdate(data) {
return request({
url: '/k8s/service/modify',
url: '/k8s/service/update',
method: 'post',
data
})
......
......@@ -222,7 +222,7 @@
<el-row :gutter="20">
<el-col :span="14">
<el-select v-model="reponame" clearable filterable class="elSelect" placeholder="请选择服务,支持模糊搜索" @change="getTag">
<el-option v-for="(item,index) in options" :key="index" :label="item.RepoName.split('/')[1]" :value="item.RepoName" />
<el-option v-for="(item,index) in options" :key="index" :label="item.repoName.split('/')[1]" :value="item.repoName" />
</el-select>
</el-col>
</el-row>
......@@ -316,7 +316,7 @@ import {
getDockerProjectDetail,
getServiceDetail,
serviceRedeploy,
serviceModify,
serviceUpdate,
serviceDelete,
getDockerProjectType
} from '@/api/k8s'
......@@ -349,9 +349,10 @@ export default {
tagOptions: [],
tagName: '',
detailValue: {},
mysqlName: '',
// 当前选中的项目名
serviceName: '',
mysqlName: ''
updateServiceParams: {}
}
},
created() {
......@@ -399,7 +400,7 @@ export default {
this.debug = { key: 0, display_name: '' }
this.mock = { key: 0, display_name: '' }
getSingleTypeApp({ namespace: 'qa-' + label }).then((resp) => {
getSingleTypeApp({ namespace: 'qa-test', type: label }).then((resp) => {
this.options = resp.data.data.RepoInfo
})
this.dialogVisible = true
......@@ -440,16 +441,34 @@ export default {
formdata.set('podName', service.podName)
serviceRedeploy(formdata).then((resp) => {
if (resp.data.data === true) {
this.getServiceList()
return this.$message.success('重置成功!')
} else {
this.getServiceList()
return this.$message.error('重置失败!')
}
})
},
// 打开更新服务对话框
openUpdateServiceDialog(service) {
console.log(service)
this.updateDialogVisible = true
this.serviceName = service.serviceName
this.updateServiceParams = {}
this.updateServiceParams['namespace'] = this.namespace
this.updateServiceParams['serviceName'] = service.serviceName
this.updateServiceParams['type'] = service.labels.type
this.updateServiceParams['label'] = service.labels.type
this.updateServiceParams['debug'] =
service.serviceType === 'NodePort' ? 1 : 0
this.updateServiceParams['mock'] = service.labels.mock
// 获取domain
getDockerProjectDetail({ projectName: service.serviceName }).then(
(resp) => {
this.updateServiceParams['domain'] =
resp.data.data.hostName.split('.')[0]
}
)
// 获取镜像列表
getImageList({
repoName: 'qa-test/' + service.serviceName
......@@ -457,6 +476,7 @@ export default {
if (resp.data.data.TagCount > 0) {
this.tagOptions = resp.data.data.TagInfo
this.reponame = resp.data.data.RepoName
// 默认选中第一个
this.tagName = resp.data.data.TagInfo[0].TagName
this.server = resp.data.data.Server
}
......@@ -464,15 +484,14 @@ export default {
},
// 调用接口更新服务
updateService() {
var formdata = new FormData()
formdata.set('namespace', this.namespace)
formdata.set('serviceName', this.serviceName)
formdata.set('image', this.tagName)
serviceModify(formdata).then((resp) => {
if (resp.data.data) {
this.updateDialogVisible = false
this.updateServiceParams['image'] = 'qa-test/' + this.serviceName + ':' + this.tagName
serviceUpdate(this.updateServiceParams).then((resp) => {
if (resp.data.data === true) {
this.getServiceList()
this.updateDialogVisible = false
return this.$message.success('更新成功!')
} else {
return this.$message.error('更新失败!')
}
})
},
......@@ -521,6 +540,7 @@ export default {
}
})
},
refreshInterval(value) {},
linkShell(scopeData) {
window.open(
`http://172.30.220.24:9600/static/terminal.html?namespace=${this.namespace}&pod=${scopeData.podName}`,
......@@ -530,8 +550,6 @@ export default {
linkKibana(scopeData) {
const sn = scopeData.serviceName
const ns = this.namespace
console.log('sn: ' + sn)
console.log('ns: ' + ns)
// const url = `http://kibana-new.quantgroups.com/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!f,value:5000),time:(from:now-2m,to:now))&_a=(columns:!(message),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:c7d3a2f0-b760-11e9-a937-01944fbd6d1d,key:k8s.namespace,negate:!f,params:(query:${ns}),type:phrase,value:${ns}),query:(match:(k8s.namespace:(query:${ns},type:phrase)))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:c7d3a2f0-b760-11e9-a937-01944fbd6d1d,key:k8s.svcname,negate:!f,params:(query:${sn}),type:phrase,value:${sn}),query:(match:(k8s.svcname:(query:${sn},type:phrase))))),index:c7d3a2f0-b760-11e9-a937-01944fbd6d1d,interval:auto,query:(language:kuery,query:''),sort:!(logtime,desc))`
const url = `http://kibana.liangkebang.com/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:5000),time:(from:now-15m,to:now))&_a=(columns:!(message),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'64887440-a955-11ea-8847-cfc3eef68da1',key:k8s.namespace,negate:!f,params:(query:${ns}),type:phrase,value:${ns}),query:(match:(k8s.namespace:(query:${ns},type:phrase)))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'64887440-a955-11ea-8847-cfc3eef68da1',key:k8s.svcname,negate:!f,params:(query:${sn}),type:phrase,value:${sn}),query:(match:(k8s.svcname:(query:${sn},type:phrase))))),index:'64887440-a955-11ea-8847-cfc3eef68da1',interval:auto,query:(language:kuery,query:''),sort:!(logtime,desc))`
window.open(`${url}`, '_blank')
......
......@@ -17,7 +17,7 @@
<div class="right">
<!-- <el-tag>当前环境:{{ env }}</el-tag> -->
<el-select v-model="env" @change="envChange" placeholder="请选择环境" style="width:90px">
<el-option v-for="item in envList" :key="item.key" :label="item.desc" :value="item.key">
<el-option v-for="item in envList" :key="item.name" :label="item.name" :value="item.name">
</el-option>
</el-select>
<el-dropdown>
......@@ -33,7 +33,8 @@
</template>
<script>
import { getNamespaceList } from '@/api/getXyqbData/'
// import { getNamespaceList } from '@/api/getXyqbData/'
import { getNamespaceList } from '@/api/k8s'
import Crumbs from './Crumbs'
import { mapGetters } from 'vuex'
import { logout } from '@/api/Login/'
......@@ -62,7 +63,7 @@ export default {
}
},
getEnvList() {
getNamespaceList().then((resp) => {
getNamespaceList({env: 'all'}).then((resp) => {
this.envList = resp.data.data
})
},
......
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