Skip to content
New issue

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

By clicking “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? Sign in to your account

Implement a bernard panel for the symfony webprofiler #54

Merged
merged 1 commit into from
Sep 23, 2017

Conversation

acrobat
Copy link
Member

@acrobat acrobat commented Jul 12, 2017

#50 This PR adds a toolbar item and profiler section for produced messages. A message count and distinct queue count. The profiler section shows a summary of all produced messages and you can view a dump representation of the message object

TODO:

  • Fix the toolbar logo (I currently used the cache logo). Can anyone help and provide a svg for this? Thanks @franmomu

Screenshots:

bernard_profiler
bernard_toolbar

@acrobat acrobat force-pushed the sf-data-collector branch 5 times, most recently from 98411f7 to e911fdf Compare July 12, 2017 18:51
@henrikbjorn
Copy link
Contributor

Thats pretty cool looking 👍 I'll let somebody else okay the code.

Copy link

@fbourigault fbourigault left a comment

Choose a reason for hiding this comment

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

Nice work! However I sent a few suggestion to improve the profiler.
Also, have you tried the profiler with Symfony 2.7 as the profiler was redesigned in 2.8?

{
$envelope = $event->getEnvelope();

$this->data['messages'][$event->getQueue()->__toString()][] = [

Choose a reason for hiding this comment

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

Why not using a string cast (string) $event->getQueue() here?

return;
}

$definition = new Definition(ProducerCollector::class);

Choose a reason for hiding this comment

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

What about declaring this as PHP instead of conditionally loading a xml file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did indeed loaded the xml in an earlier version, but now I indeed use a php configuration. Or did I miss something?

Choose a reason for hiding this comment

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

Why did you moved from xml to php for the collector definition?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh you mean the other way around. I first had it like that but then struggled to make it conditional (wasn't much of an issue) but I refactored it to php then. I don't know if there is a preference to xml or php but I cna change it back!

Choose a reason for hiding this comment

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

As the bundle already use xml for configuring services, I think it's better to stick with it if possible. Anyone else have an opinion on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed!

{% endblock %}

{% block menu %}
{% if collector.messageCount > 0 %}

Choose a reason for hiding this comment

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

You should not hide the menu entry if there is no messages.

{% endfor %}
</tbody>
</table>
{% endfor %}

Choose a reason for hiding this comment

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

Related to the menu block, you should add an else statement here to tell users there is no messages to show.

@acrobat acrobat force-pushed the sf-data-collector branch from e911fdf to fe831b6 Compare July 17, 2017 11:08
@acrobat
Copy link
Member Author

acrobat commented Jul 17, 2017

@fbourigault Thanks for the review! I fixed the commented issues and I will test symfony 2.7 later today!

2 more screenshots for the profiler when no messages are produced
screenshot from 2017-07-17 13-06-43
screenshot from 2017-07-17 13-06-27

@acrobat acrobat force-pushed the sf-data-collector branch from fe831b6 to e2fe183 Compare July 18, 2017 18:38
@acrobat
Copy link
Member Author

acrobat commented Jul 19, 2017

I've tested the toolbar in 2.7 and it's indeed quite broken 😛 so now is the question what we should do

  • Use a fallback check and write specific html for 2.7 and 2.8+
  • bump the symfony minimum requirement to 2.8 and maintain 1 version of the toolbar.

As this is a new feature I tend more to solution 2. HttplugBundle had the same discussion and also went with bumping symfony.

/cc @fbourigault @sagikazarmark

@henrikbjorn
Copy link
Contributor

i vote to bump it.

@fbourigault
Copy link

Me too. Users can safely upgrade from 2.7 to 2.8 (was our conclusion for HttplugBundle).

@acrobat acrobat force-pushed the sf-data-collector branch from e2fe183 to adc5525 Compare July 23, 2017 12:42
@acrobat
Copy link
Member Author

acrobat commented Jul 23, 2017

Minimum symfony version bumped to 2.8. I will test the pr a bit more to make sure it all works.

Only thing left is custom svg icon. Is anyone able to create a icon for the bernard bundle?

@franmomu
Copy link

franmomu commented Sep 21, 2017

Based on the favicon maybe this one:

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
    <path fill-rule="evenodd" clip-rule="evenodd" fill="#AAAAAA " d="M24 22c0 1.1-.9 2-2 2H2c-1.1 0-2-.9-2-2V2C0 .9.9 0 2 0h20c1.1 0 2 .9 2 2v20z"/>
    <path fill-rule="evenodd" clip-rule="evenodd" fill="#222222 " d="M14.626 10.24c-1.266-.44-3.5 0-3.5 0v-3.5c0-.875.582-2.333.582-2.333L7.042 5.79v.95h1.166v12.834s5.327.076 5.327-.076c0-.146 3.423-1.75 3.423-5.174 0-2.923-1.44-3.773-2.332-4.084zm-1.75 7c-1.168 1.167-1.75 0-1.75 0v-4.666s.805-.95 1.75 0c.95.946 1.166 3.5 0 4.667z"/>
</svg>

@acrobat
Copy link
Member Author

acrobat commented Sep 21, 2017

Thanks @franmomu, now I will be able to finish the PR! Is it possible to remove the white (lighter) block in the background so we only have the "b". And make the "b" around 17/18px in height and color #aaa. Thanks!

@franmomu
Copy link

Ok! Something like this:

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
    <path fill="#AAAAAA " d="M14.94 10.03c-1.42-.494-3.92 0-3.92 0V6.11c0-.978.653-2.61.653-2.61L6.45 5.048V6.11h1.305V20.48s5.964.086 5.964-.085c0-.164 3.83-1.96 3.83-5.792 0-3.27-1.612-4.223-2.61-4.57zm-1.96 7.836c-1.307 1.307-1.96 0-1.96 0v-5.224s.902-1.064 1.96 0c1.064 1.06 1.306 3.92 0 5.224z"/>
</svg>

@acrobat
Copy link
Member Author

acrobat commented Sep 22, 2017

Yes, thanks a lot @franmomu!

@acrobat
Copy link
Member Author

acrobat commented Sep 22, 2017

Rebase and squashed. @henrikbjorn @fbourigault this PR is ready for a final review!

@acrobat
Copy link
Member Author

acrobat commented Sep 23, 2017

Let's go! 😄

@acrobat acrobat merged commit 2e2a146 into bernardphp:master Sep 23, 2017
@acrobat acrobat deleted the sf-data-collector branch September 23, 2017 07:23
@sagikazarmark
Copy link
Contributor

Thanks for your work on this, nice thing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants