From 53123af832102badb7286e6b11433f6bbdc9e2eb Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Sat, 3 Jul 2021 16:25:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E5=80=BC?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E6=98=BE=E7=A4=BA...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 6 ++-- src/layouts/index.less | 11 ++++++ src/pages/crontab/index.tsx | 63 +++++++++++++++++---------------- src/pages/env/index.tsx | 70 +++++++++++++++++++------------------ 4 files changed, 83 insertions(+), 67 deletions(-) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index 06d35d42..243e9513 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -12,13 +12,13 @@ const initData = [ 6, 1, ).toString()} * * *`, - status: CrontabStatus.disabled, + isDisabled: 1, }, { name: '删除日志', command: 'ql rmlog 7', schedule: '30 7 */7 * *', - status: CrontabStatus.disabled, + isDisabled: 1, }, ]; @@ -29,7 +29,7 @@ export default async () => { cronDb.count({}, async (err, count) => { if (count === 0) { - const data = initData.map((x) => { + const data = initData.map((x: any) => { const tab = new Crontab(x); tab.created = new Date().valueOf(); tab.saved = false; diff --git a/src/layouts/index.less b/src/layouts/index.less index f276b33e..d5f2460c 100644 --- a/src/layouts/index.less +++ b/src/layouts/index.less @@ -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 { th { white-space: nowrap; diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index f527d688..23b3f318 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -137,42 +137,45 @@ const Crontab = () => { title: '操作', key: 'action', align: 'center' as const, - render: (text: string, record: any, index: number) => ( - - {record.status === CrontabStatus.idle && ( - + render: (text: string, record: any, index: number) => { + const isPc = width === '100%'; + return ( + + {record.status === CrontabStatus.idle && ( + + { + runCron(record, index); + }} + > + + + + )} + {record.status !== CrontabStatus.idle && ( + + { + stopCron(record, index); + }} + > + + + + )} + { - runCron(record, index); + setLogCron({ ...record, timestamp: Date.now() }); }} > - + - )} - {record.status !== CrontabStatus.idle && ( - - { - stopCron(record, index); - }} - > - - - - )} - - { - setLogCron({ ...record, timestamp: Date.now() }); - }} - > - - - - - - ), + + + ); + }, }, ]; diff --git a/src/pages/env/index.tsx b/src/pages/env/index.tsx index 2e9e134b..78ee6b2f 100644 --- a/src/pages/env/index.tsx +++ b/src/pages/env/index.tsx @@ -124,19 +124,14 @@ const Env = () => { key: 'value', align: 'center' as const, width: '45%', + ellipsis: { + showTitle: false, + }, render: (text: string, record: any) => { return ( - - {text} - + + {text} + ); }, }, @@ -166,29 +161,36 @@ const Env = () => { title: '操作', key: 'action', align: 'center' as const, - render: (text: string, record: any, index: number) => ( - - - editEnv(record, index)}> - - - - - enabledOrDisabledEnv(record, index)}> - {record.status === Status.已禁用 ? ( - - ) : ( - - )} - - - - deleteEnv(record, index)}> - - - - - ), + render: (text: string, record: any, index: number) => { + const isPc = width === '100%'; + return ( + + + editEnv(record, index)}> + + + + + enabledOrDisabledEnv(record, index)}> + {record.status === Status.已禁用 ? ( + + ) : ( + + )} + + + + deleteEnv(record, index)}> + + + + + ); + }, }, ]; const [width, setWidth] = useState('100%');