mirror of
https://gitee.com/fit2cloud-feizhiyun/1Panel.git
synced 2024-12-02 03:48:02 +08:00
fix: 计划任务排除规则改为换行切割 (#1255)
This commit is contained in:
parent
5e3e580f51
commit
bb49a610a2
@ -195,7 +195,7 @@ func handleTar(sourceDir, targetDir, name, exclusionRules string) error {
|
||||
}
|
||||
}
|
||||
|
||||
excludes := strings.Split(exclusionRules, ";")
|
||||
excludes := strings.Split(exclusionRules, ",")
|
||||
excludeRules := ""
|
||||
for _, exclude := range excludes {
|
||||
if len(exclude) == 0 {
|
||||
|
@ -2,6 +2,7 @@ package migrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/app/model"
|
||||
@ -364,6 +365,18 @@ var UpdateCronjobWithSecond = &gormigrate.Migration{
|
||||
if err := tx.AutoMigrate(&model.Cronjob{}); err != nil {
|
||||
return err
|
||||
}
|
||||
var jobs []model.Cronjob
|
||||
if err := tx.Where("exclusion_rules != ?", "").Find(&jobs).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
for _, job := range jobs {
|
||||
if strings.Contains(job.ExclusionRules, ";") {
|
||||
newRules := strings.ReplaceAll(job.ExclusionRules, ";", ",")
|
||||
if err := tx.Model(&model.Cronjob{}).Where("id = ?", job.ID).Update("exclusion_rules", newRules).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
@ -637,7 +637,8 @@ const message = {
|
||||
shell: 'Shell script',
|
||||
ntp: 'Time synchronization',
|
||||
website: 'Backup website',
|
||||
rulesHelper: 'Compression exclusion rules (with; Is a delimiter), for example: \n*.log; *.sql',
|
||||
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',
|
||||
all: 'All',
|
||||
failedRecord: 'Failed records',
|
||||
|
@ -639,7 +639,7 @@ const message = {
|
||||
shell: 'Shell 脚本',
|
||||
ntp: '时间同步',
|
||||
website: '备份网站',
|
||||
rulesHelper: '压缩排除规则(以 ; 号为分隔符),例: \n*.log;*.sql',
|
||||
rulesHelper: '当存在多个压缩排除规则时,需要换行显示,例:\n*.log \n*.sql',
|
||||
lastRecordTime: '上次执行时间',
|
||||
database: '备份数据库',
|
||||
missBackupAccount: '未能找到备份账号',
|
||||
|
@ -210,6 +210,9 @@ const acceptParams = (params: DialogProps): void => {
|
||||
changeType();
|
||||
}
|
||||
title.value = i18n.global.t('commons.button.' + dialogData.value.title);
|
||||
if (dialogData.value?.rowData?.exclusionRules) {
|
||||
dialogData.value.rowData.exclusionRules = dialogData.value.rowData.exclusionRules.replaceAll(',', '\n');
|
||||
}
|
||||
drawerVisiable.value = true;
|
||||
checkMysqlInstalled();
|
||||
loadBackups();
|
||||
@ -465,6 +468,9 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
if (dialogData.value?.rowData?.exclusionRules) {
|
||||
dialogData.value.rowData.exclusionRules = dialogData.value.rowData.exclusionRules.replaceAll('\n', ',');
|
||||
}
|
||||
if (!dialogData.value.rowData) return;
|
||||
if (dialogData.value.title === 'create') {
|
||||
await addCronjob(dialogData.value.rowData);
|
||||
|
Loading…
Reference in New Issue
Block a user