|
| 1 | +{% extends '@WebProfiler/Profiler/layout.html.twig' %} |
| 2 | + |
| 3 | +{% import _self as helper %} |
| 4 | + |
| 5 | +{% block toolbar %} |
| 6 | + {% set unavailable_migrations = collector.data.unavailable_migrations|length %} |
| 7 | + {% set new_migrations = collector.data.new_migrations|length %} |
| 8 | + {% if unavailable_migrations > 0 or new_migrations > 0 %} |
| 9 | + {% set executed_migrations = collector.data.executed_migrations|length %} |
| 10 | + {% set available_migrations = collector.data.available_migrations|length %} |
| 11 | + {% set status_color = unavailable_migrations > 0 ? 'yellow' : '' %} |
| 12 | + {% set status_color = new_migrations > 0 ? 'red' : status_color %} |
| 13 | + |
| 14 | + {% set icon %} |
| 15 | + {{ include('@DoctrineMigrations/Collector/icon.svg') }} |
| 16 | + <span class="sf-toolbar-value">{{ new_migrations + unavailable_migrations }}</span> |
| 17 | + {% endset %} |
| 18 | + |
| 19 | + {% set text %} |
| 20 | + <div class="sf-toolbar-info-piece"> |
| 21 | + <b>Current</b> |
| 22 | + <span>{{ collector.data.executed_migrations|last.version|split('\\')|last }}</span> |
| 23 | + </div> |
| 24 | + <div class="sf-toolbar-info-piece"> |
| 25 | + <b>Executed</b> |
| 26 | + <span class="sf-toolbar-status">{{ executed_migrations }}</span> |
| 27 | + </div> |
| 28 | + <div class="sf-toolbar-info-piece"> |
| 29 | + <b>Executed Unavailable</b> |
| 30 | + <span class="sf-toolbar-status {{ unavailable_migrations > 0 ? 'sf-toolbar-status-yellow' }}">{{ unavailable_migrations }}</span> |
| 31 | + </div> |
| 32 | + <div class="sf-toolbar-info-piece"> |
| 33 | + <b>Available</b> |
| 34 | + <span class="sf-toolbar-status">{{ available_migrations }}</span> |
| 35 | + </div> |
| 36 | + <div class="sf-toolbar-info-piece"> |
| 37 | + <b>New</b> |
| 38 | + <span class="sf-toolbar-status {{ new_migrations > 0 ? 'sf-toolbar-status-red' }}">{{ new_migrations }}</span> |
| 39 | + </div> |
| 40 | + {% endset %} |
| 41 | + |
| 42 | + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} |
| 43 | + {% endif %} |
| 44 | +{% endblock %} |
| 45 | + |
| 46 | + |
| 47 | +{% block menu %} |
| 48 | + {% set unavailable_migrations = collector.data.unavailable_migrations|length %} |
| 49 | + {% set new_migrations = collector.data.new_migrations|length %} |
| 50 | + {% set label = unavailable_migrations > 0 ? 'label-status-warning' : '' %} |
| 51 | + {% set label = new_migrations > 0 ? 'label-status-error' : label %} |
| 52 | + <span class="label {{ label }}"> |
| 53 | + <span class="icon">{{ include('@DoctrineMigrations/Collector/icon.svg') }}</span> |
| 54 | + <strong>Migrations</strong> |
| 55 | + {% if unavailable_migrations > 0 or new_migrations > 0 %} |
| 56 | + <span class="count"> |
| 57 | + <span>{{ new_migrations + unavailable_migrations }}</span> |
| 58 | + </span> |
| 59 | + {% endif %} |
| 60 | + </span> |
| 61 | +{% endblock %} |
| 62 | + |
| 63 | +{% block panel %} |
| 64 | + <h2>Doctrine Migrations</h2> |
| 65 | + <div class="metrics"> |
| 66 | + <div class="metric"> |
| 67 | + <span class="value">{{ collector.data.executed_migrations|length }}</span> |
| 68 | + <span class="label">Executed</span> |
| 69 | + </div> |
| 70 | + <div class="metric"> |
| 71 | + <span class="value">{{ collector.data.unavailable_migrations|length }}</span> |
| 72 | + <span class="label">Executed Unavailable</span> |
| 73 | + </div> |
| 74 | + <div class="metric"> |
| 75 | + <span class="value">{{ collector.data.available_migrations|length }}</span> |
| 76 | + <span class="label">Available</span> |
| 77 | + </div> |
| 78 | + <div class="metric"> |
| 79 | + <span class="value">{{ collector.data.new_migrations|length }}</span> |
| 80 | + <span class="label">New</span> |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + |
| 84 | + <h3>Configuration</h3> |
| 85 | + <table> |
| 86 | + <thead> |
| 87 | + <tr> |
| 88 | + <th colspan="2" class="colored font-normal">Storage</th> |
| 89 | + </tr> |
| 90 | + </thead> |
| 91 | + <tr> |
| 92 | + <td class="font-normal">Type</td> |
| 93 | + <td class="font-normal">{{ collector.data.storage }}</td> |
| 94 | + </tr> |
| 95 | + {% if collector.data.table is defined %} |
| 96 | + <tr> |
| 97 | + <td class="font-normal">Table Name</td> |
| 98 | + <td class="font-normal">{{ collector.data.table }}</td> |
| 99 | + </tr> |
| 100 | + {% endif %} |
| 101 | + {% if collector.data.column is defined %} |
| 102 | + <tr> |
| 103 | + <td class="font-normal">Column Name</td> |
| 104 | + <td class="font-normal">{{ collector.data.column }}</td> |
| 105 | + </tr> |
| 106 | + {% endif %} |
| 107 | + </table> |
| 108 | + <table> |
| 109 | + <thead> |
| 110 | + <tr> |
| 111 | + <th colspan="2" class="colored font-normal">Database</th> |
| 112 | + </tr> |
| 113 | + </thead> |
| 114 | + <tr> |
| 115 | + <td class="font-normal">Driver</td> |
| 116 | + <td class="font-normal">{{ collector.data.driver }}</td> |
| 117 | + </tr> |
| 118 | + <tr> |
| 119 | + <td class="font-normal">Name</td> |
| 120 | + <td class="font-normal">{{ collector.data.name }}</td> |
| 121 | + </tr> |
| 122 | + </table> |
| 123 | + <table> |
| 124 | + <thead> |
| 125 | + <tr> |
| 126 | + <th colspan="2" class="colored font-normal">Migration Namespaces</th> |
| 127 | + </tr> |
| 128 | + </thead> |
| 129 | + {% for namespace, directory in collector.data.namespaces %} |
| 130 | + <tr> |
| 131 | + <td class="font-normal">{{ namespace }}</td> |
| 132 | + <td class="font-normal">{{ directory }}</td> |
| 133 | + </tr> |
| 134 | + {% endfor %} |
| 135 | + </table> |
| 136 | + |
| 137 | + <h3>Migrations</h3> |
| 138 | + <table> |
| 139 | + <thead> |
| 140 | + <tr> |
| 141 | + <th class="colored font-normal">Version</th> |
| 142 | + <th class="colored font-normal">Description</th> |
| 143 | + <th class="colored font-normal">Status</th> |
| 144 | + <th class="colored font-normal">Executed at</th> |
| 145 | + <th class="colored font-normal">Execution time</th> |
| 146 | + </tr> |
| 147 | + </thead> |
| 148 | + {% for migration in collector.data.new_migrations %} |
| 149 | + {{ helper.render_migration(migration) }} |
| 150 | + {% endfor %} |
| 151 | + |
| 152 | + {% for migration in collector.data.executed_migrations|reverse %} |
| 153 | + {{ helper.render_migration(migration) }} |
| 154 | + {% endfor %} |
| 155 | + </table> |
| 156 | +{% endblock %} |
| 157 | + |
| 158 | +{% macro render_migration(migration) %} |
| 159 | + |
| 160 | + <tr> |
| 161 | + <td class="font-normal"> |
| 162 | + {% if migration.file %} |
| 163 | + <a href="{{ migration.file|file_link(1) }}" title="{{ migration.file }}">{{ migration.version }}</a> |
| 164 | + {% else %} |
| 165 | + {{ migration.version }} |
| 166 | + {% endif %} |
| 167 | + </td> |
| 168 | + <td class="font-normal">{{ migration.description }}</td> |
| 169 | + <td class="font-normal"> |
| 170 | + {% if migration.is_new %} |
| 171 | + <span class="label status-error">NOT EXECUTED</span> |
| 172 | + {% elseif migration.is_unavailable %} |
| 173 | + <span class="label status-warning">UNAVAILABLE</span> |
| 174 | + {% else %} |
| 175 | + <span class="label status-success">EXECUTED</span> |
| 176 | + {% endif %} |
| 177 | + </td> |
| 178 | + <td class="font-normal">{{ migration.executed_at ? migration.executed_at|date : 'n/a' }}</td> |
| 179 | + <td class="font-normal">{{ migration.execution_time|default('n/a') }}</td> |
| 180 | + </tr> |
| 181 | +{% endmacro %} |
0 commit comments