更改标签展示

This commit is contained in:
kilo5hz 2022-01-06 15:59:58 +08:00
parent 133481053e
commit 1eb8e263f7

View File

@ -11,6 +11,7 @@ import {
Menu,
Typography,
Input,
Popover,
} from 'antd';
import {
ClockCircleOutlined,
@ -77,6 +78,7 @@ const Crontab = ({ headerStyle, isPhone }: any) => {
width: 150,
align: 'center' as const,
render: (text: string, record: any) => (
<>
<a
onClick={() => {
goToScriptManager(record);
@ -91,6 +93,24 @@ const Crontab = ({ headerStyle, isPhone }: any) => {
''
)}
</a>
<span>
{record.labels?.length > 0 && record.labels[0] !== '' ?
<Popover placement='right' trigger={isPhone ? 'click' : 'hover'}
content={
<div>
{record.labels?.map((label: string, i: number) => (
<Tag color="blue"
onClick={() => { onSearch(`label:${label}`) }}>
{label}
</Tag>
))}
</div>
}>
<Tag color="blue">{record.labels[0]}</Tag>
</Popover>
: ''}
</span>
</>
),
sorter: {
compare: (a: any, b: any) => a.name.localeCompare(b.name),
@ -275,26 +295,6 @@ const Crontab = ({ headerStyle, isPhone }: any) => {
</>
),
},
{
title: '标签',
key: 'labels',
dataIndex: 'labels',
align: 'center' as const,
width: 100,
render: (text: string, record: any) => (
<>
{record.labels?.map((label: string) => (
<Tag style={{
width: label.replace(/[^\x00-\xff]/g,"01").length < 5 ? 40:90,
overflow:'hidden',
textOverflow:'ellipsis',
}}
color="blue"
onClick={() => { onSearch(`label:${label}`) }}>{label}</Tag>
))}
</>
),
},
{
title: '操作',
key: 'action',