sklad: show the context when deleting containers

Do not try to show the deleted container.
This commit is contained in:
Přemysl Eric Janouch 2019-04-22 10:09:08 +02:00
parent 4ad4bcf9e7
commit 7d2ca09d1b
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 7 additions and 1 deletions

View File

@ -107,6 +107,12 @@ func handleContainerPost(r *http.Request) error {
} }
func handleContainer(w http.ResponseWriter, r *http.Request) { func handleContainer(w http.ResponseWriter, r *http.Request) {
// When deleting, do not try to show the deleted entry but the context.
shownId := r.FormValue("context")
if shownId == "" {
shownId = r.FormValue("id")
}
var err error var err error
if r.Method == http.MethodPost { if r.Method == http.MethodPost {
err = handleContainerPost(r) err = handleContainerPost(r)
@ -128,7 +134,7 @@ func handleContainer(w http.ResponseWriter, r *http.Request) {
var container *Container var container *Container
children := indexChildren[""] children := indexChildren[""]
if c, ok := indexContainer[ContainerId(r.FormValue("id"))]; ok { if c, ok := indexContainer[ContainerId(shownId)]; ok {
children = c.Children() children = c.Children()
container = c container = c
} }