Skip to content

Commit f1fe1f2

Browse files
authored
Merge pull request #87 from Shenhan11/fix/node-detail-ui
optimize node detail page chart display&fix internationalization issue of time retriever
2 parents 701e867 + 523dc4c commit f1fe1f2

7 files changed

Lines changed: 32 additions & 27 deletions

File tree

packages/web/projects/vgpu/views/card/admin/Detail.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ watch(
597597
598598
li {
599599
display: flex;
600-
align-items: flex-start;
600+
align-items: center;
601601
min-width: 0;
602602
}
603603
@@ -616,7 +616,7 @@ watch(
616616
font-size: 14px;
617617
line-height: 22px;
618618
display: inline-flex;
619-
align-items: flex-start;
619+
align-items: center;
620620
min-width: 0;
621621
}
622622
@@ -625,7 +625,7 @@ watch(
625625
&.is-en {
626626
.card-detail-info {
627627
.label {
628-
width: 90px;
628+
width: 110px;
629629
}
630630
}
631631
}

packages/web/projects/vgpu/views/node/admin/Detail.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,25 @@
134134
<trend-time-filter v-model="times" />
135135

136136
<div class="line-box">
137-
<block-box :title="$t('node.detail.resourceAllocTrend')">
137+
<block-box :title="$t('dashboard.gpuComputeAllocUsageTrend')">
138138
<div class="trend-chart">
139139
<echarts-plus
140140
:options="
141141
getRangeOptions({
142-
core: gaugeConfig[0].data,
143-
memory: gaugeConfig[1].data,
142+
allocation: gaugeConfig[0].data,
143+
usage: gaugeConfig[2].data,
144144
}, t)
145145
"
146146
/>
147147
</div>
148148
</block-box>
149-
<block-box :title="$t('node.detail.resourceUsageTrend')">
149+
<block-box :title="$t('dashboard.gpuMemAllocUsageTrend')">
150150
<div class="trend-chart">
151151
<echarts-plus
152152
:options="
153153
getRangeOptions({
154-
core: gaugeConfig[2].data,
155-
memory: gaugeConfig[3].data,
154+
allocation: gaugeConfig[1].data,
155+
usage: gaugeConfig[3].data,
156156
}, t)
157157
"
158158
/>

packages/web/projects/vgpu/views/node/admin/getOptions.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
import { timeParse } from '@/utils';
22

3-
export const getRangeOptions = ({ core = [], memory = [] }, t = (v) => v) => {
3+
export const getRangeOptions = ({ allocation = [], usage = [] }, t = (v) => v) => {
4+
const xDataSource = allocation?.length ? allocation : usage;
45
return {
56
legend: {
6-
bottom: 0,
7-
orient: 'horizontal',
7+
bottom: 10,
8+
left: 'center',
89
},
910
tooltip: {
1011
trigger: 'axis',
1112
axisPointer: {
1213
type: 'cross',
1314
},
1415
formatter: function (params) {
16+
if (!params || params.length === 0) return '';
1517
var res = params[0].name + '<br/>';
1618
for (var i = 0; i < params.length; i++) {
1719
res +=
1820
params[i].marker +
1921
params[i].seriesName +
2022
' : ' +
2123
(+params[i].value).toFixed(0) +
22-
`%<br/>`;
24+
'<br/>';
2325
}
2426

2527
return res;
@@ -28,12 +30,12 @@ export const getRangeOptions = ({ core = [], memory = [] }, t = (v) => v) => {
2830
grid: {
2931
top: 20, // 上边距
3032
bottom: 60, // 下边距
31-
left: '8%', // 左边距
33+
left: '7%', // 左边距
3234
right: 10, // 右边距
3335
},
3436
xAxis: {
3537
type: 'category',
36-
data: core.map((item) => timeParse(+item.timestamp)),
38+
data: xDataSource.map((item) => timeParse(+item.timestamp)),
3739
axisLabel: {
3840
formatter: function (value) {
3941
return timeParse(value, 'HH:mm');
@@ -44,31 +46,31 @@ export const getRangeOptions = ({ core = [], memory = [] }, t = (v) => v) => {
4446
type: 'value',
4547
axisLabel: {
4648
formatter: function (value) {
47-
return `${value} %`;
49+
return `${value}`;
4850
},
4951
},
5052
},
5153
series: [
5254
{
53-
name: t('dashboard.compute'),
54-
data: core,
55+
name: t('dashboard.allocRateLegend'),
56+
data: allocation,
5557
type: 'line',
5658
itemStyle: {
57-
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
59+
color: 'rgb(84, 112, 198)',
5860
},
5961
lineStyle: {
60-
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
62+
color: 'rgb(84, 112, 198)',
6163
},
6264
},
6365
{
64-
name: t('dashboard.memory'),
65-
data: memory,
66+
name: t('dashboard.usageRateLegend'),
67+
data: usage,
6668
type: 'line',
6769
itemStyle: {
68-
color: 'rgb(145, 204, 117)', // 设置线条颜色为橙色
70+
color: 'rgb(145, 204, 117)',
6971
},
7072
lineStyle: {
71-
color: 'rgb(145, 204, 117)', // 设置线条颜色为橙色
73+
color: 'rgb(145, 204, 117)',
7274
},
7375
},
7476
],

packages/web/src/components/TrendTimeFilter.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<t-date-range-picker
1010
v-if="showCustomDateRangePicker"
1111
v-model="customDateRange"
12+
:placeholder="[t('common.pleaseSelectDate'), t('common.pleaseSelectDate')]"
1213
:separator="t('common.to')"
1314
enable-time-picker
1415
allow-input

packages/web/src/layout/components/TopBar/logo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class="navbar__icon"
88
/>
99
</div>
10-
<b class="navbar__title text--truncate">HAMi</b>
10+
<b class="navbar__title text--truncate">HAMi WebUI</b>
1111
</a>
1212
</template>
1313

packages/web/src/locales/en.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121
search: 'Search',
2222
reset: 'Reset',
2323
pleaseSelect: 'Please select',
24+
pleaseSelectDate: 'Please select date',
2425
pleaseInput: 'Please enter',
2526
advanced: 'Advanced',
2627
operation: 'Operation',
@@ -242,8 +243,8 @@ export default {
242243
appName: 'App Name',
243244
createTime: 'Creation Time',
244245
times: 'x',
245-
computeUsageTrend: 'Compute Usage Trend (%)',
246-
memUsageTrend: 'Memory Usage Trend (%)',
246+
computeUsageTrend: 'GPU Compute Usage Trend (%)',
247+
memUsageTrend: 'GPU Memory Usage Trend (%)',
247248
noMonitorSupport: 'Vendor does not support task-level monitoring',
248249
topCount: 'Workload Count Top5',
249250
topApply: 'Workload Requests Top5',

packages/web/src/locales/zh.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121
search: '搜索',
2222
reset: '重置',
2323
pleaseSelect: '请选择',
24+
pleaseSelectDate: '请选择日期',
2425
pleaseInput: '请输入',
2526
advanced: '高级',
2627
operation: '操作',

0 commit comments

Comments
 (0)