1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

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

This commit is contained in:
ssongliu 2024-01-25 17:24:09 +08:00 committed by GitHub
parent d917008f47
commit df2a705713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 18 deletions

View File

@ -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"`

View File

@ -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 {

View File

@ -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{}{

View File

@ -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>
@ -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) }}
@ -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>

View File

@ -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">