1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-17 03:04:46 +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"` Description string `json:"description" validate:"max=256"`
} }
type SnapshotInfo struct { type SnapshotInfo struct {
ID uint `json:"id"` ID uint `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description" validate:"max=256"` Description string `json:"description" validate:"max=256"`
From string `json:"from"` From string `json:"from"`
Status string `json:"status"` DefaultDownload string `json:"defaultDownload"`
Message string `json:"message"` Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"` Message string `json:"message"`
Version string `json:"version"` CreatedAt time.Time `json:"createdAt"`
Version string `json:"version"`
InterruptStep string `json:"interruptStep"` InterruptStep string `json:"interruptStep"`
RecoverStatus string `json:"recoverStatus"` RecoverStatus string `json:"recoverStatus"`

View File

@ -208,7 +208,8 @@ func (u *CronjobService) handleSnapshot(cronjob model.Cronjob, startTime time.Ti
record.FileDir = "system_snapshot" record.FileDir = "system_snapshot"
req := dto.SnapshotCreate{ req := dto.SnapshotCreate{
From: record.BackupType, From: record.BackupType,
DefaultDownload: cronjob.DefaultDownload,
} }
name, err := NewISnapshotService().HandleSnapshot(true, logPath, req, startTime.Format("20060102150405")) name, err := NewISnapshotService().HandleSnapshot(true, logPath, req, startTime.Format("20060102150405"))
if err != nil { if err != nil {

View File

@ -281,7 +281,7 @@ var UpdateCronjobSpec = &gormigrate.Migration{
mapAccount[item.ID] = item.Type mapAccount[item.ID] = item.Type
} }
for _, job := range jobs { for _, job := range jobs {
if job.KeepLocal { if job.KeepLocal && mapAccount[uint(job.TargetDirID)] != constant.Local {
if err := tx.Model(&model.Cronjob{}). if err := tx.Model(&model.Cronjob{}).
Where("id = ?", job.ID). Where("id = ?", job.ID).
Updates(map[string]interface{}{ Updates(map[string]interface{}{

View File

@ -83,7 +83,7 @@
<template #default="{ row }"> <template #default="{ row }">
<div v-for="(item, index) of row.spec.split(',')" :key="index" class="mt-1"> <div v-for="(item, index) of row.spec.split(',')" :key="index" class="mt-1">
<div v-if="row.expand || (!row.expand && index < 3)"> <div v-if="row.expand || (!row.expand && index < 3)">
<el-tag> <el-tag type="info">
{{ transSpecToStr(item) }} {{ transSpecToStr(item) }}
</el-tag> </el-tag>
</div> </div>
@ -115,9 +115,9 @@
</el-table-column> </el-table-column>
<el-table-column :min-width="80" :label="$t('cronjob.target')" prop="defaultDownload"> <el-table-column :min-width="80" :label="$t('cronjob.target')" prop="defaultDownload">
<template #default="{ row }"> <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)"> <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"> <span v-if="item === row.defaultDownload">
<el-icon><Star /></el-icon> <el-icon><Star /></el-icon>
{{ $t('setting.' + item) }} {{ $t('setting.' + item) }}
@ -129,12 +129,12 @@
<span v-else>-</span> <span v-else>-</span>
</div> </div>
</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"> <el-button type="primary" link @click="row.accountExpand = true">
{{ $t('commons.button.expand') }}... {{ $t('commons.button.expand') }}...
</el-button> </el-button>
</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 = false"> <el-button type="primary" link @click="row.accountExpand = false">
{{ $t('commons.button.collapse') }} {{ $t('commons.button.collapse') }}
</el-button> </el-button>

View File

@ -49,9 +49,30 @@
<el-table-column prop="version" :label="$t('app.version')" /> <el-table-column prop="version" :label="$t('app.version')" />
<el-table-column :label="$t('setting.backupAccount')" min-width="80" prop="from"> <el-table-column :label="$t('setting.backupAccount')" min-width="80" prop="from">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="row.from"> <div v-for="(item, index) of row.from.split(',')" :key="index" class="mt-1">
{{ $t('setting.' + row.from) }} <div v-if="row.expand || (!row.expand && index < 3)">
</span> <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> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.status')" min-width="80" prop="status"> <el-table-column :label="$t('commons.table.status')" min-width="80" prop="status">