Commit b6817737 authored by 智勇's avatar 智勇

获取cluster

parent 6ddbb1b4
......@@ -64,6 +64,14 @@ export function getGroup(query) {
})
}
export function getCluster(query) {
return request({
url: '/k8s/cluster',
method: 'get',
params: query
})
}
export function fetchKubernetesList() {
return request({
url: '/k8s/namespace',
......
......@@ -765,7 +765,13 @@ export default {
},
linkShell(scopeData) {
window.open(`http://172.30.220.24:9600/static/terminal.html?namespace=${this.namespace}&pod=${scopeData.podName}`, '_blank')
if (this.$store.getters.cluster === 'qa') {
window.open(`http://172.30.220.24:9600/static/terminal.html?namespace=${this.namespace}&pod=${scopeData.podName}`, '_blank')
}
if (this.$store.getters.cluster === 'qke') {
window.open(`http://172.30.220.24:9601/static/terminal.html?namespace=${this.namespace}&pod=${scopeData.podName}`, '_blank')
}
// fetchServiceInstance({ serviceName: scopeData.serviceName, namespace: scopeData.namespace }).then(res => {
// const podName = res.data.instances[0].name
......
......@@ -5,8 +5,7 @@
<svg-icon icon-class="list"/>
运行环境列表
<el-select v-model="cluster" placeholder="请选择集群名称" @change="changeCluster">
<el-option label="qa" value="qa"/>
<el-option label="dev-ops" value="dev-ops"/>
<el-option v-for="item in clusterArray" :value="item" :label="item" :key="item" />
</el-select>
</p>
<el-table
......@@ -52,18 +51,20 @@
</div>
</template>
<script>
import { fetchKubernetesList } from '@/api/docker'
import { fetchKubernetesList, getCluster } from '@/api/docker'
export default {
data() {
return {
name: 'hello',
tableData: [],
clusterArray: [],
cluster: this.$store.getters.cluster
}
},
created() {
this.fetchK8sList()
this.getCluster()
},
methods: {
syncMySQL(namespace) {
......@@ -92,6 +93,13 @@ export default {
this.tableData = res.data.namespaces
})
},
getCluster() {
getCluster().then(res => {
this.clusterArray = res.data
})
},
indexMethod(index) {
return index + 1
},
......
......@@ -5,8 +5,7 @@
<svg-icon icon-class="list"/>
运行环境列表
<el-select v-model="cluster" placeholder="请选择集群名称" @change="changeCluster">
<el-option label="qa" value="qa"/>
<el-option label="dev-ops" value="dev-ops"/>
<el-option v-for="item in clusterArray" :value="item" :label="item" :key="item" />
</el-select>
</p>
<el-table
......@@ -52,18 +51,20 @@
</div>
</template>
<script>
import { fetchKubernetesList } from '@/api/docker'
import { fetchKubernetesList, getCluster } from '@/api/docker'
export default {
data() {
return {
name: 'hello',
clusterArray: [],
tableData: [],
cluster: this.$store.getters.cluster
}
},
created() {
this.fetchK8sList()
this.getCluster()
},
methods: {
syncMySQL(namespace) {
......@@ -87,6 +88,11 @@ export default {
this.tableData = res.data.namespaces
})
},
getCluster() {
getCluster().then(res => {
this.clusterArray = res.data
})
},
indexMethod(index) {
return index + 1
},
......
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