notifier.html.twig 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. {% extends '@WebProfiler/Profiler/layout.html.twig' %}
  2. {% block toolbar %}
  3. {% set events = collector.events %}
  4. {% if events.messages|length %}
  5. {% set icon %}
  6. {% include('@WebProfiler/Icon/notifier.svg') %}
  7. <span class="sf-toolbar-value">{{ events.messages|length }}</span>
  8. {% endset %}
  9. {% set text %}
  10. <div class="sf-toolbar-info-piece">
  11. <b>Sent notifications</b>
  12. <span class="sf-toolbar-status">{{ events.messages|length }}</span>
  13. </div>
  14. {% for transport in events.transports %}
  15. <div class="sf-toolbar-info-piece">
  16. <b>{{ transport }}</b>
  17. <span class="sf-toolbar-status">{{ events.messages(transport)|length }}</span>
  18. </div>
  19. {% endfor %}
  20. {% endset %}
  21. {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': profiler_url }) }}
  22. {% endif %}
  23. {% endblock %}
  24. {% block head %}
  25. {{ parent() }}
  26. <style type="text/css">
  27. /* utility classes */
  28. .m-t-0 { margin-top: 0 !important; }
  29. .m-t-10 { margin-top: 10px !important; }
  30. /* basic grid */
  31. .row {
  32. display: flex;
  33. flex-wrap: wrap;
  34. margin-right: -15px;
  35. margin-left: -15px;
  36. }
  37. .col {
  38. flex-basis: 0;
  39. flex-grow: 1;
  40. max-width: 100%;
  41. position: relative;
  42. width: 100%;
  43. min-height: 1px;
  44. padding-right: 15px;
  45. padding-left: 15px;
  46. }
  47. .col-4 {
  48. flex: 0 0 33.333333%;
  49. max-width: 33.333333%;
  50. }
  51. /* small tabs */
  52. .sf-tabs-sm .tab-navigation li {
  53. font-size: 14px;
  54. padding: .3em .5em;
  55. }
  56. </style>
  57. {% endblock %}
  58. {% block menu %}
  59. {% set events = collector.events %}
  60. <span class="label {{ events.messages|length ? '' : 'disabled' }}">
  61. <span class="icon">{{ include('@WebProfiler/Icon/notifier.svg') }}</span>
  62. <strong>Notifications</strong>
  63. {% if events.messages|length > 0 %}
  64. <span class="count">
  65. <span>{{ events.messages|length }}</span>
  66. </span>
  67. {% endif %}
  68. </span>
  69. {% endblock %}
  70. {% block panel %}
  71. {% set events = collector.events %}
  72. <h2>Notifications</h2>
  73. {% if not events.messages|length %}
  74. <div class="empty">
  75. <p>No notifications were sent.</p>
  76. </div>
  77. {% endif %}
  78. <div class="metrics">
  79. {% for transport in events.transports %}
  80. <div class="metric">
  81. <span class="value">{{ events.messages(transport)|length }}</span>
  82. <span class="label">{{ transport }}</span>
  83. </div>
  84. {% endfor %}
  85. </div>
  86. {% for transport in events.transports %}
  87. <h3>{{ transport }}</h3>
  88. <div class="card-block">
  89. <div class="sf-tabs sf-tabs-sm">
  90. {% for event in events.events(transport) %}
  91. {% set message = event.message %}
  92. <div class="tab">
  93. <h3 class="tab-title">Message #{{ loop.index }} <small>({{ event.isQueued() ? 'queued' : 'sent' }})</small></h3>
  94. <div class="tab-content">
  95. <div class="card">
  96. <div class="card-block">
  97. <span class="label">Subject</span>
  98. <h2 class="m-t-10">{{ message.getSubject() ?? '(empty)' }}</h2>
  99. </div>
  100. {% if message.getNotification is defined %}
  101. <div class="card-block">
  102. <div class="row">
  103. <div class="col">
  104. <span class="label">Content</span>
  105. <pre class="prewrap">{{ message.getNotification().getContent() ?? '(empty)' }}</pre>
  106. <span class="label">Importance</span>
  107. <pre class="prewrap">{{ message.getNotification().getImportance() }}</pre>
  108. </div>
  109. </div>
  110. </div>
  111. {% endif %}
  112. <div class="card-block">
  113. <div class="sf-tabs sf-tabs-sm">
  114. {% if message.getNotification is defined %}
  115. <div class="tab">
  116. <h3 class="tab-title">Notification</h3>
  117. {% set notification = event.message.getNotification() %}
  118. <div class="tab-content">
  119. <pre class="prewrap" style="max-height: 600px">
  120. {{- 'Subject: ' ~ notification.getSubject() }}<br/>
  121. {{- 'Content: ' ~ notification.getContent() }}<br/>
  122. {{- 'Importance: ' ~ notification.getImportance() }}<br/>
  123. {{- 'Emoji: ' ~ (notification.getEmoji() is empty ? '(empty)' : notification.getEmoji()) }}<br/>
  124. {{- 'Exception: ' ~ notification.getException() ?? '(empty)' }}<br/>
  125. {{- 'ExceptionAsString: ' ~ (notification.getExceptionAsString() is empty ? '(empty)' : notification.getExceptionAsString()) }}
  126. </pre>
  127. </div>
  128. </div>
  129. {% endif %}
  130. <div class="tab">
  131. <h3 class="tab-title">Message Options</h3>
  132. <div class="tab-content">
  133. <pre class="prewrap" style="max-height: 600px">
  134. {%- if message.getOptions() is null %}
  135. {{- '(empty)' }}
  136. {%- else %}
  137. {{- message.getOptions()|json_encode(constant('JSON_PRETTY_PRINT')) }}
  138. {%- endif %}
  139. </pre>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. {% endfor %}
  148. </div>
  149. </div>
  150. {% endfor %}
  151. {% endblock %}