Skip to content

[bundle] Fix panel rendering when message body is an object #442

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions pkg/enqueue-bundle/Resources/views/Profiler/panel.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,21 @@
<td>{{ loop.index }}</td>
<td>{{ sentMessage.topic|default(null) }}</td>
<td>{{ sentMessage.command|default(null) }}</td>
<td style="width: 70%">
<span class="metadata">
<span>
{{ collector.ensureString(sentMessage.body)[0:40] }}{% if collector.ensureString(sentMessage.body)[0:40] != collector.ensureString(sentMessage.body) %}...{% endif %}
</span>

{% if collector.ensureString(sentMessage.body)|length > 40 %}
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#message-body-{{ loop.index }}" data-toggle-alt-content="Hide body">Show body</a>

<div id="message-body-{{ loop.index }}" class="context sf-toggle-content sf-toggle-hidden">
{{ profiler_dump(sentMessage.body) }}
</div>
{% endif %}
<td style="width: 70%" class="metadata">
<span>
{% set body = collector.ensureString(sentMessage.body) %}
{{ body|length > 40 ? body|slice(0, 40) ~ '...' : body }}
</span>
{% if body|length > 40 %}
<a class="btn btn-link text-small sf-toggle"
data-toggle-selector="#message-body-{{ loop.index }}"
data-toggle-alt-content="Hide body"
>Show body</a>
<div id="message-body-{{ loop.index }}"
class="context sf-toggle-content sf-toggle-hidden">
<pre>{{ body }}</pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont you use profiler_dump here?

Copy link
Contributor Author

@thePanz thePanz May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The profiler_dump expects a Data object and fails when the $body is an object.
The change here ensures the displayed value is a json string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makasim any updates on this?

</div>
{% endif %}
<td>
<span title="{{ sentMessage.priority }}">{{ collector.prettyPrintPriority(sentMessage.priority) }}</span>
</td>
Expand Down