环境变量值超出显示...

This commit is contained in:
hanhh 2021-07-03 16:25:13 +08:00
parent 41c3f21863
commit 53123af832
4 changed files with 83 additions and 67 deletions

View File

@ -12,13 +12,13 @@ const initData = [
6, 6,
1, 1,
).toString()} * * *`, ).toString()} * * *`,
status: CrontabStatus.disabled, isDisabled: 1,
}, },
{ {
name: '删除日志', name: '删除日志',
command: 'ql rmlog 7', command: 'ql rmlog 7',
schedule: '30 7 */7 * *', schedule: '30 7 */7 * *',
status: CrontabStatus.disabled, isDisabled: 1,
}, },
]; ];
@ -29,7 +29,7 @@ export default async () => {
cronDb.count({}, async (err, count) => { cronDb.count({}, async (err, count) => {
if (count === 0) { if (count === 0) {
const data = initData.map((x) => { const data = initData.map((x: any) => {
const tab = new Crontab(x); const tab = new Crontab(x);
tab.created = new Date().valueOf(); tab.created = new Date().valueOf();
tab.saved = false; tab.saved = false;

View File

@ -36,6 +36,17 @@ body {
} }
} }
.ant-table-cell-ellipsis {
text-align: left !important;
}
.ant-tooltip {
max-width: 500px;
.ant-tooltip-inner {
word-break: break-all;
}
}
.env-wrapper { .env-wrapper {
th { th {
white-space: nowrap; white-space: nowrap;

View File

@ -137,10 +137,12 @@ const Crontab = () => {
title: '操作', title: '操作',
key: 'action', key: 'action',
align: 'center' as const, align: 'center' as const,
render: (text: string, record: any, index: number) => ( render: (text: string, record: any, index: number) => {
const isPc = width === '100%';
return (
<Space size="middle"> <Space size="middle">
{record.status === CrontabStatus.idle && ( {record.status === CrontabStatus.idle && (
<Tooltip title="运行"> <Tooltip title={isPc ? '运行' : ''}>
<a <a
onClick={() => { onClick={() => {
runCron(record, index); runCron(record, index);
@ -151,7 +153,7 @@ const Crontab = () => {
</Tooltip> </Tooltip>
)} )}
{record.status !== CrontabStatus.idle && ( {record.status !== CrontabStatus.idle && (
<Tooltip title="停止"> <Tooltip title={isPc ? '停止' : ''}>
<a <a
onClick={() => { onClick={() => {
stopCron(record, index); stopCron(record, index);
@ -161,7 +163,7 @@ const Crontab = () => {
</a> </a>
</Tooltip> </Tooltip>
)} )}
<Tooltip title="日志"> <Tooltip title={isPc ? '日志' : ''}>
<a <a
onClick={() => { onClick={() => {
setLogCron({ ...record, timestamp: Date.now() }); setLogCron({ ...record, timestamp: Date.now() });
@ -172,7 +174,8 @@ const Crontab = () => {
</Tooltip> </Tooltip>
<MoreBtn key="more" record={record} index={index} /> <MoreBtn key="more" record={record} index={index} />
</Space> </Space>
), );
},
}, },
]; ];

View File

@ -124,19 +124,14 @@ const Env = () => {
key: 'value', key: 'value',
align: 'center' as const, align: 'center' as const,
width: '45%', width: '45%',
ellipsis: {
showTitle: false,
},
render: (text: string, record: any) => { render: (text: string, record: any) => {
return ( return (
<span <Tooltip placement="topLeft" title={text}>
style={{ <span>{text}</span>
textAlign: 'left', </Tooltip>
display: 'inline-block',
wordBreak: 'break-all',
cursor: 'text',
width: '100%',
}}
>
{text}
</span>
); );
}, },
}, },
@ -166,14 +161,20 @@ const Env = () => {
title: '操作', title: '操作',
key: 'action', key: 'action',
align: 'center' as const, align: 'center' as const,
render: (text: string, record: any, index: number) => ( render: (text: string, record: any, index: number) => {
const isPc = width === '100%';
return (
<Space size="middle"> <Space size="middle">
<Tooltip title="编辑"> <Tooltip title={isPc ? '编辑' : ''}>
<a onClick={() => editEnv(record, index)}> <a onClick={() => editEnv(record, index)}>
<EditOutlined /> <EditOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title={record.status === Status. ? '启用' : '禁用'}> <Tooltip
title={
isPc ? (record.status === Status. ? '启用' : '禁用') : ''
}
>
<a onClick={() => enabledOrDisabledEnv(record, index)}> <a onClick={() => enabledOrDisabledEnv(record, index)}>
{record.status === Status. ? ( {record.status === Status. ? (
<CheckCircleOutlined /> <CheckCircleOutlined />
@ -182,13 +183,14 @@ const Env = () => {
)} )}
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title="删除"> <Tooltip title={isPc ? '删除' : ''}>
<a onClick={() => deleteEnv(record, index)}> <a onClick={() => deleteEnv(record, index)}>
<DeleteOutlined /> <DeleteOutlined />
</a> </a>
</Tooltip> </Tooltip>
</Space> </Space>
), );
},
}, },
]; ];
const [width, setWidth] = useState('100%'); const [width, setWidth] = useState('100%');