mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 10:48:15 +08:00
[REV] After importing the cleanup directory, change the status to cleaned
This commit is contained in:
parent
8469e31562
commit
3b7472ef44
@ -131,9 +131,16 @@ func (a *AppStruct) ImportID(w http.ResponseWriter, r *http.Request) {
|
||||
case "DELETE":
|
||||
err := os.RemoveAll(dirName)
|
||||
if err != nil {
|
||||
httputil.ReturnError(r, w, 502, "Failed to delete directory by id: "+eventId)
|
||||
httputil.ReturnError(r, w, 501, "Failed to delete directory by id: "+eventId)
|
||||
return
|
||||
}
|
||||
res, err := db.GetManager().AppDao().GetByEventId(eventId)
|
||||
if err != nil {
|
||||
httputil.ReturnError(r, w, 502, fmt.Sprintf("Failed to query status of export app by event id %s: %v", eventId, err))
|
||||
return
|
||||
}
|
||||
res.Status = "cleaned"
|
||||
db.GetManager().AppDao().UpdateModel(res)
|
||||
|
||||
httputil.ReturnSuccess(r, w, "successful")
|
||||
}
|
||||
@ -231,6 +238,11 @@ func (a *AppStruct) ImportApp(w http.ResponseWriter, r *http.Request) {
|
||||
httputil.ReturnError(r, w, 502, fmt.Sprintf("Failed to query status of export app by event id %s: %v", eventId, err))
|
||||
return
|
||||
}
|
||||
if res.Status == "cleaned" {
|
||||
res.Metadata = ""
|
||||
httputil.ReturnSuccess(r, w, res)
|
||||
return
|
||||
}
|
||||
|
||||
if res.Status == "success" {
|
||||
metadatasFile := fmt.Sprintf("%s/metadatas.json", res.SourceDir)
|
||||
|
@ -5,7 +5,7 @@ type AppStatus struct {
|
||||
Format string `gorm:"column:format;size:32" json:"format"` // only rainbond-app/docker-compose
|
||||
SourceDir string `gorm:"column:source_dir;size:255" json:"source_dir"`
|
||||
Apps string `gorm:"column:apps;type:text" json:"apps"`
|
||||
Status string `gorm:"column:status;size:32" json:"status"` // only exporting/importing/failed/success
|
||||
Status string `gorm:"column:status;size:32" json:"status"` // only exporting/importing/failed/success/cleaned
|
||||
TarFileHref string `gorm:"column:tar_file_href;size:255" json:"tar_file_href"`
|
||||
Metadata string `gorm:"column:metadata;type:text" json:"metadata"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user