@@ -18,7 +18,8 @@ limitations under the License.
<div class="cl-hardware-visual">
<div class="cl-hardware-visual">
<div class="cl-hardware-content"
<div class="cl-hardware-content"
v-if="!(chipTableData.length === 0 && cpuList.length===0)">
v-if="!(chipTableData.length === 0 && cpuList.length===0)">
<div class="cl-hardware-top">
<div class="cl-hardware-top"
v-if="chipTableData.length">
<div class="cl-hardware-left">
<div class="cl-hardware-left">
<div class="cl-sub-title"
<div class="cl-sub-title"
v-if="chipTableData.length">
v-if="chipTableData.length">
@@ -28,7 +29,8 @@ limitations under the License.
<el-table v-if="chipTableData.length"
<el-table v-if="chipTableData.length"
:data="chipTableData"
:data="chipTableData"
width="100%"
width="100%"
height="100%">
height="100%"
:row-class-name="tableRowClassName">
<el-table-column width="120">
<el-table-column width="120">
<template slot="header">
<template slot="header">
<span class="cl-text-center">
<span class="cl-text-center">
@@ -76,8 +78,10 @@ limitations under the License.
<template slot-scope="scope">
<template slot-scope="scope">
<span class="cl-text-center">
<span class="cl-text-center">
<i class="el-icon-success"
<i class="el-icon-success"
v-if="scope.row.available"></i>
v-if="scope.row.available"
:title="$t('hardwareVisual.availableFree')"></i>
<i class="el-icon-question"
<i class="el-icon-question"
:title="$t('hardwareVisual.availableBusy')"
v-else></i>
v-else></i>
</span>
</span>
</template>
</template>
@@ -97,15 +101,20 @@ limitations under the License.
<template slot-scope="scope">
<template slot-scope="scope">
<span class="cl-text-center">
<span class="cl-text-center">
<i class="el-icon-success"
<i class="el-icon-success"
v-if="scope.row.health===0"></i>
v-if="scope.row.health===0"
:title="$t('hardwareVisual.normal')"></i>
<i class="el-icon-warning normal"
<i class="el-icon-warning normal"
v-if="scope.row.health===1"></i>
v-if="scope.row.health===1"
:title="$t('hardwareVisual.generalWarn')"></i>
<i class="el-icon-warning important"
<i class="el-icon-warning important"
v-if="scope.row.health===2"></i>
v-if="scope.row.health===2"
:title="$t('hardwareVisual.importantWarn')"></i>
<i class="el-icon-warning emergency"
<i class="el-icon-warning emergency"
v-if="scope.row.health===3"></i>
v-if="scope.row.health===3"
:title="$t('hardwareVisual.emergencyWarn')"></i>
<i class="el-icon-remove"
<i class="el-icon-remove"
v-if="scope.row.health=== 0xffffffff"></i>
v-if="scope.row.health=== 0xffffffff"
:title="$t('hardwareVisual.noChip')"></i>
</span>
</span>
</template>
</template>
</el-table-column>
</el-table-column>
@@ -136,8 +145,10 @@ limitations under the License.
</el-tooltip>
</el-tooltip>
</template>
</template>
<template slot-scope="scope">
<template slot-scope="scope">
<el-progress :percentage="scope.row.aicore_rate"
:format="format"></el-progress>
<div class="core-wrap">
<el-progress :percentage="scope.row.aicore_rate===-1?0:scope.row.aicore_rate"
:format="format(scope.row.aicore_rate)"></el-progress>
</div>
</template>
</template>
</el-table-column>
</el-table-column>
@@ -154,8 +165,8 @@ limitations under the License.
</template>
</template>
<template slot-scope="scope">
<template slot-scope="scope">
<div class="hbs-wrap">
<div class="hbs-wrap">
<el-progress :percentage="
parseInt(scope.row.hbm_info.memory_usage/scope.row.hbm_info.memory_size*100)"
<el-progress :percentage="scope.row.hbm_info.memory_size?
parseInt(scope.row.hbm_info.memory_usage/scope.row.hbm_info.memory_size*100):0 "
:format="formatHbm(scope.row.hbm_info)"></el-progress>
:format="formatHbm(scope.row.hbm_info)"></el-progress>
</div>
</div>
</template>
</template>
@@ -195,7 +206,7 @@ limitations under the License.
:class="{zero:!scope.row.temperature}"></div>
:class="{zero:!scope.row.temperature}"></div>
<div class="process-wrap">
<div class="process-wrap">
<div class="process-cover"
<div class="process-cover"
:style="{width:scope.row.temperature/temperatureMax*100+'%'}"></div>
:style="{width:temperatureMax? scope.row.temperature/temperatureMax*100+'%':0 }"></div>
</div>
</div>
<span>{{scope.row.temperature}}</span>
<span>{{scope.row.temperature}}</span>
</div>
</div>
@@ -213,7 +224,8 @@ limitations under the License.
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cl-hardware-bottom">
<div class="cl-hardware-bottom"
:class="{noNpu:!chipTableData.length}">
<div class="cl-hardware-left">
<div class="cl-hardware-left">
<div class="cl-sub-title">
<div class="cl-sub-title">
CPU
CPU
@@ -314,7 +326,7 @@ export default {
overallCpuInfo: [],
overallCpuInfo: [],
selectedCpuInfo: [],
selectedCpuInfo: [],
selectedCpuIndex: null,
selectedCpuIndex: null,
pieColorArr: ['#5e7ce0', '#a6dd82'],
pieColorArr: ['#5e7ce0', '#ccc', '# a6dd82'],
autoUpdateTimer: null, // Automatic refresh timer
autoUpdateTimer: null, // Automatic refresh timer
isReloading: false, // Manually refresh
isReloading: false, // Manually refresh
};
};
@@ -410,10 +422,14 @@ export default {
}
}
if (res && res.data) {
if (res && res.data) {
this.chipTableData = res.data.npu || [];
this.chipTableData = res.data.npu || [];
if (this.chipTableData.length === 0) {
this.defaultCpuNum = 192;
}
this.powerMax =
this.powerMax =
Math.max(...this.chipTableData.map((val) => val.power)) * 1.2;
Math.max(...this.chipTableData.map((val) => val.power)) * 1.2;
this.temperatureMax =
this.temperatureMax =
Math.max(...this.chipTableData.map((val) => val.temperature)) * 1.2;
Math.max(...this.chipTableData.map((val) => val.temperature)) *
1.2;
// 1.2 In order to Demonstrated effect
// 1.2 In order to Demonstrated effect
if (res.data.memory && res.data.memory.virtual) {
if (res.data.memory && res.data.memory.virtual) {
this.dealChartData(this.virtualChart, res.data.memory.virtual);
this.dealChartData(this.virtualChart, res.data.memory.virtual);
@@ -439,6 +455,17 @@ export default {
} else {
} else {
this.selectedCpuInfo = [];
this.selectedCpuInfo = [];
}
}
this.$nextTick(() => {
const doms = document.querySelectorAll('.fail-row');
if (doms) {
for (let i = 0; i < doms.length; i++) {
doms[i].setAttribute(
'title',
this.$t('hardwareVisual.failQueryChip'),
);
}
}
});
}
}
}
}
},
},
@@ -452,6 +479,12 @@ export default {
},
},
);
);
},
},
tableRowClassName({row, rowIndex}) {
if (!row.success) {
return 'fail-row';
}
return '';
},
/**
/**
* add tips
* add tips
* @param {Array} arr cpu Info
* @param {Array} arr cpu Info
@@ -507,14 +540,21 @@ export default {
if (val.idle !== undefined) {
if (val.idle !== undefined) {
if (index === key) {
if (index === key) {
this.selectedCpuIndex = key;
this.selectedCpuIndex = key;
val.selected = true;
this.selectedCpuInfo = Object.keys(this.cpuList[index]).map((val) => {
return {
label: val,
value: this.cpuList[index][val],
};
});
this.selectedCpuInfo.pop();
val.selected = !val.selected;
if (val.selected) {
this.selectedCpuInfo = Object.keys(this.cpuList[index]).map(
(val) => {
return {
label: val,
value: this.cpuList[index][val],
};
},
);
this.selectedCpuInfo.pop();
} else {
this.selectedCpuIndex = null;
this.selectedCpuInfo = [];
}
} else {
} else {
if (this.cpuList[index].idle !== undefined) {
if (this.cpuList[index].idle !== undefined) {
val.selected = false;
val.selected = false;
@@ -530,9 +570,12 @@ export default {
* @param {Object} data chart data
* @param {Object} data chart data
*/
*/
dealChartData(chart, data) {
dealChartData(chart, data) {
const virtual = Object.keys(data);
chart.legend = virtual.reverse();
chart.data = virtual.map((val) => {
if (data.others === 0) {
chart.legend = ['used', 'available'];
} else {
chart.legend = ['used', 'others', 'available'];
}
chart.data = chart.legend.map((val) => {
return {
return {
value: data[val],
value: data[val],
name: val,
name: val,
@@ -565,7 +608,11 @@ export default {
return `${n}`;
return `${n}`;
},
},
format(percentage, item) {
format(percentage, item) {
return `${percentage}`;
return () => {
return percentage === -1
? this.$t('hardwareVisual.faliQuery')
: `${percentage}`;
};
},
},
formatHbm(hbmInfo) {
formatHbm(hbmInfo) {
return function() {
return function() {
@@ -639,7 +686,7 @@ export default {
name: '',
name: '',
center: ['25%', '50%'],
center: ['25%', '50%'],
type: 'pie',
type: 'pie',
radius: ['40%', '60%'],
radius: this.chipTableData.length ? ['40%', '60%'] : ['30%', '4 0%'],
avoidLabelOverlap: false,
avoidLabelOverlap: false,
label: {
label: {
show: true,
show: true,
@@ -739,7 +786,7 @@ export default {
height: calc(100% - 36px);
height: calc(100% - 36px);
overflow: auto;
overflow: auto;
.el-icon-question::before {
.el-icon-question::before {
color: red ;
color: #f06281 ;
}
}
.el-icon-success:before {
.el-icon-success:before {
color: #57d7ac;
color: #57d7ac;
@@ -797,6 +844,12 @@ export default {
margin-right: -145px;
margin-right: -145px;
}
}
}
}
.core-wrap {
.el-progress-bar {
padding-right: 80px;
margin-right: -85px;
}
}
.power {
.power {
background: #e5f6f6;
background: #e5f6f6;
padding-left: 10px;
padding-left: 10px;
@@ -873,6 +926,13 @@ export default {
}
}
}
}
}
}
.cl-hardware-bottom.noNpu {
padding-top: 16px;
height: 570px;
.cl-cpu-wrap {
height: 399px;
}
}
.el-table thead tr {
.el-table thead tr {
background: #f0f3fa;
background: #f0f3fa;
}
}
@@ -905,5 +965,9 @@ export default {
.el-icon-info:before {
.el-icon-info:before {
color: #6c7280;
color: #6c7280;
}
}
.el-table .fail-row {
opacity: 0.24;
filter: grayscale(1);
}
}
}
</style>
</style>