display_partitions.twig 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <div id="partitions">
  2. <fieldset>
  3. <legend>
  4. {% trans 'Partitions' %}
  5. {{ Util_showMySQLDocu('partitioning') }}
  6. </legend>
  7. {% if partitions is empty %}
  8. {{ Message_notice('No partitioning defined!'|trans) }}
  9. {% else %}
  10. <p>
  11. {% trans 'Partitioned by:' %}
  12. <code>{{ partition_method }}({{ partition_expression }})</code>
  13. </p>
  14. {% if has_sub_partitions %}
  15. <p>
  16. {% trans 'Sub partitioned by:' %}
  17. <code>{{ sub_partition_method }}({{ sub_partition_expression }})</code>
  18. <p>
  19. {% endif %}
  20. <table>
  21. <thead>
  22. <tr>
  23. <th colspan="2">#</th>
  24. <th>{% trans 'Partition' %}</th>
  25. {% if has_description %}
  26. <th>{% trans 'Expression' %}</th>
  27. {% endif %}
  28. <th>{% trans 'Rows' %}</th>
  29. <th>{% trans 'Data length' %}</th>
  30. <th>{% trans 'Index length' %}</th>
  31. <th>{% trans 'Comment' %}</th>
  32. <th colspan="{{ range_or_list ? '7' : '6' }}">
  33. {% trans 'Action' %}
  34. </th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. {% for partition in partitions %}
  39. <tr class="noclick{{ has_sub_partitions ? ' marked' }}">
  40. {% if has_sub_partitions %}
  41. <td>{{ partition.getOrdinal() }}</td>
  42. <td></td>
  43. {% else %}
  44. <td colspan="2">{{ partition.getOrdinal() }}</td>
  45. {% endif %}
  46. <th>{{ partition.getName() }}</th>
  47. {% if has_description %}
  48. <td>
  49. <code>
  50. {{- partition.getExpression() -}}
  51. {{- partition.getMethod() == 'LIST' ? ' IN (' : ' < ' -}}
  52. {{- partition.getDescription() -}}
  53. {{- partition.getMethod() == 'LIST' ? ')' -}}
  54. </code>
  55. </td>
  56. {% endif %}
  57. <td class="value">{{ partition.getRows() }}</td>
  58. <td class="value">
  59. {% set data_length = Util_formatByteDown(
  60. partition.getDataLength(),
  61. 3,
  62. 1
  63. ) %}
  64. <span>{{ data_length[0] }}</span>
  65. <span class="unit">{{ data_length[1] }}</span>
  66. </td>
  67. <td class="value">
  68. {% set index_length = Util_formatByteDown(
  69. partition.getIndexLength(),
  70. 3,
  71. 1
  72. ) %}
  73. <span>{{ index_length[0] }}</span>
  74. <span class="unit">{{ index_length[1] }}</span>
  75. </td>
  76. <td>{{ partition.getComment() }}</td>
  77. {% for action, icon in action_icons %}
  78. <td>
  79. <a href="tbl_structure.php" data-post="{{ url_query -}}
  80. &amp;partition_maintenance=1&amp;sql_query=
  81. {{- ("ALTER TABLE " ~ Util_backquote(table) ~ " " ~ action
  82. ~ " PARTITION " ~ partition.getName())|url_encode }}"
  83. id="partition_action_{{ action }}"
  84. name="partition_action_{{ action }}"
  85. class="ajax">
  86. {{ icon|raw }}
  87. </a>
  88. </td>
  89. {% endfor %}
  90. {% if has_sub_partitions %}
  91. {% for sub_partition in partition.getSubPartitions() %}
  92. <tr class="noclick">
  93. <td></td>
  94. <td>{{ sub_partition.getOrdinal() }}</td>
  95. <td>{{ sub_partition.getName() }}</td>
  96. {% if has_description %}
  97. <td></td>
  98. {% endif %}
  99. <td class="value">{{ sub_partition.getRows() }}</td>
  100. <td class="value">
  101. {% set data_length = Util_formatByteDown(
  102. sub_partition.getDataLength(),
  103. 3,
  104. 1
  105. ) %}
  106. <span>{{ data_length[0] }}</span>
  107. <span class="unit">{{ data_length[1] }}</span>
  108. </td>
  109. <td class="value">
  110. {% set index_length = Util_formatByteDown(
  111. sub_partition.getIndexLength(),
  112. 3,
  113. 1
  114. ) %}
  115. <span>{{ index_length[0] }}</span>
  116. <span class="unit">{{ index_length[1] }}</span>
  117. </td>
  118. <td>{{ sub_partition.getComment() }}</td>
  119. <td colspan="{{ range_or_list ? '7' : '6' }}"></td>
  120. </tr>
  121. {% endfor %}
  122. {% endif %}
  123. </tr>
  124. {% endfor %}
  125. </tbody>
  126. </table>
  127. {% endif %}
  128. </fieldset>
  129. <fieldset class="tblFooters print_ignore">
  130. <form action="tbl_structure.php" method="post">
  131. {{ Url_getHiddenInputs(db, table) }}
  132. <input type="hidden" name="edit_partitioning" value="true" />
  133. {% if partitions is empty %}
  134. <input type="submit" name="edit_partitioning" value="{% trans 'Partition table' %}" />
  135. {% else %}
  136. {{ Util_linkOrButton(remove_url, 'Remove partitioning'|trans, {
  137. 'class': 'button ajax',
  138. 'id': 'remove_partitioning'
  139. }) }}
  140. <input type="submit" name="edit_partitioning" value="{% trans 'Edit partitioning' %}" />
  141. {% endif %}
  142. </form>
  143. </fieldset>
  144. </div>