Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 调整快照页面备份路径样式 #3696

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions backend/app/dto/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ type SnapshotImport struct {
Description string `json:"description" validate:"max=256"`
}
type SnapshotInfo struct {
ID uint `json:"id"`
Name string `json:"name"`
Description string `json:"description" validate:"max=256"`
From string `json:"from"`
Status string `json:"status"`
Message string `json:"message"`
CreatedAt time.Time `json:"createdAt"`
Version string `json:"version"`
ID uint `json:"id"`
Name string `json:"name"`
Description string `json:"description" validate:"max=256"`
From string `json:"from"`
DefaultDownload string `json:"defaultDownload"`
Status string `json:"status"`
Message string `json:"message"`
CreatedAt time.Time `json:"createdAt"`
Version string `json:"version"`

InterruptStep string `json:"interruptStep"`
RecoverStatus string `json:"recoverStatus"`
Expand Down
3 changes: 2 additions & 1 deletion backend/app/service/cronjob_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ func (u *CronjobService) handleSnapshot(cronjob model.Cronjob, startTime time.Ti
record.FileDir = "system_snapshot"

req := dto.SnapshotCreate{
From: record.BackupType,
From: record.BackupType,
DefaultDownload: cronjob.DefaultDownload,
}
name, err := NewISnapshotService().HandleSnapshot(true, logPath, req, startTime.Format("20060102150405"))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion backend/init/migration/migrations/v_1_9.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ var UpdateCronjobSpec = &gormigrate.Migration{
mapAccount[item.ID] = item.Type
}
for _, job := range jobs {
if job.KeepLocal {
if job.KeepLocal && mapAccount[uint(job.TargetDirID)] != constant.Local {
if err := tx.Model(&model.Cronjob{}).
Where("id = ?", job.ID).
Updates(map[string]interface{}{
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/views/cronjob/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<template #default="{ row }">
<div v-for="(item, index) of row.spec.split(',')" :key="index" class="mt-1">
<div v-if="row.expand || (!row.expand && index < 3)">
<el-tag>
<el-tag type="info">
{{ transSpecToStr(item) }}
</el-tag>
</div>
Expand Down Expand Up @@ -115,9 +115,9 @@
</el-table-column>
<el-table-column :min-width="80" :label="$t('cronjob.target')" prop="defaultDownload">
<template #default="{ row }">
<div v-for="(item, index) of row.backupAccounts.split(',')" :key="index" class="mt-1">
<div v-for="(item, index) of row.backupAccounts?.split(',')" :key="index" class="mt-1">
<div v-if="row.accountExpand || (!row.accountExpand && index < 3)">
<el-tag v-if="row.backupAccounts">
<el-tag type="info" v-if="row.backupAccounts">
<span v-if="item === row.defaultDownload">
<el-icon><Star /></el-icon>
{{ $t('setting.' + item) }}
Expand All @@ -129,12 +129,12 @@
<span v-else>-</span>
</div>
</div>
<div v-if="!row.accountExpand && row.backupAccounts.split(',').length > 3">
<div v-if="!row.accountExpand && row.backupAccounts?.split(',').length > 3">
<el-button type="primary" link @click="row.accountExpand = true">
{{ $t('commons.button.expand') }}...
</el-button>
</div>
<div v-if="row.accountExpand && row.backupAccounts.split(',').length > 3">
<div v-if="row.accountExpand && row.backupAccounts?.split(',').length > 3">
<el-button type="primary" link @click="row.accountExpand = false">
{{ $t('commons.button.collapse') }}
</el-button>
Expand Down
27 changes: 24 additions & 3 deletions frontend/src/views/setting/snapshot/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,30 @@
<el-table-column prop="version" :label="$t('app.version')" />
<el-table-column :label="$t('setting.backupAccount')" min-width="80" prop="from">
<template #default="{ row }">
<span v-if="row.from">
{{ $t('setting.' + row.from) }}
</span>
<div v-for="(item, index) of row.from.split(',')" :key="index" class="mt-1">
<div v-if="row.expand || (!row.expand && index < 3)">
<el-tag v-if="row.from" type="info">
<span v-if="item === row.defaultDownload">
<el-icon><Star /></el-icon>
{{ $t('setting.' + item) }}
</span>
<span v-else>
{{ $t('setting.' + item) }}
</span>
</el-tag>
<span v-else>-</span>
</div>
</div>
<div v-if="!row.expand && row.from.split(',').length > 3">
<el-button type="primary" link @click="row.expand = true">
{{ $t('commons.button.expand') }}...
</el-button>
</div>
<div v-if="row.expand && row.from.split(',').length > 3">
<el-button type="primary" link @click="row.expand = false">
{{ $t('commons.button.collapse') }}
</el-button>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.status')" min-width="80" prop="status">
Expand Down
Loading