接口对接

This commit is contained in:
jhnine 2022-12-05 17:15:26 +08:00
parent ef73f86835
commit 48c8368007
5 changed files with 57 additions and 79 deletions

View File

@ -10,11 +10,10 @@ export function getDataList0(params) {
}
// 获取超算域
export function getDataList1(params) {
export function getListRegions() {
return request({
url: '/jcc-schedule/api/v1/cluster/list',
method: 'get',
params
url: '/apis/slurm/listRegions',
method: 'get'
})
}

View File

@ -28,16 +28,17 @@ export default {
return localStorage.getItem('jcceTheme')
}
},
// watch: {
// domainData(e) {
// console.log(e)
// if (e.length > 0) {
// this.drawChart(e)
// }
// }
// },
mounted() {
this.drawChart()
watch: {
domainData(e) {
console.log(e)
if (e.length > 0) {
this.xAxis = e.map(n => n?.regionName || 0)
this.data = e.map(n => n?.slurmNum || 0)
this.data2 = e.map(n => n?.adaptorInterfaceSum || 0)
this.data3 = e.map(n => n?.task || 0)
this.drawChart()
}
}
},
methods: {
drawChart(domainData) {
@ -61,7 +62,7 @@ export default {
show: false
}
}
const legend = ['slurm版本', '适配接口数量', '运行作业']
const legend = ['适配版本数量', '适配接口数量', '运行作业']
//
const barChart = echarts.init(this.$refs.barChart)
const loadOption = {
@ -90,7 +91,7 @@ export default {
data: this.xAxis,
axisLabel: {
interval: 0,
rotate: -10,
// rotate: -10,
padding: [0, 0, 0, -40],
margin: 14,
textStyle: {

View File

@ -23,11 +23,10 @@
highlight-current-row
:table-list-data="domainList"
:pagination="false"
@row-click="clickLeft"
/>
</el-col>
<el-col :span="12">
<BarChart :domain-data="taskList" />
<BarChart :domain-data="domainList" />
</el-col>
</el-row>
</el-card>
@ -106,7 +105,7 @@
import List from '@/components/list'
import Exhibition from '@/components/Exhibition'
import BarChart from './components/barChart.vue'
import { getListJobs, getListDbJobs } from '@/api/hpc/hpcManagement'
import { getListJobs, getListDbJobs, getListRegions } from '@/api/hpc/hpcManagement'
export default {
components: {
@ -116,39 +115,35 @@ export default {
},
data() {
return {
resource: {
cpu: {
cpu: 0,
ram: 0,
core: 0,
percent: 100
},
gpu: {
cpu: 0,
ram: 0,
core: 0,
percent: 100
}
},
domainList: [{
name: '11',
version: 11,
num: 11,
task: 11
}],
// resource: {
// cpu: {
// cpu: 0,
// ram: 0,
// core: 0,
// percent: 100
// },
// gpu: {
// cpu: 0,
// ram: 0,
// core: 0,
// percent: 100
// }
// },
domainList: [],
chooseRow: [],
taskList: [],
taskDBList: [],
exhibitionArray: [
{ name: '高性能计算域合计', src: 'hpc-1', value: '0' },
{ name: '已适配异构软件栈', src: 'blockChainBrowser-4', value: '0' },
{ name: '运行作业数量', src: 'blockChainBrowser-1', value: '0' }
{ name: '运行作业数量', src: 'blockChainBrowser-1', value: '0' },
{ name: '历史作业数量', src: 'blockChainBrowser-5', value: '0' }
// { name: '', src: 'blockChainBrowser-5', value: '0' }
],
domainColumns: [
{ prop: 'name', label: '超算域', formatter: (row) => { return <a onClick={() => this.viewDetail(row)}>{row.name}</a> } },
{ prop: 'version', label: 'slurm版本' },
{ prop: 'num', label: '适配接口数量' },
{ prop: 'regionName', label: '超算域' },
{ prop: 'slurmNum', label: '适配版本数量' },
{ prop: 'adaptorInterfaceSum', label: '适配接口数量' },
{ prop: 'task', label: '运行作业' }
],
taskColumns: [
@ -174,49 +169,22 @@ export default {
},
methods: {
getData() {
this.domainColumns = [{
name: '11',
status: 11,
detail: 11
}]
Promise.all([
getListJobs(),
getListDbJobs()
getListDbJobs(),
getListRegions()
]).then(res => {
this.taskList = res[0]?.jobInfos || []
this.exhibitionArray[2].value = res[0]?.recordCount || 0
this.taskDBList = res[1]?.jobInfoDbs || []
this.exhibitionArray[3].value = res[1]?.recordCount || 0
// const topData = res[0]
// this.exhibitionArray[0].value = topData.aaa
// this.exhibitionArray[1].value = topData.bbb
// this.exhibitionArray[2].value = topData.ccc
// const domainData = res[1].data
// this.domainList = domainData || []
// this.clickLeft([{
// name: '11',
// version: 11,
// num: 11,
// task: 11
// }])
// const resourceData = res[1].data
// this.resource = {
// cpu: {
// cpu: 0,
// ram: 0,
// core: 0,
// percent: 100
// },
// gpu: {
// cpu: 0,
// ram: 0,
// core: 0,
// percent: 100
// }
// }
this.domainList = res[2]?.regionSlurmInfo || []
})
},
clickLeft(row) {

View File

@ -15,7 +15,8 @@
prop="member_name"
label="集群名称"
>
<el-input v-model="editInfoForm.member_name" :maxlength="100" />
<el-input v-model="editInfoForm.member_name" :maxlength="63" />
<span class="tips">最长 63 个字符只能包含小写字母数字及分隔符("-")且必须以小写字母开头, 字母或数字结尾</span>
</el-form-item>
<el-form-item
prop="description"
@ -97,7 +98,11 @@ export default {
{ required: true, message: '请输入IP' }
],
member_name: [
{ required: true, message: '请输入名称' }
{ required: true, message: '请输入名称' },
{
pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
message: '名称格式不合法。'
}
],
domain_id: [
{ required: true, message: '请选择域' }

View File

@ -7,12 +7,11 @@
:columns="columns"
func-name="getVirtualMachineList"
:cluster-name="clusterName"
:pagination="true"
:pagination-auto="true"
:default-sort="{prop: 'existTime', order: 'ascending'}"
tooltip-effect="dark"
>
<template v-slot:filterBtns>
<span>总条数<span>{{ num }}</span></span>
<el-button size="medium" type="primary" @click="createVirtualMachine">创建</el-button>
</template>
</List>
@ -87,6 +86,7 @@ export default {
selectDeleteVolumeList: [],
deleteDialogVisible: false,
timer: null,
num: 0,
virtualMode: '',
currentVirtual: '',
disabled: false,
@ -148,6 +148,11 @@ export default {
}
}
},
mounted() {
getVirtualMachines().then(res => {
this.num = res?.data?.length || 0
})
},
beforeDestroy() {
clearInterval(this.searthInterval)
},