Commit e9354f8e authored by lussoluca's avatar lussoluca

Fix RequestDataCollector template

parent 6848e73d
......@@ -81,4 +81,33 @@ class RequestDataCollector extends BaseRequestDataCollector implements DrupalDat
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAQAAADYBBcfAAACvElEQVR42tVTbUhTYRTerDCnKVoUUr/KCZmypA9Koet0bXNLJ5XazDJ/WFaCUY0pExRZXxYiJgsxWWjkaL+yK+po1gjyR2QfmqWxtBmaBtqWGnabT++c11Fu4l/P4VzOPc95zoHznsNZodIbLDdRcKnc1Bu8DAK45ZsOnykQNMopsNooLxCknb0cDq5vml9FtHiIgpBR0R6iihYyFMTDt2Lg56ObPkI6TMGXSof1EV67IqCwisJSWliFAG/E0CfFIiebdNypcxi/1zgyFiIiZ3sJQr0RQx5frLa6k7SOKRo3oMFNR5t62h2rttKXEOKFqDCxtXNmmBokO2KKTlp3IdWuT2dYRNGKwEXEBCcL172G5FG0aIxC0kR9PBTVH1kkwQn+IqJnCE33EalVzT9GJQS1tAdD3CKicJYFrxqx7W2ejCEdZy1FiC5tZxHhLJKOZaRdQJAyV/YAvDliySALHxmxR4Hqe2iwvaOR/CEuZYJFSgYhVbZRkA8KGdEktrqnqra90NndCdkt77fjIHIhexOrfO6O3bbbOj/rqu5IptgyR3sU93QbOYhquZK4MCDp0Ina/PLsu5JvbCTRaapUdUmIV/RzoMdsk/0hWRNdAvKOmvqlN0drsJbJf1P4YsQ5lGrJeuosiOUgbOC8cto3LfOXTdVd7BqZsQKbse+0jUL6WPcesqs4MNSUTQAxGjwFiC8m3yzmqwHJBWYKBJ9WNqW/dHkpU/osch1Yj5RJfXPfSEe/2UPsN490NPfZG5CKyJmcV5ayHyzy7BMqsXfuHhGK/cjAIeSpR92gehR55D8TcQhDEKJwytBJ4fr4NULvrEM8NszfJPyxDoHYAQ1oPCWmIX4gifmDS/DV2DKeb25FHWr76yEG7/9L4YFPeiQQ4/8LkgJ8Et+NncTCsYqzXAEXa7CWdPZzGWdlyV+vST0JanfPvwAAAABJRU5ErkJggg==';
}
/**
* @return array|string
*/
public function getData() {
// Drupal 8.5+ uses Symfony 3.4.x that changes the way the Request data are
// collected. Data is altered with \Symfony\Component\HttpKernel\DataCollector\DataCollector::cloneVar.
// The stored data (of type \Symfony\Component\VarDumper\Cloner\Data) is
// suitable to be converted to a string by a Dumper (\Symfony\Component\VarDumper\Dumper\DataDumperInterface).
// In our implementation however we need that data as an array, to be later
// converted in a json response by a REST endpoint. We need to refactor the
// whole way Web Profiler works to allow that. At the moment we just
// retrieve the raw Data value and do some string manipulation to clean the
// output a bit.
$data = $this->data->getValue(TRUE);
unset($data['request_attributes']['_route_params']);
unset($data['request_attributes']['_access_result']);
$route_object = [];
foreach($data['request_attributes']['_route_object'] as $key => $result) {
$key = str_replace("\0", '', $key);
$key = str_replace('Symfony\Component\Routing\Route', 'Symfony\Component\Routing\Route::', $key);
$route_object[$key] = $result;
}
$data['request_attributes']['_route_object'] = $route_object;
return $data;
}
}
......@@ -46,9 +46,10 @@
<% if (!_.isEmpty(data.request_query)) { %>
<div class="panel__container">
<h3>GET parameters</h3>
<table class="table--duo">
<thead>
<th>{{ 'GET Parameters'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
......@@ -65,9 +66,10 @@
<% if (!_.isEmpty(data.request_request)) { %>
<div class="panel__container">
<h3>POST parameters</h3>
<table class="table--duo">
<thead>
<th>{{ 'POST Parameters'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
......@@ -83,18 +85,20 @@
<% } %>
<div class="panel__container">
<h3>Request attributes</h3>
<table class="table--duo">
<thead>
<th>{{ 'Attributes'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
<% _.each( data.request_attributes, function( item, key ){ %>
<tr>
<td><%- key %></td>
<% if(key == '_controller') { %>
<td><%= Drupal.webprofiler.helpers.classLink(data.controller) %></td>
<% } else if(key == '_form') { %>
<td><%= Drupal.webprofiler.helpers.classLink(data.controller) %></td>
<% } else { %>
<td><%= Drupal.webprofiler.helpers.frm(item) %></td>
<% } %>
......@@ -106,9 +110,10 @@
<% if (!_.isEmpty(data.request_cookies)) { %>
<div class="panel__container">
<h3>Cookies</h3>
<table class="table--duo">
<thead>
<th>{{ 'Cookies'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
......@@ -124,9 +129,10 @@
<% } %>
<div class="panel__container">
<h3>Request headers</h3>
<table class="table--duo">
<thead>
<th>{{ 'Request headers'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
......@@ -142,16 +148,18 @@
<% if (!_.isEmpty(data.content)) { %>
<div class="panel__container">
<h3>Raw content</h3>
<div class="h--word-broken"><%- data.content %></div>
</div>
<% } %>
<% if (!_.isEmpty(data.access_check)) { %>
<div class="panel__container">
<h3>Access check</h3>
<table class="table--duo">
<thead>
<th>{{ 'Path'|t }}</th>
<th>{{ 'Access check'|t }}</th>
<th>{{ 'Service'|t }}</th>
</thead>
<tbody>
<% _.each(data.access_check, function(items, key){ %>
......@@ -170,9 +178,10 @@
<% } %>
<div class="panel__container">
<h3>Server Parameters</h3>
<table class="table--duo">
<thead>
<th>{{ 'Server Parameters'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
......@@ -187,9 +196,10 @@
</div>
<div class="panel__container">
<h3>Response headers</h3>
<table class="table--duo">
<thead>
<th>{{ 'Response headers'|t }}</th>
<th>{{ 'Name'|t }}</th>
<th>{{ 'Value'|t }}</th>
</thead>
<tbody>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment