算例数据接口重新对接、调度中心获取项目列表重新对接、物理资源视图列表重新对接

This commit is contained in:
jhnine 2022-11-28 15:01:20 +08:00
parent e2de0730a1
commit 222ad5a02c
4 changed files with 40 additions and 56 deletions

View File

@ -192,7 +192,7 @@ export function getClusterByDomain(params) {
params
})
}
// 云际拓扑图页面--项目列表--查询
// 项目列表--查询
export function getProjectNamespaceList(params) {
return request({
url: '/jcc-schedule/api/v1/namespace/list?label_key=jcce&label_value=true',
@ -201,6 +201,24 @@ export function getProjectNamespaceList(params) {
})
}
// 调度中心 项目列表--查询
export function getKarmadaNamespace(params) {
return request({
url: '/jcc-schedule/api/v1/namespace/list',
method: 'get',
params
})
}
// 物理资源视角 项目列表--查询
export function getListPodsCount(params) {
return request({
url: '/jcc-schedule/api/v1/namespace/listPodsCount',
method: 'get',
params
})
}
// 云际拓扑图页面--地图展示的数据接口(全量)
export function getMapDomainList(params) {
return request({
@ -228,15 +246,6 @@ export function getResourceCount(params) {
})
}
// 云际拓扑图页面--地图下面算力数据
export function getComputility(params) {
return request({
url: '/jcc-schedule/api/v1/resource/getComputility',
method: 'get',
params
})
}
// 调度实例页面--列表查询
export function getPropagationPolicyList(params) {
return request({

View File

@ -25,14 +25,7 @@
<Earth ref="earthChart" :map-type="mapType" />
</el-col>
</el-row>
<!-- <el-carousel height="120px" direction="vertical" :autoplay="true">
<el-carousel-item> -->
<Exhibition :data="exhibitionArray1" :span="6" class="exhibition" />
<!-- </el-carousel-item>
<el-carousel-item>
<Exhibition :data="exhibitionArray2" :span="8" class="exhibition" />
</el-carousel-item>
</el-carousel> -->
<Exhibition :data="exhibitionArray" :span="6" class="exhibition" />
<el-button style="float: right; padding: 0 9px 18px" type="text" @click="toResourceList">更多</el-button>
</el-card>
</el-col>
@ -68,7 +61,7 @@ import BarChart from './components/BarChart'
import Exhibition from '@/components/Exhibition'
import Navbar from '@/layout/components/Navbar'
import List from '@/components/list'
import { getProjectNamespaceList, getMapDomainList, getNamespaceDescribe, getResourceCount, getComputility } from '@/api/dispatching-center/dispatchingCenter'
import { getListPodsCount, getMapDomainList, getNamespaceDescribe, getResourceCount } from '@/api/dispatching-center/dispatchingCenter'
export default {
components: { List, Earth, Exhibition, Navbar, BarChart, PieChart },
@ -78,7 +71,7 @@ export default {
height: '600',
loading: false,
tableListData: [],
exhibitionArray1: [
exhibitionArray: [
{
name: '纳管资源域',
src: 'dataIcon-1',
@ -100,22 +93,10 @@ export default {
value: '-'
}
],
// exhibitionArray2: [
// {
// name: '',
// src: 'dataIcon-3',
// value: '-'
// },
// {
// name: '',
// src: 'dataIcon-3',
// value: '-'
// }
// ],
columns: [
{ prop: 'ns_name', width: 100, label: '项目名称', formatter: (row) => { return (row.state === 'Active' ? <div><span class='round ' />{row.ns_name}</div> : <div><span class='round error' />{row.ns_name}</div>) } },
{ prop: 'available_pod_num', width: 80, label: 'Pods', formatter: (row) => { return <span class='box'>{row.available_pod_num}</span> } },
{ prop: 'cross_domain', label: '任务类型', formatter: (row) => { return row.cross_domain ? '广域任务' : '单域任务' } }
{ prop: 'namespace', width: 100, label: '项目名称', formatter: (row) => { return (row.state === 'Active' ? <div><span class='round ' />{row.namespace}</div> : <div><span class='round error' />{row.namespace}</div>) } },
{ prop: 'count', width: 90, label: 'Pods', formatter: (row) => { return <span class='box'>{row.count}</span> } },
{ prop: 'domainType', width: 80, label: '任务类型', formatter: (row) => { return row.domainType ? '广域任务' : '单域任务' } }
],
intervalMap: null
}
@ -149,8 +130,8 @@ export default {
},
//
getTableList() {
getProjectNamespaceList({ pageNum: 1, pageSize: 999 }).then((res) => {
this.tableListData = res.data.list
getListPodsCount().then((res) => {
this.tableListData = res.data
setTimeout(() => this.getright_table(), 5000)
})
},
@ -161,7 +142,7 @@ export default {
const div = document.getElementsByClassName('el-table__body-wrapper')[0]
div.style.height = this.height
const row = this_.tableListData.length > 1 ? this_.tableListData[1] : this_.tableListData[0]
getNamespaceDescribe({ namespace: row.ns_name }).then(e => {
getNamespaceDescribe({ namespace: row.namespace }).then(e => {
var data = this_.tableListData[0]
//
this_.tableListData.push(data)
@ -195,7 +176,7 @@ export default {
const displayData = e.data?.domains?.map(n => ({ ...n, name: n.domain_name, value: n.location })) || []
this.$refs.earthChart.earthOption.series[1].data = displayData
this.$refs.earthChart.earthOption.graphic[0].children[0].shape = { width: 180, height: 33 }
this.$refs.earthChart.earthOption.graphic[0].children[1].style.text = `${row.ns_name} \n`
this.$refs.earthChart.earthOption.graphic[0].children[1].style.text = `${row.namespace} \n`
this.$refs.earthChart.earthOption.graphic[0].children[2].shape = { width: 180, height: 70 }
this.$refs.earthChart.earthOption.graphic[0].children[3].style.text = `工作负载数量: ${e.data?.deployments?.length || 0} \n跨域协作区域 ${e.data?.domains?.length || 0}`
this.$refs.earthChart.resetChart()
@ -220,14 +201,10 @@ export default {
},
getResourceData() {
getResourceCount().then(e => {
this.exhibitionArray1[0].value = e.data?.domain || '-'
this.exhibitionArray1[1].value = e.data?.cluster || '-'
this.exhibitionArray1[2].value = e.data?.pod || '-'
})
getComputility().then(e => {
this.exhibitionArray1[3].value = e.data?.all || '-'
// this.exhibitionArray2[1].value = e.data?.top || '-'
// this.exhibitionArray2[2].value = e.data?.now || '-'
this.exhibitionArray[0].value = e.data?.domain || '-'
this.exhibitionArray[1].value = e.data?.cluster || '-'
this.exhibitionArray[2].value = e.data?.pod || '-'
this.exhibitionArray[3].value = e.data?.totalFlops || '-'
})
},
//
@ -270,7 +247,6 @@ export default {
padding: 5px;
min-width: 22px;
text-align: center;
margin-left: 15px;
color:white;
background: #333333;
box-shadow: 0px 3px 7px 0px rgba(51, 51, 51, 0.35);

View File

@ -13,7 +13,7 @@
<el-scrollbar ref="scrollContainer" :vertical="true" class="scroll-container">
<div class="list">
<el-radio-group v-model="namespace">
<el-radio v-for="item in namespaceList" :key="item.ns_name" :label="item.ns_name" />
<el-radio v-for="item in namespaceList" :key="item" :label="item" />
</el-radio-group>
</div>
</el-scrollbar>
@ -97,7 +97,7 @@
</template>
<script>
import List from '@/components/list'
import { getClusterList, getProjectNamespaceList, getDeploymentList, getDomainList, getClusterByDomain } from '@/api/dispatching-center/dispatchingCenter'
import { getClusterList, getKarmadaNamespace, getDeploymentList, getDomainList, getClusterByDomain } from '@/api/dispatching-center/dispatchingCenter'
export default {
components: { List },
@ -177,8 +177,8 @@ export default {
},
getNamespace() {
this.namespaceLoading = true
getProjectNamespaceList({ label_key: 'jcce', label_value: true }).then(e => {
this.namespaceList = e.data.list
getKarmadaNamespace().then(e => {
this.namespaceList = e.data
this.namespaceLoading = false
})
},

View File

@ -137,7 +137,7 @@
<script>
import addContainerForm from '@/components/Actions/addContainerForm.vue'
import { getPropagationTemplate, getProjectNamespaceList, getClusterList, createPropagationPolicy } from '@/api/dispatching-center/dispatchingCenter'
import { getPropagationTemplate, getKarmadaNamespace, getClusterList, createPropagationPolicy } from '@/api/dispatching-center/dispatchingCenter'
import { getWorkloadCreate } from '@/api/container/workloadManagement'
export default {
@ -217,7 +217,6 @@ export default {
this.editInfoForm.container_image = []
},
openImage() {
console.log(this.editInfoForm.namespace)
if (this.editInfoForm.namespace) {
this.containerFormVisiable = true
} else {
@ -232,8 +231,8 @@ export default {
// console.log(data)
},
setFilterMapNamespaceList() {
getProjectNamespaceList({ pageNum: 1, pageSize: 9999 }).then(res => {
this.namespaceOptions = res.data.list?.map(n => ({ label: n.ns_name, value: n.ns_name }))
getKarmadaNamespace().then(res => {
this.namespaceOptions = res.data?.map(n => ({ label: n, value: n }))
})
getPropagationTemplate().then(e => {