mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 00:09:16 +08:00
fix: 解决计划任务编辑错误 (#1902)
This commit is contained in:
parent
1ff39d7b85
commit
b8480e4928
@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||
@ -55,14 +54,6 @@ func (u *CronjobService) SearchWithPage(search dto.SearchWithPage) (int64, inter
|
||||
} else {
|
||||
item.TargetDir = "-"
|
||||
}
|
||||
if item.Type == "database" && item.DBName != "all" {
|
||||
itemID, _ := strconv.Atoi(item.DBName)
|
||||
dbItem, err := mysqlRepo.Get(commonRepo.WithByID(uint(itemID)))
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
item.DBName = dbItem.Name
|
||||
}
|
||||
record, _ := cronjobRepo.RecordFirst(cronjob.ID)
|
||||
if record.ID != 0 {
|
||||
item.LastRecordTime = record.StartTime.Format("2006-01-02 15:04:05")
|
||||
|
@ -374,6 +374,7 @@ import { Codemirror } from 'vue-codemirror';
|
||||
import { javascript } from '@codemirror/lang-javascript';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import { MsgError, MsgInfo, MsgSuccess } from '@/utils/message';
|
||||
import { loadDBOptions } from '@/api/modules/database';
|
||||
|
||||
const loading = ref();
|
||||
const refresh = ref(false);
|
||||
@ -400,6 +401,20 @@ const cleanData = ref();
|
||||
const acceptParams = async (params: DialogProps): Promise<void> => {
|
||||
recordShow.value = true;
|
||||
dialogData.value = params;
|
||||
if (dialogData.value.rowData.type === 'database') {
|
||||
const data = await loadDBOptions();
|
||||
let itemDBs = data.data || [];
|
||||
for (const item of itemDBs) {
|
||||
if (item.id == dialogData.value.rowData.dbName) {
|
||||
if (item.from === 'local') {
|
||||
dialogData.value.rowData.dbName = i18n.global.t('database.localDB') + ' [' + item.name + ']';
|
||||
} else {
|
||||
dialogData.value.rowData.dbName = item.from + ' [' + item.name + ']';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
search();
|
||||
timer = setInterval(() => {
|
||||
search();
|
||||
|
Loading…
x
Reference in New Issue
Block a user