diff --git a/backend/app/service/cornjob.go b/backend/app/service/cornjob.go index 688c27b3a..8e6eb89de 100644 --- a/backend/app/service/cornjob.go +++ b/backend/app/service/cornjob.go @@ -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") diff --git a/frontend/src/views/cronjob/record/index.vue b/frontend/src/views/cronjob/record/index.vue index 55af27c44..e8d80b51c 100644 --- a/frontend/src/views/cronjob/record/index.vue +++ b/frontend/src/views/cronjob/record/index.vue @@ -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 => { 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();