From d742afabf396eccdeb16470b5653ffb51ca4fa41 Mon Sep 17 00:00:00 2001 From: ga7x Date: Thu, 22 Feb 2024 17:31:22 +0100 Subject: [PATCH] #1075 Reset the view name after loading the background file - The currently entered name from the view edit and new form is retained after when clicking the "Upload Image" or "Reset Image" button, what causes changes are made in the background view. - Corrected ViewControllerUtils.getOrEmptyView. --- src/com/serotonin/mango/util/ViewControllerUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/serotonin/mango/util/ViewControllerUtils.java b/src/com/serotonin/mango/util/ViewControllerUtils.java index 99988aadac..feca7fddf2 100644 --- a/src/com/serotonin/mango/util/ViewControllerUtils.java +++ b/src/com/serotonin/mango/util/ViewControllerUtils.java @@ -3,6 +3,7 @@ import com.serotonin.mango.Common; import com.serotonin.mango.view.View; import org.scada_lts.mango.service.ViewService; +import org.scada_lts.serorepl.utils.StringUtils; import org.scada_lts.utils.HttpParameterUtils; import javax.servlet.http.HttpServletRequest; @@ -18,6 +19,10 @@ public static View getOrEmptyView(HttpServletRequest request, ViewService viewSe if(view == null) { view = HttpParameterUtils.getObject("emptyView", request, View.class).orElseGet(View::new); } + String viewName = HttpParameterUtils.getValue("view.name", request, a -> a).orElse(""); + if(!StringUtils.isEmpty(viewName)) { + view.setName(viewName); + } return view; }