From b8480e4928c4ed1fa5e86d2b6985edc78108ddcf Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 10 Aug 2023 10:40:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=BC=96=E8=BE=91=E9=94=99=E8=AF=AF=20(#1902?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/cornjob.go | 9 --------- frontend/src/views/cronjob/record/index.vue | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) 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();