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

fix: 调整快照回滚逻辑 (#3989)

This commit is contained in:
ssongliu 2024-02-27 10:20:12 +08:00 committed by GitHub
parent d5d1125660
commit a0af04bbf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View File

@ -337,13 +337,14 @@ func (u *SnapshotService) SnapshotRollback(req dto.SnapshotRecover) error {
defer func() {
global.Cron.Start()
}()
snapJson, err := u.readFromJson(fmt.Sprintf("%s/snapshot.json", rootDir))
if err != nil {
updateRollbackStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("decompress file failed, err: %v", err))
u.OriginalPath = fmt.Sprintf("%s/1panel_original/original_%s", global.CONF.System.BaseDir, snap.Name)
if _, err := os.Stat(u.OriginalPath); err != nil && os.IsNotExist(err) {
return
}
u.OriginalPath = fmt.Sprintf("%s/1panel_original/original_%s", snapJson.OldBaseDir, snap.Name)
if _, err := os.Stat(u.OriginalPath); err != nil && os.IsNotExist(err) {
snapJson, err := u.readFromJson(fmt.Sprintf("%s/snapshot.json", u.OriginalPath))
if err != nil {
updateRollbackStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("read snapjson file failed, err: %v", err))
return
}

View File

@ -22,7 +22,7 @@
</span>
<div v-if="!withTagAll">
<ul v-for="(item, index) in unTagList" :key="index">
<li v-if="item.tags">
<li v-if="item.tags && item.tags[0]">
{{ item.tags[0] }}
</li>
<li v-else>
@ -32,7 +32,7 @@
</div>
<div v-else>
<ul v-for="(item, index) in unUsedList" :key="index">
<li v-if="item.tags">{{ item.tags.join(', ') }}</li>
<li v-if="item.tags && item.tags[0]">{{ item.tags.join(', ') }}</li>
<li v-else>{{ item.id.replaceAll('sha256:', '').substring(0, 12) }}</li>
</ul>
</div>