database.html.twig

{% block toolbar %}
    {% set icon %}
    
        {{ 'Database'|t }}
        {{ collector.querycount }}
        {% if collector.querycount > 0 %}
            in {{ '%0.2f ms'|format(collector.time) }}
        {% endif %}
    
    {% endset %}
    {% set text %}
    
{{ 'DB Queries'|t }} {{ collector.querycount }}
{{ 'Query time'|t }} {{ '%0.2f ms'|format(collector.time) }}
{{ 'Default database'|t }} {{ collector.database.driver }}://{{ collector.database.host }}:{{ collector.database.port }} /{{ collector.database.database }}
{% endset %}
{{ icon|default('') }}
{{ text|default('') }}
{% endblock %} {% block panel %}

{{ 'Database'|t }}

{{ 'Caller'|t }}
{{ 'Any'|t }} Select Insert Update Create Delete {{ 'Query type'|t }}
{{ 'Any'|t }} {{ 'Yes'|t }} {{ 'No'|t }} {{ 'Slow queries'|t }}
{{ 'Any'|t }} <% _.each(data.connections, function( item ){ %> "><%- item %> <% }) %> {{ 'Database'|t }}
{{ 'Swap Placeholders'|t }}
<% _.each( data.queries, function( item, key ){ %>
data.query_highlight_threshold) { %> is--hightlighted <% } %>" data-wp-caller="<%- item.caller.class != null ? item.caller.class.toLowerCase() : '' %>" data-wp-database="<%- item.database %>" data-wp-type="<%- item.type %>" data-wp-hightlighted="<%- (item.time > data.query_highlight_threshold) ? '1' : '0' %>">
 class="js--code-target"<% } %> >
                        
                            <%- item.query %>
                        
                        <% if( item.query_args) { %>
                        
                            <%- item.query_args %>
                        
                        <% } %>
                    
  • {{ 'Time'|t }}: <%- Drupal.webprofiler.helpers.printTime(item.time) %>
  • {{ 'Caller'|t }}: <%= Drupal.webprofiler.helpers.classLink({"file" : item.caller.file, "class" : item.caller.class, "line" : item.caller.line, "method" : item.caller.function}) %>
  • {{ 'Database'|t }}: <%- item.database %>
  • {{ 'Target'|t }}: <%- item.target %>
<% if(item.query_args){ %>
{{ 'Swap Placeholders'|t }}
<% } %> <% if(item.args){ %>
{{ 'Info'|t }}
<% } %> <% if(item.explain){ %>
" >{{ 'Explain'|t }}
<% } %>
<% if(item.explain){ %>
<% } %> <% if(item.args){ %>
<% _.each( item.args, function( item, key ){ %> <% }); %>
{{ 'placeholder'|t }} {{ 'value'|t }}
<%- key %> <%= Drupal.webprofiler.helpers.frm(item) %>
<% } %>
<% }); %> <% _.each(rc.data[1], function(value, key, list) { %> <% }); %> <% _.each(rc.data, function(value) { %> <% _.each(value, function(value2, key, list) { %> <% }); %> <% }); %>
<%= key %>
<%= value2 %>
{% endblock %}

File

webprofiler/templates/Collector/database.html.twig

View source
  1. {% block toolbar %}
  2. {% set icon %}
  3. <a href="{{ url("webprofiler.dashboard", {profile: token}, {fragment: 'database'}) }}" title="{{ 'Database'|t }}">
  4. <img width="20" height="28" alt="{{ 'Database'|t }}"
  5. src="data:image/png;base64,{{ collector.icon }}"/>
  6. <span class="sf-toolbar-info-piece-additional sf-toolbar-status sf-toolbar-status-{{ collector.colorCode }}">{{ collector.querycount }}</span>
  7. {% if collector.querycount > 0 %}
  8. <span class="sf-toolbar-info-piece-additional-detail">in {{ '%0.2f ms'|format(collector.time) }}</span>
  9. {% endif %}
  10. </a>
  11. {% endset %}
  12. {% set text %}
  13. <div class="sf-toolbar-info-piece">
  14. <b>{{ 'DB Queries'|t }}</b>
  15. <span>{{ collector.querycount }}</span>
  16. </div>
  17. <div class="sf-toolbar-info-piece">
  18. <b>{{ 'Query time'|t }}</b>
  19. <span>{{ '%0.2f ms'|format(collector.time) }}</span>
  20. </div>
  21. <div class="sf-toolbar-info-piece">
  22. <b>{{ 'Default database'|t }}</b>
  23. <span>{{ collector.database.driver }}://{{ collector.database.host }}:{{ collector.database.port }}
  24. /{{ collector.database.database }}</span>
  25. </div>
  26. {% endset %}
  27. <div class="sf-toolbar-block">
  28. <div class="sf-toolbar-icon">{{ icon|default('') }}</div>
  29. <div class="sf-toolbar-info">{{ text|default('') }}</div>
  30. </div>
  31. {% endblock %}
  32. {% block panel %}
  33. <script id="database" type="text/template">
  34. <h2 class="panel__title">{{ 'Database'|t }}</h2>
  35. <form class="panel__toolbar">
  36. <div class="panel__filter--text">
  37. <input id="edit-caller" class="js--live-filter" placeholder="{{ 'Caller'|t }}" type="text"/>
  38. <label for="edit-caller" class="panel__filter-label">{{ 'Caller'|t }}</label>
  39. </div>
  40. <div class="panel__filter--select">
  41. <select id="edit-type" class="js--live-filter">
  42. <option value="">{{ 'Any'|t }}</option>
  43. <option value="select">Select</option>
  44. <option value="insert">Insert</option>
  45. <option value="update">Update</option>
  46. <option value="create">Create</option>
  47. <option value="delete">Delete</option>
  48. </select>
  49. <label for="edit-type" class="panel__filter-label">{{ 'Query type'|t }}</label>
  50. </div>
  51. <div class="panel__filter--select">
  52. <select id="edit-hightlighted" class="js--live-filter">
  53. <option value="">{{ 'Any'|t }}</option>
  54. <option value="1">{{ 'Yes'|t }}</option>
  55. <option value="0">{{ 'No'|t }}</option>
  56. </select>
  57. <label for="edit-type" class="panel__filter-label">{{ 'Slow queries'|t }}</label>
  58. </div>
  59. <div class="panel__filter--select">
  60. <select id="edit-database" class="js--live-filter">
  61. <option value="">{{ 'Any'|t }}</option>
  62. <% _.each(data.connections, function( item ){ %>
  63. <option value="<%- item %>"><%- item %></option>
  64. <% }) %>
  65. </select>
  66. <label for="edit-database" class="panel__filter-label">{{ 'Database'|t }}</label>
  67. </div>
  68. <div class="button--flat l-right js--code-toggle--global js--placeholder-visible">{{ 'Swap Placeholders'|t }}</div>
  69. </form>
  70. <% _.each( data.queries, function( item, key ){ %>
  71. <div class="panel__container<% if (item.time > data.query_highlight_threshold) { %> is--hightlighted <% } %>"
  72. data-wp-caller="<%- item.caller.class != null ? item.caller.class.toLowerCase() : '' %>"
  73. data-wp-database="<%- item.database %>"
  74. data-wp-type="<%- item.type %>"
  75. data-wp-hightlighted="<%- (item.time > data.query_highlight_threshold) ? '1' : '0' %>">
  76. <div class="panel__expand-header ">
  77. <pre <% if( item.query_args) { %> class="js--code-target"<% } %> >
  78. <code class="sql js--placeholder-query">
  79. <%- item.query %>
  80. </code>
  81. <% if( item.query_args) { %>
  82. <code class="sql js--clipboard-target is--hidden js--original-query">
  83. <%- item.query_args %>
  84. </code>
  85. <% } %>
  86. </pre>
  87. <ul class="list--inline">
  88. <li><b>{{ 'Time'|t }}</b>: <%- Drupal.webprofiler.helpers.printTime(item.time) %></li>
  89. <li><b>{{ 'Caller'|t }}</b>: <%= Drupal.webprofiler.helpers.classLink({"file" : item.caller.file,
  90. "class" : item.caller.class, "line" : item.caller.line, "method" : item.caller.function}) %>
  91. </li>
  92. <li><b>{{ 'Database'|t }}</b>: <%- item.database %></li>
  93. <li><b>{{ 'Target'|t }}</b>: <%- item.target %></li>
  94. </ul>
  95. <% if(item.query_args){ %>
  96. <div class="button--flat l-right js--code-toggle">{{ 'Swap Placeholders'|t }}</div>
  97. <% } %>
  98. <% if(item.args){ %>
  99. <div class="button--flat l-right js--panel-toggle">{{ 'Info'|t }}</div>
  100. <% } %>
  101. <!--div class="button--flat l-right js--clipboard-trigger">{{ 'Copy Query'|t }}</div-->
  102. <% if(item.explain){ %>
  103. <div class="button--flat l-right js--explain-trigger"
  104. data-wp-queryPosition="<%- key %>"
  105. >{{ 'Explain'|t }}</div>
  106. <% } %>
  107. </div>
  108. <% if(item.explain){ %>
  109. <div class="loader--linear js--loader" style="display: none">
  110. <div class="loader__bar"></div>
  111. <div class="loader__bar"></div>
  112. <div class="loader__bar"></div>
  113. </div>
  114. <div class="panel__expand-content js--explain-target"></div>
  115. <% } %>
  116. <% if(item.args){ %>
  117. <div class="panel__expand-content">
  118. <div class="wp-query-arguments">
  119. <table class="table--duo">
  120. <thead>
  121. <tr>
  122. <th>{{ 'placeholder'|t }}</th>
  123. <th>{{ 'value'|t }}</th>
  124. </tr>
  125. </thead>
  126. <tbody>
  127. <% _.each( item.args, function( item, key ){ %>
  128. <tr>
  129. <td><%- key %></td>
  130. <td><%= Drupal.webprofiler.helpers.frm(item) %></td>
  131. </tr>
  132. <% }); %>
  133. </tbody>
  134. </table>
  135. </div>
  136. </div>
  137. <% } %>
  138. </div>
  139. <% }); %>
  140. </script>
  141. <script id="wp-query-explain-template" type="text/template">
  142. <table class="table--compact">
  143. <thead>
  144. <tr>
  145. <% _.each(rc.data[1], function(value, key, list) { %>
  146. <th><%= key %></th>
  147. <% }); %>
  148. </tr>
  149. </thead>
  150. <% _.each(rc.data, function(value) { %>
  151. <tr>
  152. <% _.each(value, function(value2, key, list) { %>
  153. <td><%= value2 %></td>
  154. <% }); %>
  155. </tr>
  156. <% }); %>
  157. </table>
  158. </script>
  159. {% endblock %}