[MGNLUI-1586] PageEditor: action availability is incorrect for several (area) selections Created: 07/Jun/13  Updated: 17/Mar/16  Resolved: 06/May/14

Status: Closed
Project: Magnolia UI
Component/s: page editor
Affects Version/s: 5.0, 5.1
Fix Version/s: 5.2.5

Type: Bug Priority: Major
Reporter: Philip Mundt Assignee: Chunhua Liu
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-2931 Add Component action availability Closed
causality
duplicate
is duplicated by BLOSSOM-148 Area defined as Single Type allows to... Closed
relation
is related to MAGNOLIA-5418 Rendering should not fail on single a... Closed
is related to PAGES-62 Disable duplicate action in 'single' ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   
  • It is possible to add multiple components to an area of type=single, which will result in an exception in the ftl (not anymore, this was fixed).
    However, if one tries to add a new component to a area of type=single (mainly templates with auto-generated content), an error is thrown:
ERROR fo.magnolia.pages.app.action.CreateComponentAction: Exception caught: No template definition registered for id: 
info.magnolia.registry.RegistrationException: No template definition registered for id: 
	at info.magnolia.rendering.template.registry.TemplateDefinitionRegistry.getTemplateDefinition(TemplateDefinitionRegistry.java:73)
	at info.magnolia.pages.app.action.CreateComponentAction.buildNewComponentDialog(CreateComponentAction.java:192)
  • area type=single doesn't show the correct available actions in actionbar, e.g.
    • Sitemap
      • "Add Components" should be deactivated
      • "Move Component" should be deactivated
  • Optional area (mostly sub-area of components, e.g. stkLinkList) can't be deleted after creation.

Once an area has been added with "Add component" in the action bar rendering fails because of the unexpected presence of a second component in the 'single' area.

Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: info.magnolia.rendering.engine.RenderException: Can't render area node /qwe/main with name main
	at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:861)
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
	at org.apache.jsp.templates.blossomSampleModule.pages.main_jsp._jspService(main_jsp.java:144)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
	... 127 more
Caused by: info.magnolia.rendering.engine.RenderException: Can't render area node /qwe/main with name main
	at info.magnolia.templating.elements.AreaElement.end(AreaElement.java:345)
	at info.magnolia.templating.jsp.cms.AbstractTag.doTag(AbstractTag.java:102)
	at org.apache.jsp.templates.blossomSampleModule.pages.main_jsp._jspx_meth_cms_005farea_005f0(main_jsp.java:218)
	at org.apache.jsp.templates.blossomSampleModule.pages.main_jsp._jspService(main_jsp.java:124)
	... 130 more
Caused by: info.magnolia.rendering.engine.RenderException: Can't render single area [node /qwe/main]: expected one component node but found more.
	at info.magnolia.templating.elements.AreaElement.end(AreaElement.java:303)
	... 133 more


 Comments   
Comment by Cheng Hu [ 06/May/14 ]

The following changes to availability of actions were made:

  • When an area of type single that already has a component is selected, the Add Component action is disabled.
  • When a component within an area of type single is selected, the Move Component action is disabled.
  • When an area that is option and not yet created is selected, the Add Component action is disabled.

We also add integration tests to test these changes to availability.

However we did not add any action to delete an optional area that has been created. An optional area can usually be made to appear as if it doesn't exist simply by deleting the components in it. Also there seems to be no concept of deleting areas in Magnolia, and adding an action specifically to delete optional areas does not seem appropriate.

Comment by Daniel Lipp [ 07/May/14 ]
  • pls add unit tests to cover the changed behavior of MgnlArea and MgnlComponent (see MgnlElementTest for inspiration) - it's great you added a UI test but that doesn't make unit-tests obsolete
  • code like "getAttributes().containsKey("type") && getAttribute("type").equals("single")" can be simplified to: "single".equals(getAttribute("type"))
  • you fixed formatting issues as well which is perfectly fine. Preferably such fixes should have their own commit so the real changes are easier to spot (for the community and the reviewer)
Comment by Daniel Lipp [ 08/May/14 ]

Pls adapt to clean BDD-style (only one call in // WHEN section) and split into explicit test methods.

Generated at Mon Feb 12 08:48:05 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.