|
1 | 1 | {% extends '@WebProfiler/Profiler/layout.html.twig' %}
|
2 | 2 |
|
3 |
| -{% import _self as helper %} |
4 |
| - |
5 | 3 | {% block toolbar %}
|
6 | 4 | {% if collector.data.unavailable_migrations_count is defined %}
|
7 | 5 | {% set unavailable_migrations = collector.data.unavailable_migrations_count %}
|
|
13 | 11 | {% set status_color = new_migrations > 0 ? 'red' : status_color %}
|
14 | 12 |
|
15 | 13 | {% set icon %}
|
16 |
| - {{ include('@DoctrineMigrations/Collector/icon.svg') }} |
| 14 | + {% if profiler_markup_version < 3 %} |
| 15 | + {{ include('@DoctrineMigrations/Collector/icon.svg') }} |
| 16 | + {% else %} |
| 17 | + {{ include('@DoctrineMigrations/Collector/icon-v3.svg') }} |
| 18 | + {% endif %} |
| 19 | + |
17 | 20 | <span class="sf-toolbar-value">{{ new_migrations + unavailable_migrations }}</span>
|
18 | 21 | {% endset %}
|
19 | 22 |
|
20 | 23 | {% set text %}
|
21 |
| - <div class="sf-toolbar-info-piece"> |
22 |
| - <b>Current</b> |
23 |
| - <span>{{ executed_migrations > 0 ? collector.data.executed_migrations|last.version|split('\\')|last : 'n/a' }}</span> |
24 |
| - </div> |
25 |
| - <div class="sf-toolbar-info-piece"> |
26 |
| - <b>Executed</b> |
27 |
| - <span class="sf-toolbar-status">{{ executed_migrations }}</span> |
28 |
| - </div> |
29 |
| - <div class="sf-toolbar-info-piece"> |
30 |
| - <b>Executed Unavailable</b> |
31 |
| - <span class="sf-toolbar-status {{ unavailable_migrations > 0 ? 'sf-toolbar-status-yellow' }}">{{ unavailable_migrations }}</span> |
32 |
| - </div> |
33 |
| - <div class="sf-toolbar-info-piece"> |
34 |
| - <b>Available</b> |
35 |
| - <span class="sf-toolbar-status">{{ available_migrations }}</span> |
| 24 | + <div class="sf-toolbar-info-group"> |
| 25 | + <div class="sf-toolbar-info-piece"> |
| 26 | + <b>Current Migration</b> |
| 27 | + <span>{{ executed_migrations > 0 ? collector.data.executed_migrations|last.version|split('\\')|last : 'n/a' }}</span> |
| 28 | + </div> |
36 | 29 | </div>
|
37 |
| - <div class="sf-toolbar-info-piece"> |
38 |
| - <b>New</b> |
39 |
| - <span class="sf-toolbar-status {{ new_migrations > 0 ? 'sf-toolbar-status-red' }}">{{ new_migrations }}</span> |
| 30 | + |
| 31 | + <div class="sf-toolbar-info-group"> |
| 32 | + <div class="sf-toolbar-info-piece"> |
| 33 | + <span class="sf-toolbar-header"> |
| 34 | + <b>Database Migrations</b> |
| 35 | + </span> |
| 36 | + </div> |
| 37 | + <div class="sf-toolbar-info-piece"> |
| 38 | + <b>Executed</b> |
| 39 | + <span class="sf-toolbar-status">{{ executed_migrations }}</span> |
| 40 | + </div> |
| 41 | + <div class="sf-toolbar-info-piece"> |
| 42 | + <b>Unavailable</b> |
| 43 | + <span class="sf-toolbar-status {{ unavailable_migrations > 0 ? 'sf-toolbar-status-yellow' }}">{{ unavailable_migrations }}</span> |
| 44 | + </div> |
| 45 | + <div class="sf-toolbar-info-piece"> |
| 46 | + <b>Available</b> |
| 47 | + <span class="sf-toolbar-status">{{ available_migrations }}</span> |
| 48 | + </div> |
| 49 | + <div class="sf-toolbar-info-piece"> |
| 50 | + <b>New</b> |
| 51 | + <span class="sf-toolbar-status {{ new_migrations > 0 ? 'sf-toolbar-status-red' }}">{{ new_migrations }}</span> |
| 52 | + </div> |
40 | 53 | </div>
|
41 | 54 | {% endset %}
|
42 | 55 |
|
|
45 | 58 | {% endif %}
|
46 | 59 | {% endblock %}
|
47 | 60 |
|
48 |
| - |
49 | 61 | {% block menu %}
|
50 | 62 | {% if collector.data.unavailable_migrations_count is defined %}
|
51 | 63 | {% set unavailable_migrations = collector.data.unavailable_migrations_count %}
|
52 | 64 | {% set new_migrations = collector.data.new_migrations|length %}
|
53 | 65 | {% set label = unavailable_migrations > 0 ? 'label-status-warning' : '' %}
|
54 | 66 | {% set label = new_migrations > 0 ? 'label-status-error' : label %}
|
55 | 67 | <span class="label {{ label }}">
|
56 |
| - <span class="icon">{{ include('@DoctrineMigrations/Collector/icon.svg') }}</span> |
| 68 | + <span class="icon"> |
| 69 | + {% if profiler_markup_version < 3 %} |
| 70 | + {{ include('@DoctrineMigrations/Collector/icon.svg') }} |
| 71 | + {% else %} |
| 72 | + {{ include('@DoctrineMigrations/Collector/icon-v3.svg') }} |
| 73 | + {% endif %} |
| 74 | + </span> |
| 75 | + |
57 | 76 | <strong>Migrations</strong>
|
58 | 77 | {% if unavailable_migrations > 0 or new_migrations > 0 %}
|
59 | 78 | <span class="count">
|
|
65 | 84 | {% endblock %}
|
66 | 85 |
|
67 | 86 | {% block panel %}
|
| 87 | + {% set num_executed_migrations = collector.data.executed_migrations|length %} |
| 88 | + {% set num_unavailable_migrations = collector.data.unavailable_migrations_count %} |
| 89 | + {% set num_available_migrations = collector.data.available_migrations_count %} |
| 90 | + {% set num_new_migrations = collector.data.new_migrations|length %} |
| 91 | + |
68 | 92 | <h2>Doctrine Migrations</h2>
|
69 | 93 | <div class="metrics">
|
70 | 94 | <div class="metric">
|
71 |
| - <span class="value">{{ collector.data.executed_migrations|length }}</span> |
| 95 | + <span class="value">{{ num_executed_migrations }}</span> |
72 | 96 | <span class="label">Executed</span>
|
73 | 97 | </div>
|
| 98 | + |
| 99 | + {% if profiler_markup_version >= 3 %} |
| 100 | + <div class="metric-group"> |
| 101 | + {% endif %} |
| 102 | + |
74 | 103 | <div class="metric">
|
75 |
| - <span class="value">{{ collector.data.unavailable_migrations_count }}</span> |
76 |
| - <span class="label">Executed Unavailable</span> |
| 104 | + <span class="value">{{ num_unavailable_migrations }}</span> |
| 105 | + <span class="label">Unavailable</span> |
77 | 106 | </div>
|
78 | 107 | <div class="metric">
|
79 |
| - <span class="value">{{ collector.data.available_migrations_count }}</span> |
| 108 | + <span class="value">{{ num_available_migrations }}</span> |
80 | 109 | <span class="label">Available</span>
|
81 | 110 | </div>
|
82 | 111 | <div class="metric">
|
83 |
| - <span class="value">{{ collector.data.new_migrations|length }}</span> |
| 112 | + <span class="value">{{ num_new_migrations }}</span> |
84 | 113 | <span class="label">New</span>
|
85 | 114 | </div>
|
| 115 | + |
| 116 | + {% if profiler_markup_version >= 3 %} |
| 117 | + </div> {# closes the <div class="metric-group"> #} |
| 118 | + {% endif %} |
| 119 | + </div> |
| 120 | + |
| 121 | + <div class="sf-tabs"> |
| 122 | + <div class="tab"> |
| 123 | + <h3 class="tab-title"> |
| 124 | + Migrations |
| 125 | + <span class="badge {{ num_new_migrations > 0 ? 'status-error' : num_unavailable_migrations > 0 ? 'status-warning' }}"> |
| 126 | + {{ num_new_migrations > 0 ? num_new_migrations : num_unavailable_migrations > 0 ? num_unavailable_migrations : num_executed_migrations }} |
| 127 | + </span> |
| 128 | + </h3> |
| 129 | + |
| 130 | + <div class="tab-content"> |
| 131 | + {{ _self.render_migration_details(collector, profiler_markup_version) }} |
| 132 | + </div> |
| 133 | + </div> |
| 134 | + |
| 135 | + <div class="tab"> |
| 136 | + <h3 class="tab-title">Configuration</h3> |
| 137 | + |
| 138 | + <div class="tab-content"> |
| 139 | + {{ _self.render_configuration_details(collector, profiler_markup_version) }} |
| 140 | + </div> |
| 141 | + </div> |
86 | 142 | </div>
|
| 143 | +{% endblock %} |
87 | 144 |
|
88 |
| - <h3>Configuration</h3> |
| 145 | +{% macro render_migration_details(collector) %} |
89 | 146 | <table>
|
90 | 147 | <thead>
|
91 |
| - <tr> |
92 |
| - <th colspan="2" class="colored font-normal">Storage</th> |
93 |
| - </tr> |
| 148 | + <tr> |
| 149 | + <th class="colored font-normal">Version</th> |
| 150 | + <th class="colored font-normal">Description</th> |
| 151 | + <th class="colored font-normal">Status</th> |
| 152 | + <th class="colored font-normal">Executed at</th> |
| 153 | + <th class="colored font-normal text-right">Execution time</th> |
| 154 | + </tr> |
| 155 | + </thead> |
| 156 | + {% for migration in collector.data.new_migrations %} |
| 157 | + {{ _self.render_migration(migration) }} |
| 158 | + {% endfor %} |
| 159 | + |
| 160 | + {% for migration in collector.data.executed_migrations|reverse %} |
| 161 | + {{ _self.render_migration(migration) }} |
| 162 | + {% endfor %} |
| 163 | + </table> |
| 164 | +{% endmacro %} |
| 165 | + |
| 166 | +{% macro render_configuration_details(collector) %} |
| 167 | + <table> |
| 168 | + <thead> |
| 169 | + <tr> |
| 170 | + <th colspan="2" class="colored font-normal">Storage</th> |
| 171 | + </tr> |
94 | 172 | </thead>
|
95 | 173 | <tr>
|
96 | 174 | <td class="font-normal">Type</td>
|
|
109 | 187 | </tr>
|
110 | 188 | {% endif %}
|
111 | 189 | </table>
|
| 190 | + |
112 | 191 | <table>
|
113 | 192 | <thead>
|
114 |
| - <tr> |
115 |
| - <th colspan="2" class="colored font-normal">Database</th> |
116 |
| - </tr> |
| 193 | + <tr> |
| 194 | + <th colspan="2" class="colored font-normal">Database</th> |
| 195 | + </tr> |
117 | 196 | </thead>
|
118 | 197 | <tr>
|
119 | 198 | <td class="font-normal">Driver</td>
|
|
124 | 203 | <td class="font-normal">{{ collector.data.name }}</td>
|
125 | 204 | </tr>
|
126 | 205 | </table>
|
| 206 | + |
127 | 207 | <table>
|
128 | 208 | <thead>
|
129 |
| - <tr> |
130 |
| - <th colspan="2" class="colored font-normal">Migration Namespaces</th> |
131 |
| - </tr> |
| 209 | + <tr> |
| 210 | + <th colspan="2" class="colored font-normal">Migration Namespaces</th> |
| 211 | + </tr> |
132 | 212 | </thead>
|
133 | 213 | {% for namespace, directory in collector.data.namespaces %}
|
134 | 214 | <tr>
|
|
137 | 217 | </tr>
|
138 | 218 | {% endfor %}
|
139 | 219 | </table>
|
| 220 | +{% endmacro %} |
140 | 221 |
|
141 |
| - <h3>Migrations</h3> |
142 |
| - <table> |
143 |
| - <thead> |
144 |
| - <tr> |
145 |
| - <th class="colored font-normal">Version</th> |
146 |
| - <th class="colored font-normal">Description</th> |
147 |
| - <th class="colored font-normal">Status</th> |
148 |
| - <th class="colored font-normal">Executed at</th> |
149 |
| - <th class="colored font-normal">Execution time</th> |
150 |
| - </tr> |
151 |
| - </thead> |
152 |
| - {% for migration in collector.data.new_migrations %} |
153 |
| - {{ helper.render_migration(migration) }} |
154 |
| - {% endfor %} |
155 |
| - |
156 |
| - {% for migration in collector.data.executed_migrations|reverse %} |
157 |
| - {{ helper.render_migration(migration) }} |
158 |
| - {% endfor %} |
159 |
| - </table> |
160 |
| -{% endblock %} |
161 |
| - |
162 |
| -{% macro render_migration(migration) %} |
| 222 | +{% macro render_migration(migration, profiler_markup_version) %} |
163 | 223 | <tr>
|
164 | 224 | <td class="font-normal">
|
165 | 225 | {% if migration.file %}
|
|
169 | 229 | {% endif %}
|
170 | 230 | </td>
|
171 | 231 | <td class="font-normal">{{ migration.description }}</td>
|
172 |
| - <td class="font-normal"> |
| 232 | + <td class="font-normal align-right"> |
173 | 233 | {% if migration.is_new %}
|
174 |
| - <span class="label status-error">NOT EXECUTED</span> |
| 234 | + <span class="{{ profiler_markup_version >= 3 ? 'badge badge-error' : 'label status-error' }}">NOT EXECUTED</span> |
175 | 235 | {% elseif migration.is_unavailable %}
|
176 |
| - <span class="label status-warning">UNAVAILABLE</span> |
| 236 | + <span class="{{ profiler_markup_version >= 3 ? 'badge badge-warning' : 'label status-warning' }}">UNAVAILABLE</span> |
| 237 | + {% else %} |
| 238 | + <span class="{{ profiler_markup_version >= 3 ? 'badge badge-success' : 'label status-success' }}">EXECUTED</span> |
| 239 | + {% endif %} |
| 240 | + </td> |
| 241 | + <td class="font-normal">{{ migration.executed_at ? migration.executed_at|date('M j, Y H:i') : 'n/a' }}</td> |
| 242 | + <td class="font-normal text-right"> |
| 243 | + {% if migration.execution_time is null %} |
| 244 | + n/a |
| 245 | + {% elseif migration.execution_time < 1 %} |
| 246 | + {{ (migration.execution_time * 1000)|number_format(0) }} ms |
177 | 247 | {% else %}
|
178 |
| - <span class="label status-success">EXECUTED</span> |
| 248 | + {{ migration.execution_time|number_format(2) }} seconds |
179 | 249 | {% endif %}
|
180 | 250 | </td>
|
181 |
| - <td class="font-normal">{{ migration.executed_at ? migration.executed_at|date : 'n/a' }}</td> |
182 |
| - <td class="font-normal">{{ migration.execution_time|default('n/a') }}</td> |
183 | 251 | </tr>
|
184 | 252 | {% endmacro %}
|
0 commit comments