From 2d936f13412efefd1eb8ddfff38508ab80986790 Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 17 Aug 2023 08:26:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierignore | 2 +- src/pages/crontab/index.tsx | 64 +++++++++++++++----------------- src/pages/env/index.tsx | 38 ++++++++++++++----- src/pages/subscription/index.tsx | 50 +++++++++++-------------- 4 files changed, 81 insertions(+), 73 deletions(-) diff --git a/.prettierignore b/.prettierignore index ff7e524f..ce02f600 100644 --- a/.prettierignore +++ b/.prettierignore @@ -20,7 +20,7 @@ src/.umi src/.umi-production src/.umi-test .env.local -env +.env history version.ts config diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 5f617bd6..e0a62c7c 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -69,7 +69,7 @@ const Crontab = () => { dataIndex: 'name', key: 'name', fixed: 'left', - width: 120, + width: 140, render: (text: string, record: any) => ( <> { title: intl.get('命令/脚本'), dataIndex: 'command', key: 'command', - width: 200, + width: 220, render: (text, record) => { return ( { }, { title: intl.get('最后运行时长'), - width: 180, + width: 167, dataIndex: 'last_running_time', key: 'last_running_time', sorter: { @@ -232,7 +232,7 @@ const Crontab = () => { title: intl.get('最后运行时间'), dataIndex: 'last_execution_time', key: 'last_execution_time', - width: 150, + width: 141, sorter: { compare: (a, b) => { return (a.last_execution_time || 0) - (b.last_execution_time || 0); @@ -259,7 +259,7 @@ const Crontab = () => { }, { title: intl.get('下次运行时间'), - width: 150, + width: 144, sorter: { compare: (a: any, b: any) => { return a.nextRunTime - b.nextRunTime; @@ -276,7 +276,7 @@ const Crontab = () => { }, { title: intl.get('关联订阅'), - width: 190, + width: 185, render: (text, record: any) => record.sub_id ? ( { { title: intl.get('操作'), key: 'action', - width: 130, + width: 140, fixed: isPhone ? undefined : 'right', render: (text, record, index) => { const isPc = !isPhone; return ( {record.status === CrontabStatus.idle && ( - - { - e.stopPropagation(); - runCron(record, index); - }} - > - - - - )} - {record.status !== CrontabStatus.idle && ( - - { - e.stopPropagation(); - stopCron(record, index); - }} - > - - - - )} - { e.stopPropagation(); - setLogCron({ ...record, timestamp: Date.now() }); + runCron(record, index); }} > - + {intl.get('运行')} - + )} + {record.status !== CrontabStatus.idle && ( + { + e.stopPropagation(); + stopCron(record, index); + }} + > + {intl.get('停止')} + + )} + { + e.stopPropagation(); + setLogCron({ ...record, timestamp: Date.now() }); + }} + > + {intl.get('日志')} + ); @@ -1041,7 +1035,7 @@ const Crontab = () => { dataSource={value} rowKey="id" size="middle" - scroll={{ x: 1000, y: tableScrollHeight }} + scroll={{ x: 1200, y: tableScrollHeight }} loading={loading} rowSelection={rowSelection} rowClassName={getRowClassName} diff --git a/src/pages/env/index.tsx b/src/pages/env/index.tsx index b13b4a98..65d148bc 100644 --- a/src/pages/env/index.tsx +++ b/src/pages/env/index.tsx @@ -1,4 +1,4 @@ -import intl from 'react-intl-universal' +import intl from 'react-intl-universal'; import React, { useCallback, useRef, @@ -149,7 +149,7 @@ const Env = () => { title: intl.get('状态'), key: 'status', dataIndex: 'status', - width: 80, + width: 100, filters: [ { text: intl.get('已启用'), @@ -186,7 +186,11 @@ const Env = () => { enabledOrDisabledEnv(record, index)}> @@ -232,10 +236,15 @@ const Env = () => { const enabledOrDisabledEnv = (record: any, index: number) => { Modal.confirm({ - title: `确认${record.status === Status.已禁用 ? intl.get('启用') : intl.get('禁用')}`, + title: `确认${ + record.status === Status.已禁用 ? intl.get('启用') : intl.get('禁用') + }`, content: ( <> - {intl.get('确认')}{record.status === Status.已禁用 ? intl.get('启用') : intl.get('禁用')} + {intl.get('确认')} + {record.status === Status.已禁用 + ? intl.get('启用') + : intl.get('禁用')} Env{' '} {record.value} @@ -254,7 +263,11 @@ const Env = () => { .then(({ code, data }) => { if (code === 200) { message.success( - `${record.status === Status.已禁用 ? intl.get('启用') : intl.get('禁用')}${intl.get('成功')}`, + `${ + record.status === Status.已禁用 + ? intl.get('启用') + : intl.get('禁用') + }${intl.get('成功')}`, ); const newStatus = record.status === Status.已禁用 ? Status.已启用 : Status.已禁用; @@ -435,7 +448,13 @@ const Env = () => { const operateEnvs = (operationStatus: number) => { Modal.confirm({ title: `确认${OperationName[operationStatus]}`, - content: <>{intl.get('确认')}{OperationName[operationStatus]}{intl.get('选中的变量吗')}, + content: ( + <> + {intl.get('确认')} + {OperationName[operationStatus]} + {intl.get('选中的变量吗')} + + ), onOk() { request .put( @@ -567,7 +586,8 @@ const Env = () => { {intl.get('已选择')} - {selectedRowIds?.length}{intl.get('项')} + {selectedRowIds?.length} + {intl.get('项')} )} @@ -579,7 +599,7 @@ const Env = () => { dataSource={value} rowKey="id" size="middle" - scroll={{ x: 1000, y: tableScrollHeight }} + scroll={{ x: 1200, y: tableScrollHeight }} components={vt} loading={loading} onRow={(record: any, index: number | undefined) => { diff --git a/src/pages/subscription/index.tsx b/src/pages/subscription/index.tsx index d27577e7..948c2363 100644 --- a/src/pages/subscription/index.tsx +++ b/src/pages/subscription/index.tsx @@ -184,45 +184,39 @@ const Subscription = () => { { title: intl.get('操作'), key: 'action', - width: 130, + width: 140, render: (text: string, record: any, index: number) => { const isPc = !isPhone; return ( {record.status === SubscriptionStatus.idle && ( - - { - e.stopPropagation(); - runSubscription(record, index); - }} - > - - - - )} - {record.status !== SubscriptionStatus.idle && ( - - { - e.stopPropagation(); - stopSubsciption(record, index); - }} - > - - - - )} - { e.stopPropagation(); - setLogSubscription({ ...record, timestamp: Date.now() }); + runSubscription(record, index); }} > - + {intl.get('运行')} - + )} + {record.status !== SubscriptionStatus.idle && ( + { + e.stopPropagation(); + stopSubsciption(record, index); + }} + > + {intl.get('停止')} + + )} + { + e.stopPropagation(); + setLogSubscription({ ...record, timestamp: Date.now() }); + }} + > + {intl.get('日志')} + );