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() { defer func() {
global.Cron.Start() global.Cron.Start()
}() }()
snapJson, err := u.readFromJson(fmt.Sprintf("%s/snapshot.json", rootDir))
if err != nil { u.OriginalPath = fmt.Sprintf("%s/1panel_original/original_%s", global.CONF.System.BaseDir, snap.Name)
updateRollbackStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("decompress file failed, err: %v", err)) if _, err := os.Stat(u.OriginalPath); err != nil && os.IsNotExist(err) {
return return
} }
u.OriginalPath = fmt.Sprintf("%s/1panel_original/original_%s", snapJson.OldBaseDir, snap.Name) snapJson, err := u.readFromJson(fmt.Sprintf("%s/snapshot.json", u.OriginalPath))
if _, err := os.Stat(u.OriginalPath); err != nil && os.IsNotExist(err) { if err != nil {
updateRollbackStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("read snapjson file failed, err: %v", err))
return return
} }

View File

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