index.twig 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <h1>{{ database }}</h1>
  2. {% if comment is not empty %}
  3. <p>{% trans 'Database comment:' %} <em>{{ comment }}</em></p>
  4. {% endif %}
  5. <div>
  6. {% for table in tables %}
  7. <div>
  8. <h2>{{ table.name }}</h2>
  9. {% if table.comment is not empty %}
  10. <p>{% trans 'Table comments:' %} <em>{{ table.comment }}</em></p>
  11. {% endif %}
  12. <table class="pma-table print">
  13. <tr>
  14. <th>{% trans 'Column' %}</th>
  15. <th>{% trans 'Type' %}</th>
  16. <th>{% trans 'Null' %}</th>
  17. <th>{% trans 'Default' %}</th>
  18. {% if table.has_relation %}
  19. <th>{% trans 'Links to' %}</th>
  20. {% endif %}
  21. <th>{% trans 'Comments' %}</th>
  22. {% if table.has_mime %}
  23. <th>{% trans 'Media type' %}</th>
  24. {% endif %}
  25. </tr>
  26. {% for column in table.columns %}
  27. <tr>
  28. <td class="nowrap">
  29. {{ column.name }}
  30. {% if column.has_primary_key %}
  31. <em>({% trans 'Primary' %})</em>
  32. {% endif %}
  33. </td>
  34. <td lang="en" dir="ltr"{{ 'set' != column.type and 'enum' != column.type ? ' class="nowrap"' }}>
  35. {{ column.print_type }}
  36. </td>
  37. <td>{{ column.is_nullable ? 'Yes'|trans : 'No'|trans }}</td>
  38. <td class="nowrap">
  39. {% if column.default is null and column.is_nullable %}
  40. <em>NULL</em>
  41. {% else %}
  42. {{ column.default }}
  43. {% endif %}
  44. </td>
  45. {% if table.has_relation %}
  46. <td>{{ column.relation }}</td>
  47. {% endif %}
  48. <td>{{ column.comment }}</td>
  49. {% if table.has_mime %}
  50. <td>{{ column.mime }}</td>
  51. {% endif %}
  52. </tr>
  53. {% endfor %}
  54. </table>
  55. {% if table.indexes is not empty %}
  56. <h3>{% trans 'Indexes' %}</h3>
  57. <div class="responsivetable jsresponsive">
  58. <table class="pma-table" id="table_index">
  59. <thead>
  60. <tr>
  61. <th>{% trans 'Keyname' %}</th>
  62. <th>{% trans 'Type' %}</th>
  63. <th>{% trans 'Unique' %}</th>
  64. <th>{% trans 'Packed' %}</th>
  65. <th>{% trans 'Column' %}</th>
  66. <th>{% trans 'Cardinality' %}</th>
  67. <th>{% trans 'Collation' %}</th>
  68. <th>{% trans 'Null' %}</th>
  69. <th>{% trans 'Comment' %}</th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. {% for index in table.indexes %}
  74. {% set columns_count = index.getColumnCount() %}
  75. <tr>
  76. <td rowspan="{{ columns_count }}">{{ index.getName() }}</td>
  77. <td rowspan="{{ columns_count }}">{{ index.getType()|default(index.getChoice()) }}</td>
  78. <td rowspan="{{ columns_count }}">{{ index.isUnique() ? 'Yes'|trans : 'No'|trans }}</td>
  79. <td rowspan="{{ columns_count }}">{{ index.isPacked()|raw }}</td>
  80. {% for column in index.getColumns() %}
  81. {% if column.getSeqInIndex() > 1 %}
  82. <tr>
  83. {% endif %}
  84. <td>
  85. {{ column.getName() }}
  86. {% if column.getSubPart() is not empty %}
  87. ({{ column.getSubPart() }})
  88. {% endif %}
  89. </td>
  90. <td>{{ column.getCardinality() }}</td>
  91. <td>{{ column.getCollation() }}</td>
  92. <td>{{ column.getNull(true) }}</td>
  93. {% if column.getSeqInIndex() == 1 %}
  94. <td rowspan="{{ columns_count }}">{{ index.getComments() }}</td>
  95. {% endif %}
  96. </tr>
  97. {% endfor %}
  98. {% endfor %}
  99. </tbody>
  100. </table>
  101. </div>
  102. {% else %}
  103. <p>{% trans 'No index defined!' %}</p>
  104. {% endif %}
  105. </div>
  106. {% endfor %}
  107. </div>
  108. <p class="print_ignore">
  109. <input type="button" class="btn btn-secondary button" id="print" value="{% trans 'Print' %}">
  110. </p>