Skip to content

Commit 8f4ff36

Browse files
committed
fix: 优化 Topic 扩分区名称 & 描述展示
1 parent 47b6b35 commit 8f4ff36

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

km-console/packages/layout-clusters-fe/src/pages/TopicList/ExpandPartition.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { useEffect, useState } from 'react';
22
import { useParams } from 'react-router-dom';
3-
import { AppContainer, Button, Divider, Drawer, Form, InputNumber, notification, SingleChart, Space, Spin, Utils } from 'knowdesign';
3+
import { AppContainer, Button, Divider, Drawer, Form, InputNumber, SingleChart, Space, Spin, Tooltip, Utils } from 'knowdesign';
4+
import notification from '@src/components/Notification';
45
import Api, { MetricType } from '@src/api/index';
5-
import { getBasicChartConfig, getUnit } from '@src/constants/chartConfig';
6-
import { formatChartData, MetricDefaultChartDataType } from '@src/constants/chartConfig';
6+
import { getBasicChartConfig, getDataUnit } from '@src/constants/chartConfig';
7+
import { formatChartData, OriginMetricData } from '@src/constants/chartConfig';
78

89
const ExpandPartition = (props: { record: any; onConfirm: () => void }) => {
910
const [global] = AppContainer.useGlobalValue();
@@ -60,7 +61,7 @@ const ExpandPartition = (props: { record: any; onConfirm: () => void }) => {
6061
);
6162
const empiricalMinValue = 10 * 1024 * record.partitionNum;
6263

63-
const lines = data.map((metric: MetricDefaultChartDataType) => {
64+
const lines = data.map((metric: OriginMetricData) => {
6465
const child = metric.metricLines[0];
6566
child.name = metric.metricName;
6667
return child;
@@ -87,7 +88,7 @@ const ExpandPartition = (props: { record: any; onConfirm: () => void }) => {
8788
});
8889
}, [expandPartitionsVisible]);
8990
const formattedMinBytesInOut = (v: number) => {
90-
const [unit, size] = getUnit(v);
91+
const [unit, size] = getDataUnit['Memory'](v);
9192
return `${(v / size).toFixed(2)}${unit}/s`;
9293
};
9394
return (
@@ -130,11 +131,15 @@ const ExpandPartition = (props: { record: any; onConfirm: () => void }) => {
130131
<div className="brief-info">
131132
<div className="item">
132133
<span className="field">Topic名称 :</span>
133-
<span className="val">{record.topicName}</span>
134+
<Tooltip title={record.topicName}>
135+
<span className="val">{record.topicName}</span>
136+
</Tooltip>
134137
</div>
135138
<div className="item">
136139
<span className="field desc-field">描述 :</span>
137-
<span className="val desc-val">{record.description}</span>
140+
<Tooltip title={record.description || '-'}>
141+
<span className="desc-val">{record.description || '-'}</span>
142+
</Tooltip>
138143
</div>
139144
</div>
140145
<Spin spinning={loading}>

km-console/packages/layout-clusters-fe/src/pages/TopicList/index.less

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,36 @@
142142
color: #74788d;
143143
}
144144
.desc-field {
145+
flex-shrink: 0;
145146
width: 34px;
146147
}
147148
.val,
148149
.desc-val {
149150
color: #495057;
150151
letter-spacing: 0;
151152
font-weight: 400;
153+
margin-left: 12px;
152154
}
153155
.val {
154-
width: 105px;
155-
margin-left: 12px;
156+
max-width: 208px;
157+
overflow: hidden;
158+
text-overflow: ellipsis;
159+
white-space: nowrap;
156160
}
157161
.desc-val {
158-
width: 809px;
159162
height: 36px;
163+
display: -webkit-box;
160164
overflow: hidden;
161-
-webkit-box-orient: vertical;
165+
text-overflow: ellipsis;
162166
-webkit-line-clamp: 2;
167+
-webkit-box-orient: vertical;
168+
word-break: break-all;
169+
}
170+
&:first-child {
171+
margin-right: 40px;
172+
}
173+
&:last-child {
174+
flex: 1;
163175
}
164176
}
165177
}

0 commit comments

Comments
 (0)