修改定时任务打开详情交互

This commit is contained in:
whyour 2022-09-06 14:49:42 +08:00
parent 8d24949202
commit 6f5a5fe066
2 changed files with 20 additions and 29 deletions

View File

@ -2,12 +2,6 @@
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
.cron {
&:hover {
cursor: pointer;
}
}
.crontab-detail { .crontab-detail {
.card-wrapper { .card-wrapper {
height: 80vh; height: 80vh;

View File

@ -93,10 +93,11 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
<> <>
<a <a
onClick={() => { onClick={() => {
goToScriptManager(record); setDetailCron(record);
setIsDetailModalVisible(true);
}} }}
> >
{record.labels?.length > 0 && record.labels[0] !== '' ? ( {record.labels?.length > 0 && record.labels[0] !== '' && false ? (
<Popover <Popover
placement="right" placement="right"
trigger={isPhone ? 'click' : 'hover'} trigger={isPhone ? 'click' : 'hover'}
@ -109,6 +110,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
setSearchValue(`label:${label}`); setSearchValue(`label:${label}`);
setSearchText(`label:${label}`);
}} }}
> >
<a>{label}</a> <a>{label}</a>
@ -140,7 +142,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
title: '命令', title: '命令',
dataIndex: 'command', dataIndex: 'command',
key: 'command', key: 'command',
width: 250, width: 300,
align: 'center' as const, align: 'center' as const,
render: (text: string, record: any) => { render: (text: string, record: any) => {
return ( return (
@ -151,8 +153,14 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
textAlign: 'left', textAlign: 'left',
}} }}
ellipsis={{ tooltip: text, rows: 2 }} ellipsis={{ tooltip: text, rows: 2 }}
>
<a
onClick={() => {
goToScriptManager(record);
}}
> >
{text} {text}
</a>
</Paragraph> </Paragraph>
); );
}, },
@ -396,8 +404,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
const { page, size, sorter } = pageConf; const { page, size, sorter } = pageConf;
let url = `${config.apiPrefix}crons?searchValue=${searchText}&page=${page}&size=${size}`; let url = `${config.apiPrefix}crons?searchValue=${searchText}&page=${page}&size=${size}`;
if (sorter && sorter.field) { if (sorter && sorter.field) {
url += `&sortField=${sorter.field}&sortType=${ url += `&sortField=${sorter.field}&sortType=${sorter.order === 'ascend' ? 'ASC' : 'DESC'
sorter.order === 'ascend' ? 'ASC' : 'DESC'
}`; }`;
} }
if (viewConf) { if (viewConf) {
@ -562,8 +569,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
onOk() { onOk() {
request request
.put( .put(
`${config.apiPrefix}crons/${ `${config.apiPrefix}crons/${record.isDisabled === 1 ? 'enable' : 'disable'
record.isDisabled === 1 ? 'enable' : 'disable'
}`, }`,
{ {
data: [record.id], data: [record.id],
@ -608,8 +614,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
onOk() { onOk() {
request request
.put( .put(
`${config.apiPrefix}crons/${ `${config.apiPrefix}crons/${record.isPinned === 1 ? 'unpin' : 'pin'
record.isPinned === 1 ? 'unpin' : 'pin'
}`, }`,
{ {
data: [record.id], data: [record.id],
@ -931,14 +936,6 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
(a, b) => a - b, (a, b) => a - b,
), ),
}} }}
onRow={(record) => {
return {
onClick: (event) => {
setDetailCron(record);
setIsDetailModalVisible(true);
},
};
}}
dataSource={value} dataSource={value}
rowKey="id" rowKey="id"
size="middle" size="middle"