Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / devel / webprofiler / templates / Collector / database.html.twig
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
28     <div class="sf-toolbar-block">
29         <div class="sf-toolbar-icon">{{ icon|default('') }}</div>
30         <div class="sf-toolbar-info">{{ text|default('') }}</div>
31     </div>
32 {% endblock %}
33
34 {% block panel %}
35     <script id="database" type="text/template">
36         <h2 class="panel__title">{{ 'Database'|t }}</h2>
37
38         <form class="panel__toolbar">
39             <div class="panel__filter--text">
40                 <input id="edit-caller" class="js--live-filter" placeholder="{{ 'Caller'|t }}" type="text"/>
41                 <label for="edit-caller" class="panel__filter-label">{{ 'Caller'|t }}</label>
42             </div>
43             <div class="panel__filter--select">
44                 <select id="edit-type" class="js--live-filter">
45                     <option value="">{{ 'Any'|t }}</option>
46                     <option value="select">Select</option>
47                     <option value="insert">Insert</option>
48                     <option value="update">Update</option>
49                     <option value="create">Create</option>
50                     <option value="delete">Delete</option>
51                 </select>
52                 <label for="edit-type" class="panel__filter-label">{{ 'Query type'|t }}</label>
53             </div>
54             <div class="panel__filter--select">
55                 <select id="edit-hightlighted" class="js--live-filter">
56                     <option value="">{{ 'Any'|t }}</option>
57                     <option value="1">{{ 'Yes'|t }}</option>
58                     <option value="0">{{ 'No'|t }}</option>
59                 </select>
60                 <label for="edit-type" class="panel__filter-label">{{ 'Slow queryes'|t }}</label>
61             </div>
62             <div class="panel__filter--select">
63                 <select id="edit-database" class="js--live-filter">
64                     <option value="">{{ 'Any'|t }}</option>
65                     <% _.each(data.connections, function( item ){ %>
66                         <option value="<%- item %>"><%- item %></option>
67                     <% }) %>
68                 </select>
69                 <label for="edit-database" class="panel__filter-label">{{ 'Database'|t }}</label>
70             </div>
71
72             <div class="button--flat l-right js--code-toggle--global js--placeholder-visible">{{ 'Swap Placeholders'|t }}</div>
73
74         </form>
75
76         <% _.each( data.queries, function( item, key ){ %>
77         <div class="panel__container<% if (item.time > data.query_highlight_threshold) { %> is--hightlighted <% } %>"
78              data-wp-caller="<%- item.caller.class != null ? item.caller.class.toLowerCase() : '' %>"
79              data-wp-database="<%- item.database %>"
80              data-wp-type="<%- item.type %>"
81              data-wp-hightlighted="<%- (item.time > data.query_highlight_threshold) ? '1' : '0' %>">
82             <div class="panel__expand-header ">
83                     <pre <% if( item.query_args) { %> class="js--code-target"<% } %> >
84                         <code class="sql js--placeholder-query">
85                             <%- item.query %>
86                         </code>
87                         <% if( item.query_args) { %>
88                         <code class="sql js--clipboard-target is--hidden js--original-query">
89                             <%- item.query_args %>
90                         </code>
91                         <% } %>
92                     </pre>
93                 <ul class="list--inline">
94                     <li><b>{{ 'Time'|t }}</b>: <%- Drupal.webprofiler.helpers.printTime(item.time) %></li>
95                     <li><b>{{ 'Caller'|t }}</b>: <%= Drupal.webprofiler.helpers.classLink({"file" : item.caller.file,
96                         "class" : item.caller.class, "line" : item.caller.line, "method" : item.caller.function}) %>
97                     </li>
98                     <li><b>{{ 'Database'|t }}</b>: <%- item.database %></li>
99                     <li><b>{{ 'Target'|t }}</b>: <%- item.target %></li>
100                 </ul>
101
102                 <% if(item.query_args){ %>
103                 <div class="button--flat l-right js--code-toggle">{{ 'Swap Placeholders'|t }}</div>
104                 <% } %>
105                 <% if(item.args){ %>
106                 <div class="button--flat l-right js--panel-toggle">{{ 'Info'|t }}</div>
107                 <% } %>
108                 <!--div class="button--flat l-right js--clipboard-trigger">{{ 'Copy Query'|t }}</div-->
109                 <% if(item.explain){ %>
110                 <div class="button--flat l-right js--explain-trigger"
111                      data-wp-queryPosition="<%- key %>"
112                         >{{ 'Explain'|t }}</div>
113                 <% } %>
114             </div>
115
116             <% if(item.explain){ %>
117             <div class="loader--linear js--loader" style="display: none">
118                 <div class="loader__bar"></div>
119                 <div class="loader__bar"></div>
120                 <div class="loader__bar"></div>
121             </div>
122             <div class="panel__expand-content js--explain-target"></div>
123             <% } %>
124
125             <% if(item.args){ %>
126             <div class="panel__expand-content">
127                 <div class="wp-query-arguments">
128                     <table class="table--duo">
129                         <thead>
130                         <tr>
131                             <th>{{ 'placeholder'|t }}</th>
132                             <th>{{ 'value'|t }}</th>
133                         </tr>
134                         </thead>
135                         <tbody>
136                         <% _.each( item.args, function( item, key ){ %>
137                         <tr>
138                             <td><%- key %></td>
139                             <td><%= Drupal.webprofiler.helpers.frm(item) %></td>
140                         </tr>
141                         <% }); %>
142                         </tbody>
143                     </table>
144                 </div>
145             </div>
146             <% } %>
147         </div>
148         <% }); %>
149     </script>
150     <script id="wp-query-explain-template" type="text/template">
151         <table class="table--compact">
152             <thead>
153             <tr>
154                 <% _.each(rc.data[1], function(value, key, list) { %>
155                 <th><%= key %></th>
156                 <% }); %>
157             </tr>
158             </thead>
159             <% _.each(rc.data, function(value) { %>
160             <tr>
161                 <% _.each(value, function(value2, key, list) { %>
162                 <td><%= value2 %></td>
163                 <% }); %>
164             </tr>
165             <% }); %>
166         </table>
167     </script>
168 {% endblock %}