Tapestry 5
  1. Tapestry 5
  2. TAP5-742

Add optional component tracing comments to rendered output

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2.4
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      In complex pages, it can be hard to work backwards from a bit of output HTML in the browser, back to the component that originated the markup.

      This feature adds rendering of comments that provide trace output of which component is currently currently:

      <!-BEGIN Index:loop (context:Index.tml, line 15)-><li>
      <Unable to render embedded object: File (pagelink (context:Index.tml, line 16)--><a href="/abstractcomponentdemo">Abstract Component Demo</a><) not found.-END Index:pagelink->

      Note that the BEGIN comment includes both the complete component id in the page and the location of that in the template. With just the component id it can still be unclear which component is being referenced without the line number.

      For security purposes, this feature cannot be enabled in production mode. In non-production mode it can be enabled two ways:

      • Setting the symbol "tapestry.component-render-tracing-enabled" to "true" (default: false)
      • Setting the request query parameter "t:component-trace" on the URL to "true". This allows enabling for a specific request when you need it in development rather than having it on all the time.

      Note that rendering comments are based on the component lifecycle. Thus in some case where post-render DOM manipulation is performed the markup my not longer be in the correct rendering comments.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        558d 9h 2m 1 Dan Adams 20/Dec/10 21:43
        In Progress In Progress Closed Closed
        2h 1m 1 Dan Adams 20/Dec/10 23:45
        Closed Closed Reopened Reopened
        99d 17h 35m 1 Igor Drobiazko 30/Mar/11 18:20
        Reopened Reopened Closed Closed
        24s 1 Igor Drobiazko 30/Mar/11 18:20
        Howard M. Lewis Ship made changes -
        Fix Version/s 5.3 [ 12316024 ]
        Fix Version/s 5.3.0 [ 12316023 ]
        Igor Drobiazko made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Closed [ 6 ]
        Igor Drobiazko made changes -
        Fix Version/s 5.3.0 [ 12316023 ]
        Fix Version/s 5.2.5 [ 12315565 ]
        Igor Drobiazko made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Hide
        Hudson added a comment -

        Integrated in tapestry-5.2-freestyle #237 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/237/)

        Show
        Hudson added a comment - Integrated in tapestry-5.2-freestyle #237 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/237/ )
        Dan Adams made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Dan Adams made changes -
        Affects Version/s 5.2.4 [ 12315557 ]
        Affects Version/s 5.1.0.5 [ 12313913 ]
        Description In complex pages, it can be hard to work backwards from a bit of output HTML in the browser, back to the component that originated the markup.

        A special mode could be enabled where components would render a comment before and after rendering:

        <!-- BEGIN: Index:layout.pagelink -->
        <a href="dashboard">Dashboard</a>
        <!-- END: Index:layout.pagelink -->

        This would bloat and clutter the application (a lot!) but would be useful, on occasion. One possibility would be a special query parameter to enable this on a request-by-request basis, i.e., ?t:component-trace=true
        In complex pages, it can be hard to work backwards from a bit of output HTML in the browser, back to the component that originated the markup.

        This feature adds rendering of comments that provide trace output of which component is currently currently:

        <!--BEGIN Index:loop (context:Index.tml, line 15)--><li>
              <!--BEGIN Index:pagelink (context:Index.tml, line 16)--><a href="/abstractcomponentdemo">Abstract Component Demo</a><!--END Index:pagelink-->

        Note that the BEGIN comment includes both the complete component id in the page and the location of that in the template. With just the component id it can still be unclear which component is being referenced without the line number.

        For security purposes, this feature cannot be enabled in production mode. In non-production mode it can be enabled two ways:
         - Setting the symbol "tapestry.component-render-tracing-enabled" to "true" (default: false)
         - Setting the request query parameter "t:component-trace" on the URL to "true". This allows enabling for a specific request when you need it in development rather than having it on all the time.

        Note that rendering comments are based on the component lifecycle. Thus in some case where post-render DOM manipulation is performed the markup my not longer be in the correct rendering comments.
        Fix Version/s 5.2.5 [ 12315565 ]
        Dan Adams made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Dan Adams made changes -
        Field Original Value New Value
        Assignee Dan Adams [ hagios17 ]
        Hide
        Joost Schouten added a comment -

        +1 Unit testing is where is comes in handy. With the addition of the component class to te comment It will allow you to do things like assertComponentOnPage(MyComponent.class).

        Show
        Joost Schouten added a comment - +1 Unit testing is where is comes in handy. With the addition of the component class to te comment It will allow you to do things like assertComponentOnPage(MyComponent.class).
        Hide
        Sergey Didenko added a comment -

        I made a temporary hackish solution for this, see http://wiki.apache.org/tapestry/Tapestry5HowToVisualizeComponentHierarchy . Hope this helps.

        Show
        Sergey Didenko added a comment - I made a temporary hackish solution for this, see http://wiki.apache.org/tapestry/Tapestry5HowToVisualizeComponentHierarchy . Hope this helps.
        Hide
        Hugo Palma added a comment -

        I think enabling component debugging on a request-by-request basis would be really helpful.

        What about if the parameter was there but Tapestry would only actually use it's value if tapestry.prodution-mode was false ? Wouldn't that provide both ease of use and security ?

        Show
        Hugo Palma added a comment - I think enabling component debugging on a request-by-request basis would be really helpful. What about if the parameter was there but Tapestry would only actually use it's value if tapestry.prodution-mode was false ? Wouldn't that provide both ease of use and security ?
        Hide
        Massimo Lusetti added a comment -

        Sure that would be a way to leverage tapestry.production-mode

        Show
        Massimo Lusetti added a comment - Sure that would be a way to leverage tapestry.production-mode
        Hide
        Thiago H. de Paula Figueiredo added a comment -

        Or an specific symbol which has a default value of tapestry.prodution-mode.

        Show
        Thiago H. de Paula Figueiredo added a comment - Or an specific symbol which has a default value of tapestry.prodution-mode.
        Hide
        Massimo Lusetti added a comment -

        Yep, just a query parameter seems too much easy as Ulrich proposed a production-mode could be leveraged for this purpose.

        Show
        Massimo Lusetti added a comment - Yep, just a query parameter seems too much easy as Ulrich proposed a production-mode could be leveraged for this purpose.
        Hide
        Ulrich Stärk added a comment -

        I wouldn't want anyone knowing that my application is a Tapestry application to be able to see my component structure, just by adding a query parameter to the url. Why not bind this to "tapestry.production-mode==false && log.isDebugEnabled()"?

        Show
        Ulrich Stärk added a comment - I wouldn't want anyone knowing that my application is a Tapestry application to be able to see my component structure, just by adding a query parameter to the url. Why not bind this to "tapestry.production-mode==false && log.isDebugEnabled()"?
        Howard M. Lewis Ship created issue -

          People

          • Assignee:
            Dan Adams
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development