1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

feat: 计划任务列表增加上次执行状态 (#6722)

Refs #6212 #6197
This commit is contained in:
ssongliu 2024-10-15 16:07:22 +08:00 committed by GitHub
parent 86bf7ea73a
commit c8971dd0ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 35 additions and 6 deletions

View File

@ -115,9 +115,10 @@ type CronjobInfo struct {
DownloadAccountID uint `json:"downloadAccountID"`
RetainCopies int `json:"retainCopies"`
LastRecordTime string `json:"lastRecordTime"`
Status string `json:"status"`
Secret string `json:"secret"`
LastRecordStatus string `json:"lastRecordStatus"`
LastRecordTime string `json:"lastRecordTime"`
Status string `json:"status"`
Secret string `json:"secret"`
}
type SearchRecord struct {

View File

@ -50,6 +50,7 @@ func (u *CronjobService) SearchWithPage(search dto.PageCronjob) (int64, interfac
}
record, _ := cronjobRepo.RecordFirst(cronjob.ID)
if record.ID != 0 {
item.LastRecordStatus = record.Status
item.LastRecordTime = record.StartTime.Format(constant.DateTimeLayout)
} else {
item.LastRecordTime = "-"

View File

@ -873,7 +873,7 @@ const message = {
website: 'Backup Website',
rulesHelper:
'When there are multiple compression exclusion rules, they need to be displayed with line breaks. For example: \n*.log \n*.sql',
lastRecordTime: 'Last Execution Time',
lastRecordTime: 'Last Execution',
all: 'All',
failedRecord: 'Failed Records',
successRecord: 'Successful Records',
@ -957,6 +957,8 @@ const message = {
today: 'Today',
yesterday: 'Yesterday',
lastNDay: 'Last {0} day',
lastNMonth: 'Last {0} months',
lastHalfYear: 'Last half year',
memory: 'Memory',
cache: 'Cache',
disk: 'Disk',

View File

@ -833,7 +833,7 @@ const message = {
app: '備份應用',
website: '備份網站',
rulesHelper: '當存在多個壓縮排除規則時需要換行顯示\n*.log \n*.sql',
lastRecordTime: '上次執行時間',
lastRecordTime: '上次執行情況',
database: '備份數據庫',
missBackupAccount: '未能找到備份賬號',
syncDate: '同步時間 ',
@ -912,6 +912,8 @@ const message = {
today: '今天',
yesterday: '昨天',
lastNDay: ' {0} ',
lastNMonth: ' {0} ',
lastHalfYear: '近半年',
memory: '內存',
cache: '緩存',
disk: '磁盤',

View File

@ -834,7 +834,7 @@ const message = {
app: '备份应用',
website: '备份网站',
rulesHelper: '当存在多个压缩排除规则时需要换行显示\n*.log \n*.sql',
lastRecordTime: '上次执行时间',
lastRecordTime: '上次执行情况',
database: '备份数据库',
missBackupAccount: '未能找到备份账号',
syncDate: '同步时间 ',
@ -913,6 +913,8 @@ const message = {
today: '今天',
yesterday: '昨天',
lastNDay: ' {0} ',
lastNMonth: ' {0} ',
lastHalfYear: '近半年',
memory: '内存',
cache: '缓存',
disk: '磁盘',

View File

@ -42,4 +42,22 @@ export const shortcuts = [
return [start, end];
},
},
{
text: i18n.global.t('monitor.lastNMonth', [3]),
value: () => {
const end = new Date();
const start = new Date(end);
start.setMonth(end.getMonth() - 3);
return [start, end];
},
},
{
text: i18n.global.t('monitor.lastHalfYear', [30]),
value: () => {
const end = new Date();
const start = new Date(end);
start.setMonth(end.getMonth() - 6);
return [start, end];
},
},
];

View File

@ -105,6 +105,9 @@
</el-table-column>
<el-table-column :label="$t('cronjob.lastRecordTime')" :min-width="120" prop="lastRecordTime">
<template #default="{ row }">
<el-button v-if="row.lastRecordStatus === 'Success'" icon="Select" link type="success" />
<el-button v-if="row.lastRecordStatus === 'Failed'" icon="CloseBold" link type="danger" />
<el-button v-if="row.lastRecordStatus === 'Waiting'" icon="SemiSelect" link type="info" />
{{ row.lastRecordTime }}
</template>
</el-table-column>