Skip to content

Commit

Permalink
#1075 Reset the view name after loading the background file
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
ga7x committed Feb 22, 2024
1 parent adc2bd8 commit d742afa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/com/serotonin/mango/util/ViewControllerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit d742afa

Please sign in to comment.