Commit b6817737 authored by 智勇's avatar 智勇

获取cluster

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