tables.twig 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. {# Tracked tables exists#}
  2. {% if head_version_exists %}
  3. <div id="tracked_tables">
  4. <h3>{% trans 'Tracked tables' %}</h3>
  5. <form method="post" action="{{ url('/database/tracking') }}" name="trackedForm"
  6. id="trackedForm" class="ajax">
  7. {{ get_hidden_inputs(db) }}
  8. <table id="versions" class="table table-light table-striped table-hover w-auto">
  9. <thead class="thead-light">
  10. <tr>
  11. <th></th>
  12. <th>{% trans 'Table' %}</th>
  13. <th>{% trans 'Last version' %}</th>
  14. <th>{% trans 'Created' %}</th>
  15. <th>{% trans 'Updated' %}</th>
  16. <th>{% trans 'Status' %}</th>
  17. <th>{% trans 'Action' %}</th>
  18. <th>{% trans 'Show' %}</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. {% for version in versions %}
  23. <tr>
  24. <td class="text-center">
  25. <input type="checkbox" name="selected_tbl[]"
  26. class="checkall" id="selected_tbl_{{ version.table_name }}"
  27. value="{{ version.table_name }}">
  28. </td>
  29. <th>
  30. <label for="selected_tbl_{{ version.table_name }}">
  31. {{ version.table_name }}
  32. </label>
  33. </th>
  34. <td class="right">
  35. {{ version.version }}
  36. </td>
  37. <td>
  38. {{ version.date_created }}
  39. </td>
  40. <td>
  41. {{ version.date_updated }}
  42. </td>
  43. <td>
  44. <div class="wrapper toggleAjax hide">
  45. <div class="toggleButton">
  46. <div title="{% trans 'Click to toggle' %}" class="toggle-container {{ version.tracking_active == 1 ? 'on' : 'off' }}">
  47. <img src="{{ theme_image_path }}toggle-{{ text_dir }}.png">
  48. <table class="pma-table nospacing nopadding">
  49. <tbody>
  50. <tr>
  51. <td class="toggleOn">
  52. <span class="hide">
  53. {{- url('/table/tracking', {
  54. 'db': version.db_name,
  55. 'table': version.table_name,
  56. 'version': version.version,
  57. 'toggle_activation': 'activate_now',
  58. }) -}}
  59. </span>
  60. <div>{% trans 'active' %}</div>
  61. </td>
  62. <td><div>&nbsp;</div></td>
  63. <td class="toggleOff">
  64. <span class="hide">
  65. {{- url('/table/tracking', {
  66. 'db': version.db_name,
  67. 'table': version.table_name,
  68. 'version': version.version,
  69. 'toggle_activation': 'deactivate_now',
  70. }) -}}
  71. </span>
  72. <div>{% trans 'not active' %}</div>
  73. </td>
  74. </tr>
  75. </tbody>
  76. </table>
  77. <span class="hide callback"></span>
  78. <span class="hide text_direction">{{ text_dir }}</span>
  79. </div>
  80. </div>
  81. </div>
  82. </td>
  83. <td>
  84. <a class="delete_tracking_anchor ajax" href="{{ url('/database/tracking') }}" data-post="
  85. {{- get_common({
  86. 'db': db,
  87. 'goto': url('/table/tracking'),
  88. 'back': url('/database/tracking'),
  89. 'table': version.table_name,
  90. 'delete_tracking': true
  91. }, '') }}">
  92. {{ get_icon('b_drop', 'Delete tracking'|trans) }}
  93. </a>
  94. </td>
  95. <td>
  96. <a href="{{ url('/table/tracking') }}" data-post="
  97. {{- get_common({
  98. 'db': db,
  99. 'goto': url('/table/tracking'),
  100. 'back': url('/database/tracking'),
  101. 'table': version.table_name
  102. }, '') }}">
  103. {{ get_icon('b_versions', 'Versions'|trans) }}
  104. </a>
  105. <a href="{{ url('/table/tracking') }}" data-post="
  106. {{- get_common({
  107. 'db': db,
  108. 'goto': url('/table/tracking'),
  109. 'back': url('/database/tracking'),
  110. 'table': version.table_name,
  111. 'report': true,
  112. 'version': version.version
  113. }, '') }}">
  114. {{ get_icon('b_report', 'Tracking report'|trans) }}
  115. </a>
  116. <a href="{{ url('/table/tracking') }}" data-post="
  117. {{- get_common({
  118. 'db': db,
  119. 'goto': url('/table/tracking'),
  120. 'back': url('/database/tracking'),
  121. 'table': version.table_name,
  122. 'snapshot': true,
  123. 'version': version.version
  124. }, '') }}">
  125. {{ get_icon('b_props', 'Structure snapshot'|trans) }}
  126. </a>
  127. </td>
  128. </tr>
  129. {% endfor %}
  130. </tbody>
  131. </table>
  132. {% include 'select_all.twig' with {
  133. 'theme_image_path': theme_image_path,
  134. 'text_dir': text_dir,
  135. 'form_name': 'trackedForm'
  136. } only %}
  137. <button class="btn btn-link mult_submit" type="submit" name="submit_mult" value="delete_tracking"
  138. title="{% trans 'Delete tracking' %}">
  139. {{ get_icon('b_drop', 'Delete tracking'|trans) }}
  140. </button>
  141. </form>
  142. </div>
  143. {% endif %}
  144. {% if untracked_tables_exists %}
  145. <h3>{% trans 'Untracked tables' %}</h3>
  146. <form method="post" action="{{ url('/database/tracking') }}" name="untrackedForm"
  147. id="untrackedForm" class="ajax">
  148. {{ get_hidden_inputs(db) }}
  149. <table id="noversions" class="table table-light table-striped table-hover w-auto">
  150. <thead class="thead-light">
  151. <tr>
  152. <th></th>
  153. <th>{% trans 'Table' %}</th>
  154. <th>{% trans 'Action' %}</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. {% for table_name in untracked_tables %}
  159. {% if get_tracker_version(db, table_name) == -1 %}
  160. <tr>
  161. <td class="text-center">
  162. <input type="checkbox" name="selected_tbl[]"
  163. class="checkall" id="selected_tbl_{{ table_name }}"
  164. value="{{ table_name }}">
  165. </td>
  166. <th>
  167. <label for="selected_tbl_{{ table_name }}">
  168. {{ table_name }}
  169. </label>
  170. </th>
  171. <td>
  172. <a href="{{ url('/table/tracking', url_params|merge({
  173. 'db': db,
  174. 'table': table_name
  175. })) }}">
  176. {{ get_icon('eye', 'Track table'|trans) }}
  177. </a>
  178. </td>
  179. </tr>
  180. {% endif %}
  181. {% endfor %}
  182. </tbody>
  183. </table>
  184. {% include 'select_all.twig' with {
  185. 'theme_image_path': theme_image_path,
  186. 'text_dir': text_dir,
  187. 'form_name': 'untrackedForm'
  188. } only %}
  189. <button class="btn btn-link mult_submit" type="submit" name="submit_mult" value="track" title="{% trans 'Track table' %}">
  190. {{ get_icon('eye', 'Track table'|trans) }}
  191. </button>
  192. </form>
  193. {% endif %}