forked from JointCloud/JCC-RIP
19:00
This commit is contained in:
parent
5aec12b752
commit
8ca1da93eb
|
@ -23,7 +23,7 @@ export function getClusterResource() {
|
||||||
|
|
||||||
export function getNodeBriefMessage() {
|
export function getNodeBriefMessage() {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/monitoring.kubesphere.io/v1alpha3/nodes?type=rank&metrics_filter=node_cpu_utilisation%7Cnode_cpu_usage%7Cnode_cpu_total%7Cnode_memory_utilisation%7Cnode_memory_usage_wo_cache%7Cnode_memory_total%7Cnode_disk_size_utilisation%7Cnode_disk_size_usage%7Cnode_disk_size_capacity%7Cnode_pod_utilisation%7Cnode_pod_running_count%7Cnode_pod_quota%7Cnode_disk_inode_utilisation%7Cnode_disk_inode_total%7Cnode_disk_inode_usage%7Cnode_load1%24&page=1&limit=10&sort_type=desc&sort_metric=node_cpu_utilisation',
|
url: 'kapis/monitoring.kubesphere.io/v1alpha3/nodes?type=rank&metrics_filter=node_cpu_utilisation%7Cnode_cpu_usage%7Cnode_cpu_total%7Cnode_memory_utilisation%7Cnode_memory_usage_wo_cache%7Cnode_memory_total%7Cnode_disk_size_utilisation%7Cnode_disk_size_usage%7Cnode_disk_size_capacity%7Cnode_pod_utilisation%7Cnode_pod_running_count%7Cnode_pod_quota%7Cnode_disk_inode_utilisation%7Cnode_disk_inode_total%7Cnode_disk_inode_usage%7Cnode_load1%24&page=1&limit=5&sort_type=desc&sort_metric=node_cpu_utilisation',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function getVolume() {
|
export function getVolume(page) {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/resources.kubesphere.io/v1alpha3/persistentvolumeclaims?sortBy=createTime&limit=10',
|
url: 'kapis/resources.kubesphere.io/v1alpha3/persistentvolumeclaims?sortBy=createTime&limit=10&page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function getDeployments() {
|
export function getDeployments(page) {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/resources.kubesphere.io/v1alpha3/deployments?sortBy=updateTime&limit=10',
|
url: 'kapis/resources.kubesphere.io/v1alpha3/deployments?sortBy=updateTime&limit=10&page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getStatefulSets() {
|
export function getStatefulSets(page) {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/resources.kubesphere.io/v1alpha3/statefulsets?sortBy=createTime&limit=10',
|
url: 'kapis/resources.kubesphere.io/v1alpha3/statefulsets?sortBy=createTime&limit=10&page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDaemonSets() {
|
export function getDaemonSets(page) {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/resources.kubesphere.io/v1alpha3/daemonsets?sortBy=createTime&limit=10',
|
url: 'kapis/resources.kubesphere.io/v1alpha3/daemonsets?sortBy=createTime&limit=10&page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPods() {
|
export function getPods(page) {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/resources.kubesphere.io/v1alpha3/pods?sortBy=startTime&limit=10',
|
url: 'kapis/resources.kubesphere.io/v1alpha3/pods?sortBy=startTime&limit=10&page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getServices() {
|
export function getServices(page) {
|
||||||
return request({
|
return request({
|
||||||
url: 'kapis/resources.kubesphere.io/v1alpha3/services?sortBy=createTime&limit=10',
|
url: 'kapis/resources.kubesphere.io/v1alpha3/services?sortBy=createTime&limit=10&page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,17 +35,17 @@ export default {
|
||||||
|
|
||||||
getSchedulerState().then(response => {
|
getSchedulerState().then(response => {
|
||||||
let schedulerSchedulingTimes, schedulingFailedPods, temp1, temp2
|
let schedulerSchedulingTimes, schedulingFailedPods, temp1, temp2
|
||||||
console.log(response['results'][0]['data'])
|
// console.log(response['results'][0]['data'])
|
||||||
if (response['results'][0]['data']['result'] != null) {
|
if (response['results'][0]['data']['result'] != null) {
|
||||||
for (let l = 0; l < response['results'][0]['data']['result'].length; l++) {
|
for (let l = 0; l < response['results'][0]['data']['result'].length; l++) {
|
||||||
console.log(1)
|
// console.log(1)
|
||||||
if (response['results'][0]['data']['result'][l]['metric']['result'] === 'scheduled') { schedulerSchedulingTimes = parseInt(response['results'][0]['data']['result'][l]['value'][1]) }
|
if (response['results'][0]['data']['result'][l]['metric']['result'] === 'scheduled') { schedulerSchedulingTimes = parseInt(response['results'][0]['data']['result'][l]['value'][1]) }
|
||||||
if (response['results'][0]['data']['result'][l]['metric']['result'] === 'error') { temp1 = parseInt(response['results'][0]['data']['result'][l]['value'][1]) }
|
if (response['results'][0]['data']['result'][l]['metric']['result'] === 'error') { temp1 = parseInt(response['results'][0]['data']['result'][l]['value'][1]) }
|
||||||
if (response['results'][0]['data']['result'][l]['metric']['result'] === 'unschedulable') { temp2 = parseInt(response['results'][0]['data']['result'][l]['value'][1]) }
|
if (response['results'][0]['data']['result'][l]['metric']['result'] === 'unschedulable') { temp2 = parseInt(response['results'][0]['data']['result'][l]['value'][1]) }
|
||||||
}
|
}
|
||||||
schedulingFailedPods = temp1 + temp2
|
schedulingFailedPods = temp1 + temp2
|
||||||
} else {
|
} else {
|
||||||
console.log(0)
|
// console.log(0)
|
||||||
schedulerSchedulingTimes = '-'
|
schedulerSchedulingTimes = '-'
|
||||||
schedulingFailedPods = '-'
|
schedulingFailedPods = '-'
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,24 @@ export default {
|
||||||
const data = []
|
const data = []
|
||||||
|
|
||||||
getNodeBriefMessage().then(response => {
|
getNodeBriefMessage().then(response => {
|
||||||
const LENGTH = response['results'].length
|
const LENGTH = response.total_item
|
||||||
|
// console.log(response.items.length)
|
||||||
console.log(LENGTH)
|
console.log(LENGTH)
|
||||||
let index = 0
|
let index = 0
|
||||||
|
|
||||||
for (let item = 0; item < LENGTH; item++) {
|
for (let item = 0; item < LENGTH; item++) {
|
||||||
if (response['results'][item]['metric_name'] === 'node_cpu_utilisation') {
|
if (response['results'][item]['metric_name'] === 'node_cpu_utilisation') {
|
||||||
index = item
|
index = item
|
||||||
break
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('ITEM' + index)
|
console.log('index : ' + index)
|
||||||
console.log(response['results'][index]['data']['result'].length)
|
// console.log(response['results'][index]['data']['result'].length)
|
||||||
let name, ip, role, cpu
|
let name, ip, role, cpu
|
||||||
for (let l = 0; l < response['results'][index]['data']['result'].length; l++) {
|
for (let l = 0; l < response['results'][index]['data']['result'].length; l++) {
|
||||||
if (JSON.stringify(response['results'][index]['data']['result'][l]) === '{}') { continue }
|
if (JSON.stringify(response['results'][index]['data']['result'][l]) === '{}') { continue }
|
||||||
const obj = {}
|
const obj = {}
|
||||||
console.log(response['results'][index]['data']['result'][l])
|
// console.log(response['results'][index]['data']['result'][l])
|
||||||
name = response['results'][index]['data']['result'][l]['metric']['node']
|
name = response['results'][index]['data']['result'][l]['metric']['node']
|
||||||
ip = response['results'][index]['data']['result'][l]['metric']['host_ip']
|
ip = response['results'][index]['data']['result'][l]['metric']['host_ip']
|
||||||
role = response['results'][index]['data']['result'][l]['metric']['role']
|
role = response['results'][index]['data']['result'][l]['metric']['role']
|
||||||
|
@ -46,7 +48,7 @@ export default {
|
||||||
obj.node = name + ' (' + ip + ')'
|
obj.node = name + ' (' + ip + ')'
|
||||||
if (role === 'master') { obj.role = role } else { obj.role = 'node' }
|
if (role === 'master') { obj.role = role } else { obj.role = 'node' }
|
||||||
obj.cpu = cpu + '%'
|
obj.cpu = cpu + '%'
|
||||||
console.log(l + ',' + obj)
|
// console.log(l + ',' + obj)
|
||||||
data[l] = obj
|
data[l] = obj
|
||||||
}
|
}
|
||||||
this.nodeMessage = data
|
this.nodeMessage = data
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="nodeInfo">
|
<div class="nodeInfo">
|
||||||
<el-card class="chartCard" style="height: 600px">
|
<el-card class="chartCard" style="height: 1000px">
|
||||||
<p>节点详细信息</p>
|
<p>节点详细信息</p>
|
||||||
<el-table v-if="nodeStatus.length>0" :data="nodeStatus">
|
<el-table v-if="nodeStatus.length>0" :data="nodeStatus">
|
||||||
<el-table-column prop="name" label="名称" width="200" :formatter="(row,column)=>{return row.metadata.name+'\n'+row.status.addresses[0]['address']||''}" />
|
<el-table-column prop="name" label="名称" width="200" :formatter="(row,column)=>{return row.metadata.name+'\n'+row.status.addresses[0]['address']||''}" />
|
||||||
|
|
|
@ -44,17 +44,16 @@ export default {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const data = []
|
const data = []
|
||||||
const obj = {}
|
const obj = {}
|
||||||
let masterNum, totalNum, nodeNum
|
let masterNum, totalNum
|
||||||
|
|
||||||
getTotalNum().then(response => {
|
getTotalNum().then(response => {
|
||||||
totalNum = response['totalItems']
|
totalNum = response['totalItems']
|
||||||
nodeNum = totalNum
|
|
||||||
|
|
||||||
getMasterNum().then(response => {
|
getMasterNum().then(response => {
|
||||||
masterNum = response['totalItems']
|
masterNum = response['totalItems']
|
||||||
obj.totalNumber = totalNum
|
obj.totalNumber = totalNum
|
||||||
obj.masterNumber = masterNum
|
obj.masterNumber = masterNum
|
||||||
obj.nodeNumber = nodeNum
|
if (totalNum === 1 || totalNum === masterNum) { obj.nodeNumber = 1 } else { obj.nodeNumber = totalNum - masterNum }
|
||||||
data[0] = obj
|
data[0] = obj
|
||||||
this.nodeBriefMessage = data
|
this.nodeBriefMessage = data
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -6,15 +6,26 @@
|
||||||
</h4>
|
</h4>
|
||||||
<span class="tips">容器组 (Pod) 是 Kubernetes 应用程序的基本执行单元,是您创建或部署的 Kubernetes 对象模型中最小和最简单的单元。</span>
|
<span class="tips">容器组 (Pod) 是 Kubernetes 应用程序的基本执行单元,是您创建或部署的 Kubernetes 对象模型中最小和最简单的单元。</span>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-tabs type="border-card">
|
<el-card>
|
||||||
<el-table :data="pods">
|
<el-tabs type="border-card">
|
||||||
<el-table-column prop="name" label="名称" width="400" />
|
<el-table :data="pods">
|
||||||
<!-- <el-table-column prop="status" label="状态" width="200" />-->
|
<el-table-column prop="name" label="名称" width="400" />
|
||||||
<el-table-column prop="node" label="节点" width="400" />
|
<!-- <el-table-column prop="status" label="状态" width="200" />-->
|
||||||
<el-table-column prop="podIP" label="容器组IP" width="300" />
|
<el-table-column prop="node" label="节点" width="400" />
|
||||||
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
<el-table-column prop="podIP" label="容器组IP" width="300" />
|
||||||
</el-table>
|
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
||||||
</el-tabs>
|
</el-table>
|
||||||
|
</el-tabs>
|
||||||
|
</el-card>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="pagination.currentPage"
|
||||||
|
layout="total, prev, pager, next, jumper"
|
||||||
|
:total="pagination.totalCount"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -25,16 +36,25 @@ export default {
|
||||||
name: 'PodForm',
|
name: 'PodForm',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pods: [{}]
|
pods: [{}],
|
||||||
|
pagination: { currentPage: 1, totalCount: 0 },
|
||||||
|
listQuery: { page: 1 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
return new Promise((resolve, reject) => {
|
this.getList()
|
||||||
const data = []
|
},
|
||||||
getPods().then(response => {
|
methods: {
|
||||||
const LENGTH = response['totalItems']
|
handleCurrentChange(currentPage) {
|
||||||
console.log(LENGTH)
|
this.pagination.currentPage = currentPage
|
||||||
for (let item = 0; item < 10; item++) {
|
this.listQuery.page = currentPage
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
getPods(this.listQuery.page.toString()).then(response => {
|
||||||
|
this.pagination.totalCount = response.totalItems
|
||||||
|
const data = []
|
||||||
|
for (let item = 0; item < response.items.length; item++) {
|
||||||
const obj = {}
|
const obj = {}
|
||||||
obj.name = response['items'][item]['metadata']['name']
|
obj.name = response['items'][item]['metadata']['name']
|
||||||
obj.node = response['items'][item]['spec']['nodeName'] + ' (' + response['items'][item]['status']['hostIP'] + ')'
|
obj.node = response['items'][item]['spec']['nodeName'] + ' (' + response['items'][item]['status']['hostIP'] + ')'
|
||||||
|
@ -44,9 +64,9 @@ export default {
|
||||||
}
|
}
|
||||||
this.pods = data
|
this.pods = data
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,15 +6,26 @@
|
||||||
</h4>
|
</h4>
|
||||||
<span class="tips">服务 (Service) 是定义了一类容器组的逻辑集合和一个用于访问它们的策略。</span>
|
<span class="tips">服务 (Service) 是定义了一类容器组的逻辑集合和一个用于访问它们的策略。</span>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-tabs type="border-card">
|
<el-card>
|
||||||
<el-table :data="services">
|
<el-tabs type="border-card">
|
||||||
<el-table-column prop="name" label="名称" width="350" />
|
<el-table :data="services">
|
||||||
<el-table-column prop="project" label="项目" width="350" />
|
<el-table-column prop="name" label="名称" width="350" />
|
||||||
<el-table-column prop="type" label="服务类型" width="250" />
|
<el-table-column prop="project" label="项目" width="350" />
|
||||||
<el-table-column prop="internetAccess" label="外网访问" width="250" />
|
<el-table-column prop="type" label="服务类型" width="250" />
|
||||||
<el-table-column prop="createTime" label="创建时间" width="300" />
|
<el-table-column prop="internetAccess" label="外网访问" width="250" />
|
||||||
</el-table>
|
<el-table-column prop="createTime" label="创建时间" width="300" />
|
||||||
</el-tabs>
|
</el-table>
|
||||||
|
</el-tabs>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="pagination.currentPage"
|
||||||
|
layout="total, prev, pager, next, jumper"
|
||||||
|
:total="pagination.totalCount"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -25,17 +36,25 @@ export default {
|
||||||
name: 'ServiceForm',
|
name: 'ServiceForm',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
services: [{}]
|
services: [{}],
|
||||||
|
pagination: { currentPage: 1, totalCount: 0 },
|
||||||
|
listQuery: { page: 1 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
return new Promise((resolve, reject) => {
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleCurrentChange(currentPage) {
|
||||||
|
this.pagination.currentPage = currentPage
|
||||||
|
this.listQuery.page = currentPage
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
const data = []
|
const data = []
|
||||||
getServices().then(response => {
|
getServices(this.listQuery.page.toString()).then(response => {
|
||||||
console.log(response)
|
this.pagination.totalCount = response.totalItems
|
||||||
const LENGTH = response['totalItems']
|
for (let item = 0; item < response.items.length; item++) {
|
||||||
console.log(LENGTH)
|
|
||||||
for (let item = 0; item < 10; item++) {
|
|
||||||
const obj = {}
|
const obj = {}
|
||||||
obj.name = response['items'][item]['metadata']['name']
|
obj.name = response['items'][item]['metadata']['name']
|
||||||
obj.project = response['items'][item]['metadata']['namespace']
|
obj.project = response['items'][item]['metadata']['namespace']
|
||||||
|
@ -46,9 +65,9 @@ export default {
|
||||||
}
|
}
|
||||||
this.services = data
|
this.services = data
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,62 +16,90 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="chartCard" style="height: 700px; padding:20px 0">
|
<el-card class="chartCard" style="height: 700px; padding:20px 0">
|
||||||
<el-table :data="volumes">
|
<el-table :data="volumes">
|
||||||
<el-table-column prop="name" label="名称" width="300" />
|
<el-table-column prop="name" label="名称" width="380" />
|
||||||
<el-table-column prop="status" label="状态" width="200" />
|
<el-table-column prop="status" label="状态" width="200" />
|
||||||
<el-table-column prop="mode" label="访问模式" width="250" />
|
<el-table-column prop="mode" label="访问模式" width="300" />
|
||||||
<el-table-column prop="mount" label="挂载" width="200" />
|
<el-table-column prop="mount" label="挂载" width="200" />
|
||||||
<el-table-column prop="createTime" label="创建时间" width="250" />
|
<el-table-column prop="createTime" label="创建时间" width="300" />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="pagination.currentPage"
|
||||||
|
layout="total, prev, pager, next, jumper"
|
||||||
|
:total="pagination.totalCount"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getVolume } from '@/api/storageManagement'
|
import { getVolume } from '@/api/storageManagement'
|
||||||
|
import { getPods } from '@/api/workloadManagement'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'StorageForm',
|
name: 'StorageForm',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: '1',
|
activeName: '1',
|
||||||
volumes: [{}]
|
volumes: [{}],
|
||||||
|
pagination: { currentPage: 1, totalCount: 0 },
|
||||||
|
listQuery: { page: 1 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
return new Promise((resolve, reject) => {
|
this.getList()
|
||||||
const data = []
|
},
|
||||||
const obj = {}
|
methods: {
|
||||||
getVolume().then(response => {
|
handleCurrentChange(currentPage) {
|
||||||
console.log(response)
|
this.pagination.currentPage = currentPage
|
||||||
const LENGTH = response['totalItems']
|
this.listQuery.page = currentPage
|
||||||
console.log(LENGTH)
|
this.getList()
|
||||||
for (let item = 0; item < LENGTH; item++) {
|
},
|
||||||
// 存储卷名称
|
getList() {
|
||||||
obj.name = response['items'][item]['metadata']['name']
|
getPods(this.listQuery.page.toString()).then(response => {
|
||||||
|
this.pagination.totalCount = response.totalItems
|
||||||
|
const data = []
|
||||||
|
getVolume().then(response => {
|
||||||
|
this.pagination.totalCount = response.totalItems
|
||||||
|
console.log(response)
|
||||||
|
for (let item = 0; item < response.items.length; item++) {
|
||||||
|
const obj = {}
|
||||||
|
// 存储卷名称
|
||||||
|
obj.name = response['items'][item]['metadata']['name']
|
||||||
|
|
||||||
// 存储卷状态
|
// 存储卷状态
|
||||||
let volumeStatus
|
let volumeStatus
|
||||||
if (response['items'][item]['status']['phase'] === 'Bound') { volumeStatus = '准备就绪' }
|
if (response['items'][item]['status']['phase'] === 'Bound') {
|
||||||
if (response['items'][item]['status']['phase'] === 'Lost') { volumeStatus = '丢失' }
|
volumeStatus = '准备就绪'
|
||||||
if (response['items'][item]['status']['phase'] === 'Pending') { volumeStatus = '等待中' }
|
}
|
||||||
obj.status = volumeStatus
|
if (response['items'][item]['status']['phase'] === 'Lost') {
|
||||||
|
volumeStatus = '丢失'
|
||||||
|
}
|
||||||
|
if (response['items'][item]['status']['phase'] === 'Pending') {
|
||||||
|
volumeStatus = '等待中'
|
||||||
|
}
|
||||||
|
obj.status = volumeStatus
|
||||||
|
|
||||||
// 存储卷访问模式
|
// 存储卷访问模式
|
||||||
obj.mode = response['items'][item]['status']['accessModes']
|
obj.mode = response['items'][item]['status']['accessModes']
|
||||||
|
|
||||||
// 存储卷挂载情况
|
// 存储卷挂载情况
|
||||||
obj.mount = '已挂载'
|
obj.mount = '已挂载'
|
||||||
|
|
||||||
// 存储卷创建时间
|
// 存储卷创建时间
|
||||||
obj.createTime = response['items'][item]['metadata']['creationTimestamp']
|
obj.createTime = response['items'][item]['metadata']['creationTimestamp']
|
||||||
|
|
||||||
data[item] = obj
|
data[item] = obj
|
||||||
|
}
|
||||||
this.volumes = data
|
this.volumes = data
|
||||||
}
|
}).catch(error => {
|
||||||
}).catch(error => {
|
console.log(error)
|
||||||
reject(error)
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,6 +14,15 @@
|
||||||
<el-table-column prop="project" label="项目" width="400" />
|
<el-table-column prop="project" label="项目" width="400" />
|
||||||
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="pagination[0].currentPage"
|
||||||
|
layout="total, prev, pager, next, jumper"
|
||||||
|
:total="pagination[0].totalCount"
|
||||||
|
@current-change="handleDeploymentsChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="有状态副本集">
|
<el-tab-pane label="有状态副本集">
|
||||||
<el-table :data="StatefulSets">
|
<el-table :data="StatefulSets">
|
||||||
|
@ -22,6 +31,15 @@
|
||||||
<el-table-column prop="project" label="项目" width="400" />
|
<el-table-column prop="project" label="项目" width="400" />
|
||||||
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="pagination[1].currentPage"
|
||||||
|
layout="total, prev, pager, next, jumper"
|
||||||
|
:total="pagination[1].totalCount"
|
||||||
|
@current-change="handleStatefulSetsChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="守护进程集">
|
<el-tab-pane label="守护进程集">
|
||||||
<el-table :data="DaemonSets">
|
<el-table :data="DaemonSets">
|
||||||
|
@ -30,6 +48,15 @@
|
||||||
<el-table-column prop="project" label="项目" width="400" />
|
<el-table-column prop="project" label="项目" width="400" />
|
||||||
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
<el-table-column prop="updateTime" label="更新时间" width="300" />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="pagination[2].currentPage"
|
||||||
|
layout="total, prev, pager, next, jumper"
|
||||||
|
:total="pagination[2].totalCount"
|
||||||
|
@current-change="handleDaemonSetsChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,34 +72,69 @@ export default {
|
||||||
activeName: '0',
|
activeName: '0',
|
||||||
Deployments: [{}],
|
Deployments: [{}],
|
||||||
StatefulSets: [{}],
|
StatefulSets: [{}],
|
||||||
DaemonSets: [{}]
|
DaemonSets: [{}],
|
||||||
|
pagination: [
|
||||||
|
{ currentPage: 1, totalCount: 0 },
|
||||||
|
{ currentPage: 1, totalCount: 0 },
|
||||||
|
{ currentPage: 1, totalCount: 0 }
|
||||||
|
],
|
||||||
|
listQuery: [
|
||||||
|
{ page: 1 },
|
||||||
|
{ page: 1 },
|
||||||
|
{ page: 1 }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
return new Promise((resolve, reject) => {
|
this.getDeploymentsList()
|
||||||
|
this.getStatefulSetsList()
|
||||||
|
this.getDaemonSetsList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getStatus(readyReplicas, replicas) {
|
||||||
|
if (readyReplicas === replicas) {
|
||||||
|
return '运行中' + ' (' + readyReplicas + '/' + replicas + ')'
|
||||||
|
} else {
|
||||||
|
return '更新中' + ' (' + readyReplicas + '/' + replicas + ')'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDeploymentsChange(currentPage) {
|
||||||
|
this.pagination[0].currentPage = currentPage
|
||||||
|
this.listQuery[0].page = currentPage
|
||||||
|
this.getDeploymentsList()
|
||||||
|
},
|
||||||
|
handleStatefulSetsChange(currentPage) {
|
||||||
|
this.pagination[1].currentPage = currentPage
|
||||||
|
this.listQuery[1].page = currentPage
|
||||||
|
this.getStatefulSetsList()
|
||||||
|
},
|
||||||
|
handleDaemonSetsChange(currentPage) {
|
||||||
|
this.pagination[2].currentPage = currentPage
|
||||||
|
this.listQuery[2].page = currentPage
|
||||||
|
this.getDaemonSetsList()
|
||||||
|
},
|
||||||
|
getDeploymentsList() {
|
||||||
const deployData = []
|
const deployData = []
|
||||||
const stateData = []
|
getDeployments(this.listQuery[0].page.toString()).then(response => {
|
||||||
const daemonData = []
|
this.pagination[0].totalCount = response.totalItems
|
||||||
getDeployments().then(response => {
|
for (let item = 0; item < response.items.length; item++) {
|
||||||
const LENGTH = response['totalItems']
|
|
||||||
console.log(LENGTH)
|
|
||||||
for (let item = 0; item < 10; item++) {
|
|
||||||
const obj = {}
|
const obj = {}
|
||||||
obj.name = response['items'][item]['metadata']['name']
|
obj.name = response['items'][item]['metadata']['name']
|
||||||
obj.status = this.getStatus(response['items'][item]['status']['readyReplicas'], response['items'][item]['status']['replicas'])
|
obj.status = this.getStatus(response['items'][item]['status']['readyReplicas'], response['items'][item]['status']['replicas'])
|
||||||
obj.project = response['items'][item]['metadata']['namespace']
|
obj.project = response['items'][item]['metadata']['namespace']
|
||||||
obj.updateTime = response['items'][item]['metadata']['creationTimestamp']
|
obj.updateTime = response['items'][item]['metadata']['creationTimestamp']
|
||||||
|
|
||||||
deployData[item] = obj
|
deployData[item] = obj
|
||||||
}
|
}
|
||||||
this.Deployments = deployData
|
this.Deployments = deployData
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
getStatefulSets().then(response => {
|
},
|
||||||
const LENGTH = response['totalItems']
|
getStatefulSetsList() {
|
||||||
console.log(LENGTH)
|
const stateData = []
|
||||||
for (let item = 0; item < LENGTH; item++) {
|
getStatefulSets(this.listQuery[1].page.toString()).then(response => {
|
||||||
|
this.pagination[1].totalCount = response.totalItems
|
||||||
|
for (let item = 0; item < response.items.length; item++) {
|
||||||
const obj = {}
|
const obj = {}
|
||||||
obj.name = response['items'][item]['metadata']['name']
|
obj.name = response['items'][item]['metadata']['name']
|
||||||
obj.status = this.getStatus(response['items'][item]['status']['readyReplicas'], response['items'][item]['status']['replicas'])
|
obj.status = this.getStatus(response['items'][item]['status']['readyReplicas'], response['items'][item]['status']['replicas'])
|
||||||
|
@ -83,12 +145,14 @@ export default {
|
||||||
}
|
}
|
||||||
this.StatefulSets = stateData
|
this.StatefulSets = stateData
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
getDaemonSets().then(response => {
|
},
|
||||||
const LENGTH = response['totalItems']
|
getDaemonSetsList() {
|
||||||
console.log(LENGTH)
|
const daemonData = []
|
||||||
for (let item = 0; item < LENGTH; item++) {
|
getDaemonSets(this.listQuery[2].page.toString()).then(response => {
|
||||||
|
this.pagination[2].totalCount = response.totalItems
|
||||||
|
for (let item = 0; item < response.items.length; item++) {
|
||||||
const obj = {}
|
const obj = {}
|
||||||
obj.name = response['items'][item]['metadata']['name']
|
obj.name = response['items'][item]['metadata']['name']
|
||||||
obj.status = this.getStatus(response['items'][item]['status']['numberReady'], response['items'][item]['status']['desiredNumberScheduled'])
|
obj.status = this.getStatus(response['items'][item]['status']['numberReady'], response['items'][item]['status']['desiredNumberScheduled'])
|
||||||
|
@ -100,17 +164,8 @@ export default {
|
||||||
}
|
}
|
||||||
this.DaemonSets = daemonData
|
this.DaemonSets = daemonData
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getStatus(readyReplicas, replicas) {
|
|
||||||
if (readyReplicas === replicas) {
|
|
||||||
return '运行中' + ' (' + readyReplicas + '/' + replicas + ')'
|
|
||||||
} else {
|
|
||||||
return '更新中' + ' (' + readyReplicas + '/' + replicas + ')'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue