diff options
Diffstat (limited to 'srcs/phpmyadmin/templates/table/structure')
5 files changed, 875 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/templates/table/structure/action_row_in_structure_table.twig b/srcs/phpmyadmin/templates/table/structure/action_row_in_structure_table.twig new file mode 100644 index 0000000..d9c629c --- /dev/null +++ b/srcs/phpmyadmin/templates/table/structure/action_row_in_structure_table.twig @@ -0,0 +1,31 @@ +<li class="{{ class }}"> +{% if type == 'text' + or type == 'blob' + or tbl_storage_engine == 'ARCHIVE' + or has_field %} + {{ titles['No' ~ action]|raw }} +{% else %} + <a rel="samepage" class="ajax add_key print_ignore + {%- if has_link_class %} + add_primary_key_anchor + {%- elseif action == 'Index' %} + add_index_anchor + {%- elseif action == 'Unique' %} + add_unique_anchor + {%- elseif action == 'Spatial' %} + add_spatial_anchor + {%- endif %}" href="tbl_structure.php" data-post="{{ url_query|raw -}} + &add_key=1&sql_query= + {{- ('ALTER TABLE ' ~ + backquote(table) ~ + (is_primary ? (primary ? ' DROP PRIMARY KEY,')) ~ + ' ' ~ + syntax ~ + '(' ~ + backquote(row['Field']) ~ + ');')|url_encode -}} + &message_to_show={{ message|format(row['Field']|e)|url_encode }}"> + {{ titles[action]|raw }} + </a> +{% endif %} +</li> diff --git a/srcs/phpmyadmin/templates/table/structure/display_partitions.twig b/srcs/phpmyadmin/templates/table/structure/display_partitions.twig new file mode 100644 index 0000000..b10a0bc --- /dev/null +++ b/srcs/phpmyadmin/templates/table/structure/display_partitions.twig @@ -0,0 +1,145 @@ +<div id="partitions"> + <fieldset> + <legend> + {% trans 'Partitions' %} + {{ show_mysql_docu('partitioning') }} + </legend> + {% if partitions is empty %} + {{ 'No partitioning defined!'|trans|notice }} + {% else %} + <p> + {% trans 'Partitioned by:' %} + <code>{{ partition_method }}({{ partition_expression }})</code> + </p> + {% if has_sub_partitions %} + <p> + {% trans 'Sub partitioned by:' %} + <code>{{ sub_partition_method }}({{ sub_partition_expression }})</code> + <p> + {% endif %} + <table> + <thead> + <tr> + <th colspan="2">#</th> + <th>{% trans 'Partition' %}</th> + {% if has_description %} + <th>{% trans 'Expression' %}</th> + {% endif %} + <th>{% trans 'Rows' %}</th> + <th>{% trans 'Data length' %}</th> + <th>{% trans 'Index length' %}</th> + <th>{% trans 'Comment' %}</th> + <th colspan="{{ range_or_list ? '7' : '6' }}"> + {% trans 'Action' %} + </th> + </tr> + </thead> + <tbody> + {% for partition in partitions %} + <tr class="noclick{{ has_sub_partitions ? ' marked' }}"> + {% if has_sub_partitions %} + <td>{{ partition.getOrdinal() }}</td> + <td></td> + {% else %} + <td colspan="2">{{ partition.getOrdinal() }}</td> + {% endif %} + <th>{{ partition.getName() }}</th> + {% if has_description %} + <td> + <code> + {{- partition.getExpression() -}} + {{- partition.getMethod() == 'LIST' ? ' IN (' : ' < ' -}} + {{- partition.getDescription() -}} + {{- partition.getMethod() == 'LIST' ? ')' -}} + </code> + </td> + {% endif %} + <td class="value">{{ partition.getRows() }}</td> + <td class="value"> + {% set data_length = format_byte_down( + partition.getDataLength(), + 3, + 1 + ) %} + <span>{{ data_length[0] }}</span> + <span class="unit">{{ data_length[1] }}</span> + </td> + <td class="value"> + {% set index_length = format_byte_down( + partition.getIndexLength(), + 3, + 1 + ) %} + <span>{{ index_length[0] }}</span> + <span class="unit">{{ index_length[1] }}</span> + </td> + <td>{{ partition.getComment() }}</td> + {% for action, icon in action_icons %} + <td> + <a href="tbl_structure.php" data-post="{{ url_query -}} + &partition_maintenance=1&sql_query= + {{- ("ALTER TABLE " ~ backquote(table) ~ " " ~ action + ~ " PARTITION " ~ partition.getName())|url_encode }}" + id="partition_action_{{ action }}" + name="partition_action_{{ action }}" + class="ajax"> + {{ icon|raw }} + </a> + </td> + {% endfor %} + + {% if has_sub_partitions %} + {% for sub_partition in partition.getSubPartitions() %} + <tr class="noclick"> + <td></td> + <td>{{ sub_partition.getOrdinal() }}</td> + <td>{{ sub_partition.getName() }}</td> + {% if has_description %} + <td></td> + {% endif %} + <td class="value">{{ sub_partition.getRows() }}</td> + <td class="value"> + {% set data_length = format_byte_down( + sub_partition.getDataLength(), + 3, + 1 + ) %} + <span>{{ data_length[0] }}</span> + <span class="unit">{{ data_length[1] }}</span> + </td> + <td class="value"> + {% set index_length = format_byte_down( + sub_partition.getIndexLength(), + 3, + 1 + ) %} + <span>{{ index_length[0] }}</span> + <span class="unit">{{ index_length[1] }}</span> + </td> + <td>{{ sub_partition.getComment() }}</td> + <td colspan="{{ range_or_list ? '7' : '6' }}"></td> + </tr> + {% endfor %} + {% endif %} + </tr> + {% endfor %} + </tbody> + </table> + {% endif %} + </fieldset> + <fieldset class="tblFooters print_ignore"> + <form action="tbl_structure.php" method="post"> + {{ get_hidden_inputs(db, table) }} + <input type="hidden" name="edit_partitioning" value="true"> + {% if partitions is empty %} + <input class="btn btn-secondary" type="submit" name="edit_partitioning" value="{% trans 'Partition table' %}"> + {% else %} + {{ link_or_button(remove_url, 'Remove partitioning'|trans, { + 'class': 'button ajax', + 'id': 'remove_partitioning' + }) }} + <input class="btn btn-secondary" type="submit" name="edit_partitioning" value="{% trans 'Edit partitioning' %}"> + {% endif %} + </form> + </fieldset> +</div> diff --git a/srcs/phpmyadmin/templates/table/structure/display_structure.twig b/srcs/phpmyadmin/templates/table/structure/display_structure.twig new file mode 100644 index 0000000..16e11db --- /dev/null +++ b/srcs/phpmyadmin/templates/table/structure/display_structure.twig @@ -0,0 +1,516 @@ +{% extends 'table/page_with_secondary_tabs.twig' %} +{% block content %} +<form method="post" action="tbl_structure.php" name="fieldsForm" id="fieldsForm" + class="ajax{{ hide_structure_actions ? ' HideStructureActions' }}"> + {{ get_hidden_inputs(db, table) }} + <input type="hidden" name="table_type" value= + {%- if db_is_system_schema -%} + "information_schema" + {%- elseif tbl_is_view -%} + "view" + {%- else -%} + "table" + {%- endif %}> + <div class="responsivetable"> + <table id="tablestructure" class="data topmargin"> + {# Table header #} + <thead> + <tr> + <th class="print_ignore"></th> + <th>#</th> + <th>{% trans 'Name' %}</th> + <th>{% trans 'Type' %}</th> + <th>{% trans 'Collation' %}</th> + <th>{% trans 'Attributes' %}</th> + <th>{% trans 'Null' %}</th> + <th>{% trans 'Default' %}</th> + {% if show_column_comments -%} + <th>{% trans 'Comments' %}</th> + {%- endif %} + <th>{% trans 'Extra' %}</th> + {# @see table/structure.js, function moreOptsMenuResize() #} + {% if not db_is_system_schema and not tbl_is_view %} + <th colspan="{{ show_icons('ActionLinksMode') ? '8' : '9' -}} + " class="action print_ignore">{% trans 'Action' %}</th> + {% endif %} + </tr> + </thead> + <tbody> + {# Table body #} + {% set rownum = 0 %} + {% for row in fields %} + {% set rownum = rownum + 1 %} + + {% set extracted_columnspec = extracted_columnspecs[rownum] %} + {% set field_name = row['Field']|e %} + {# For column comments #} + {% set comments = row_comments[rownum] %} + {# Underline commented fields and display a hover-title (CSS only) #} + + <tr> + <td class="center print_ignore"> + <input type="checkbox" class="checkall" name="selected_fld[]" value="{{ row['Field'] }}" id="checkbox_row_{{ rownum }}"> + </td> + <td class="right">{{ rownum }}</td> + <th class="nowrap"> + <label for="checkbox_row_{{ rownum }}"> + {% if displayed_fields[rownum].comment is defined %} + <span class="commented_column" title="{{ displayed_fields[rownum].comment }}">{{ displayed_fields[rownum].text }}</span> + {% else %} + {{ displayed_fields[rownum].text }} + {% endif %} + {{ displayed_fields[rownum].icon|raw }} + </label> + </th> + <td{{ 'set' != extracted_columnspec['type'] and 'enum' != extracted_columnspec['type'] ? ' class="nowrap"' }}> + <bdo dir="ltr" lang="en"> + {{ extracted_columnspec['displayed_type']|raw }} + {% if relation_commwork and relation_mimework and browse_mime + and mime_map[row['Field']]['mimetype'] is defined %} + <br>{% trans 'Media (MIME) type:' %} {{ mime_map[row['Field']]['mimetype']|replace({'_': '/'})|lower }} + {% endif %} + </bdo> + </td> + <td> + {% if row['Collation'] is not empty %} + <dfn title="{{ collations[row['Collation']].description }}">{{ collations[row['Collation']].name }}</dfn> + {% endif %} + </td> + <td class="column_attribute nowrap">{{ attributes[rownum] }}</td> + <td>{{ row['Null'] == 'YES' ? 'Yes'|trans : 'No'|trans }}</td> + <td class="nowrap"> + {% if row['Default'] is not null %} + {% if extracted_columnspec['type'] == 'bit' %} + {{ row['Default']|convert_bit_default_value }} + {% else %} + {{ row['Default'] }} + {% endif %} + {% elseif row['Null'] == 'YES' %} + <em>NULL</em> + {% else %} + <em>{% trans %}None{% context %}None for default{% endtrans %}</em> + {% endif %} + </td> + {% if show_column_comments %} + <td> + {{ comments }} + </td> + {% endif %} + <td class="nowrap">{{ row['Extra']|upper }}</td> + {% if not tbl_is_view and not db_is_system_schema %} + <td class="edit center print_ignore"> + <a class="change_column_anchor ajax" href="tbl_structure.php + {{- url_query }}&field={{ row['Field']|url_encode }}&change_column=1"> + {{ titles['Change']|raw }} + </a> + </td> + <td class="drop center print_ignore"> + <a class="drop_column_anchor ajax" href="sql.php" data-post="{{ url_query }}&sql_query= + {{- ('ALTER TABLE ' ~ backquote(table) + ~ ' DROP ' ~ backquote(row['Field']) ~ ';')|url_encode -}} + &dropped_column={{ row['Field']|url_encode }}&purge=1&message_to_show= + {{- ('Column %s has been dropped.'|trans|format(row['Field']|e))|url_encode }}"> + {{ titles['Drop']|raw }} + </a> + </td> + {% endif %} + + {% if not tbl_is_view and not db_is_system_schema %} + {% set type = extracted_columnspec['print_type'] is not empty ? extracted_columnspec['print_type'] %} + <td class="print_ignore"> + <ul class="table-structure-actions resizable-menu"> + {% if hide_structure_actions %} + <li class="submenu shown"> + <a href="#" class="tab nowrap">{{ get_icon('b_more', 'More'|trans) }}</a> + <ul> + {% endif %} + {# Add primary #} + {% include 'table/structure/action_row_in_structure_table.twig' with { + 'type': type, + 'tbl_storage_engine': tbl_storage_engine, + 'class': 'primary nowrap', + 'has_field': primary and primary.hasColumn(field_name), + 'has_link_class': true, + 'url_query': url_query, + 'primary': primary, + 'syntax': 'ADD PRIMARY KEY', + 'message': 'A primary key has been added on %s.'|trans, + 'action': 'Primary', + 'titles': titles, + 'row': row, + 'is_primary': true, + 'table': table + } only %} + + {# Add unique #} + {% include 'table/structure/action_row_in_structure_table.twig' with { + 'type': type, + 'tbl_storage_engine': tbl_storage_engine, + 'class': 'add_unique unique nowrap', + 'has_field': field_name in columns_with_unique_index, + 'has_link_class': false, + 'url_query': url_query, + 'primary': primary, + 'syntax': 'ADD UNIQUE', + 'message': 'An index has been added on %s.'|trans, + 'action': 'Unique', + 'titles': titles, + 'row': row, + 'is_primary': false, + 'table': table + } only %} + + {# Add index #} + {% include 'table/structure/action_row_in_structure_table.twig' with { + 'type': type, + 'tbl_storage_engine': tbl_storage_engine, + 'class': 'add_index nowrap', + 'has_field': false, + 'has_link_class': false, + 'url_query': url_query, + 'primary': primary, + 'syntax': 'ADD INDEX', + 'message': 'An index has been added on %s.'|trans, + 'action': 'Index', + 'titles': titles, + 'row': row, + 'is_primary': false, + 'table': table + } only %} + + {# Add spatial #} + {% set spatial_types = [ + 'geometry', + 'point', + 'linestring', + 'polygon', + 'multipoint', + 'multilinestring', + 'multipolygon', + 'geomtrycollection' + ] %} + {% include 'table/structure/action_row_in_structure_table.twig' with { + 'type': type, + 'tbl_storage_engine': tbl_storage_engine, + 'class': 'spatial nowrap', + 'has_field': type not in spatial_types and + (tbl_storage_engine == 'MYISAM' or mysql_int_version >= 50705), + 'has_link_class': false, + 'url_query': url_query, + 'primary': primary, + 'syntax': 'ADD SPATIAL', + 'message': 'An index has been added on %s.'|trans, + 'action': 'Spatial', + 'titles': titles, + 'row': row, + 'is_primary': false, + 'table': table + } only %} + + {# FULLTEXT is possible on TEXT, CHAR and VARCHAR #} + <li class="fulltext nowrap"> + {% if tbl_storage_engine is not empty and ( + tbl_storage_engine == 'MYISAM' + or tbl_storage_engine == 'ARIA' + or tbl_storage_engine == 'MARIA' + or (tbl_storage_engine == 'INNODB' and mysql_int_version >= 50604) + ) and ('text' in type or 'char' in type) %} + <a rel="samepage" class="ajax add_key add_fulltext_anchor" href="tbl_structure.php" + data-post="{{- url_query|raw }}&add_key=1&sql_query= + {{- ('ALTER TABLE ' ~ backquote(table) + ~ ' ADD FULLTEXT(' ~ backquote(row['Field']) + ~ ');')|url_encode }}&message_to_show= + {{- ('An index has been added on %s.'|trans|format(row['Field']|e))|url_encode }}"> + {{ titles['IdxFulltext']|raw }} + </a> + {% else %} + {{ titles['NoIdxFulltext']|raw }} + {% endif %} + </li> + + {# Distinct value action #} + <li class="browse nowrap"> + <a href="sql.php" data-post="{{ url_query|raw }}&sql_query= + {{- ('SELECT COUNT(*) AS ' ~ backquote('Rows'|trans) + ~ ', ' ~ backquote(row['Field']) + ~ ' FROM ' ~ backquote(table) + ~ ' GROUP BY ' ~ backquote(row['Field']) + ~ ' ORDER BY ' ~ backquote(row['Field']))|url_encode -}} + &is_browse_distinct=1"> + {{ titles['DistinctValues']|raw }} + </a> + </li> + {% if central_columns_work %} + <li class="browse nowrap"> + {% if row['Field'] in central_list %} + <a href="#" class="central_columns remove_button"> + {{ get_icon('centralColumns_delete', 'Remove from central columns'|trans) }} + </a> + {% else %} + <a href="#" class="central_columns add_button"> + {{ get_icon('centralColumns_add', 'Add to central columns'|trans) }} + </a> + {% endif %} + </li> + {% endif %} + {% if hide_structure_actions %} + </ul> + </li> + {% endif %} + </ul> + </td> + {% endif %} + </tr> + {% endfor %} + </tbody> + </table> + </div> + <div class="print_ignore"> + {% include 'select_all.twig' with { + 'pma_theme_image': pma_theme_image, + 'text_dir': text_dir, + 'form_name': 'fieldsForm' + } only %} + + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Browse'|trans, + 'b_browse', + 'browse' + ) }} + + {% if not tbl_is_view and not db_is_system_schema %} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit change_columns_anchor ajax', + 'Change'|trans, + 'b_edit', + 'change' + ) }} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Drop'|trans, + 'b_drop', + 'drop' + ) }} + + {% if tbl_storage_engine != 'ARCHIVE' %} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Primary'|trans, + 'b_primary', + 'primary' + ) }} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Unique'|trans, + 'b_unique', + 'unique' + ) }} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Index'|trans, + 'b_index', + 'index' + ) }} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Fulltext'|trans, + 'b_ftext', + 'ftext' + ) }} + + {% if tbl_storage_engine is not empty and ( + tbl_storage_engine == 'MYISAM' + or tbl_storage_engine == 'ARIA' + or tbl_storage_engine == 'MARIA') %} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Fulltext'|trans, + 'b_ftext', + 'ftext' + ) }} + {% endif %} + + {% if central_columns_work %} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Add to central columns'|trans, + 'centralColumns_add', + 'add_to_central_columns' + ) }} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Remove from central columns'|trans, + 'centralColumns_delete', + 'remove_from_central_columns' + ) }} + {% endif %} + {% endif %} + {% endif %} + </div> +</form> +<hr class="print_ignore"> +<div id="move_columns_dialog" class="hide" title="{% trans 'Move columns' %}"> + <p>{% trans 'Move the columns by dragging them up and down.' %}</p> + <form action="tbl_structure.php" name="move_column_form" id="move_column_form"> + <div> + {{ get_hidden_inputs(db, table) }} + <ul></ul> + </div> + </form> +</div> +{# Work on the table #} +<div id="structure-action-links"> + {% if tbl_is_view and not db_is_system_schema %} + {% set edit_view_url = 'view_create.php' ~ edit_view_url %} + {{ link_or_button( + edit_view_url, + get_icon('b_edit', 'Edit view'|trans, true) + ) }} + {% endif %} + <a href="#" id="printView">{{ get_icon('b_print', 'Print'|trans, true) }}</a> + {% if not tbl_is_view and not db_is_system_schema %} + {# Only display propose table structure for MySQL < 8.0 #} + {% if mysql_int_version < 80000 or is_mariadb %} + <a href="sql.php" data-post="{{ url_query|raw }}&session_max_rows=all&sql_query= + {{- ('SELECT * FROM ' ~ backquote(table) ~ ' PROCEDURE ANALYSE()')|url_encode -}} + " style="margin-right: 0;"> + {{ get_icon( + 'b_tblanalyse', + 'Propose table structure'|trans, + true + ) }} + </a> + {{ show_mysql_docu('procedure_analyse') }} + {% endif %} + {% if is_active %} + <a href="tbl_tracking.php{{ url_query|raw }}"> + {{ get_icon('eye', 'Track table'|trans, true) }} + </a> + {% endif %} + <a href="#" id="move_columns_anchor"> + {{ get_icon('b_move', 'Move columns'|trans, true) }} + </a> + <a href="normalization.php{{ url_query|raw }}"> + {{ get_icon('normalize', 'Normalize'|trans, true) }} + </a> + {% endif %} + {% if tbl_is_view and not db_is_system_schema %} + {% if is_active %} + <a href="tbl_tracking.php{{ url_query|raw }}"> + {{ get_icon('eye', 'Track view'|trans, true) }} + </a> + {% endif %} + {% endif %} +</div> +{% if not tbl_is_view and not db_is_system_schema %} + <form method="post" action="tbl_addfield.php" id="addColumns" name="addColumns"> + {{ get_hidden_inputs(db, table) }} + {% if show_icons('ActionLinksMode') %} + {{ get_image('b_insrow', 'Add column'|trans) }} + {% endif %} + {% set num_fields -%} + <input type="number" name="num_fields" value="1" onfocus="this.select()" min="1" required> + {%- endset %} + {{ 'Add %s column(s)'|trans|format(num_fields)|raw }} + <input type="hidden" name="field_where" value="after"> + {# I tried displaying the drop-down inside the label but with Firefox the drop-down was blinking #} + <select name="after_field"> + <option value="first" data-pos="first"> + {% trans 'at beginning of table' %} + </option> + {% for one_column_name in columns_list %} + <option value="{{ one_column_name }}" + {{- loop.revindex0 == 0 ? ' selected="selected"' }}> + {{ 'after %s'|trans|format(one_column_name) }} + </option> + {% endfor %} + </select> + <input class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </form> +{% endif %} + +{# Displays indexes #} +{% if not tbl_is_view and not db_is_system_schema + and 'ARCHIVE' != tbl_storage_engine %} + {{ displayIndexesHtml|raw }} +{% endif %} + +{# Display partition details #} +{% if have_partitioning %} + {# Detect partitioning #} + {% if partition_names is not empty and partition_names[0] is not null %} + {% set first_partition = partitions[0] %} + {% set range_or_list = first_partition.getMethod() == 'RANGE' + or first_partition.getMethod() == 'RANGE COLUMNS' + or first_partition.getMethod() == 'LIST' + or first_partition.getMethod() == 'LIST COLUMNS' %} + {% set sub_partitions = first_partition.getSubPartitions() %} + {% set has_sub_partitions = first_partition.hasSubPartitions() %} + {% if has_sub_partitions %} + {% set first_sub_partition = sub_partitions[0] %} + {% endif %} + + {% set action_icons = { + 'ANALYZE': get_icon('b_search', 'Analyze'|trans), + 'CHECK': get_icon('eye', 'Check'|trans), + 'OPTIMIZE': get_icon('normalize', 'Optimize'|trans), + 'REBUILD': get_icon('s_tbl', 'Rebuild'|trans), + 'REPAIR': get_icon('b_tblops', 'Repair'|trans), + 'TRUNCATE': get_icon('b_empty', 'Truncate'|trans), + } %} + {% if range_or_list %} + {% set action_icons = action_icons|merge({'DROP': get_icon('b_drop', 'Drop'|trans)}) %} + {% endif %} + + {# open Slider Effect div #} + {% include 'div_for_slider_effect.twig' with { + 'id': 'partitions-2', + 'message': 'Partitions'|trans, + 'initial_sliders_state': default_sliders_state + } only %} + + {% set remove_sql = 'ALTER TABLE ' ~ backquote(table) ~ ' REMOVE PARTITIONING' %} + {% set remove_url = 'sql.php' ~ url_query ~ '&sql_query=' ~ remove_sql|url_encode %} + + {% include 'table/structure/display_partitions.twig' with { + 'db': db, + 'table': table, + 'url_query': url_query, + 'partitions': partitions, + 'partition_method': first_partition.getMethod(), + 'partition_expression': first_partition.getExpression(), + 'has_description': first_partition.getDescription() is not empty, + 'has_sub_partitions': has_sub_partitions, + 'sub_partition_method': has_sub_partitions ? first_sub_partition.getMethod(), + 'sub_partition_expression': has_sub_partitions ? first_sub_partition.getExpression(), + 'action_icons': action_icons, + 'range_or_list': range_or_list, + 'remove_url': remove_url + } only %} + {% else %} + {% include 'table/structure/display_partitions.twig' with { + 'db': db, + 'table': table + } only %} + {% endif %} + {# For closing Slider effect div #} + </div> +{% endif %} + +{# Displays Space usage and row statistics #} +{% if show_stats %} + {{ table_stats|raw }} +{% endif %} +<div class="clearfloat"></div> +{% endblock %} diff --git a/srcs/phpmyadmin/templates/table/structure/display_table_stats.twig b/srcs/phpmyadmin/templates/table/structure/display_table_stats.twig new file mode 100644 index 0000000..01c74ae --- /dev/null +++ b/srcs/phpmyadmin/templates/table/structure/display_table_stats.twig @@ -0,0 +1,169 @@ +<div id="tablestatistics"> + <fieldset> + <legend>{% trans 'Information' %}</legend> + {% if showtable['TABLE_COMMENT'] %} + <p> + <strong>{% trans 'Table comments:' %}</strong> + {{ showtable['TABLE_COMMENT'] }} + </p> + {% endif %} + <a id="showusage"></a> + + {% if not tbl_is_view and not db_is_system_schema %} + <table id="tablespaceusage" class="width100 data"> + <caption class="tblHeaders">{% trans 'Space usage' %}</caption> + <tbody> + <tr> + <th class="name">{% trans 'Data' %}</th> + <td class="value">{{ data_size }}</td> + <td class="unit">{{ data_unit }}</td> + </tr> + + {% if index_size is defined %} + <tr> + <th class="name">{% trans 'Index' %}</th> + <td class="value">{{ index_size }}</td> + <td class="unit">{{ index_unit }}</td> + </tr> + {% endif %} + + {% if free_size is defined %} + <tr> + <th class="name">{% trans 'Overhead' %}</th> + <td class="value">{{ free_size }}</td> + <td class="unit">{{ free_unit }}</td> + </tr> + <tr> + <th class="name">{% trans 'Effective' %}</th> + <td class="value">{{ effect_size }}</td> + <td class="unit">{{ effect_unit }}</td> + </tr> + {% endif %} + + {% if tot_size is defined and mergetable == false %} + <tr> + <th class="name">{% trans 'Total' %}</th> + <td class="value">{{ tot_size }}</td> + <td class="unit">{{ tot_unit }}</td> + </tr> + {% endif %} + + {# Optimize link if overhead #} + {% if free_size is defined + and (tbl_storage_engine == 'MYISAM' + or tbl_storage_engine == 'ARIA' + or tbl_storage_engine == 'MARIA' + or tbl_storage_engine == 'BDB') + or (tbl_storage_engine == 'INNODB' and innodb_file_per_table == true) %} + <tr class="tblFooters print_ignore"> + <td colspan="3" class="center"> + <a href="sql.php" data-post="{{ url_query }}&pos=0&sql_query= + {{- ('OPTIMIZE TABLE ' ~ backquote(table))|url_encode }}"> + {{ get_icon('b_tbloptimize', 'Optimize table'|trans) }} + </a> + </td> + </tr> + {% endif %} + </tbody> + </table> + {% endif %} + + {% set avg_size = avg_size is defined ? avg_size : null %} + {% set avg_unit = avg_unit is defined ? avg_unit : null %} + <table id="tablerowstats" class="width100 data"> + <caption class="tblHeaders">{% trans 'Row statistics' %}</caption> + <tbody> + {% if showtable['Row_format'] is defined %} + <tr> + <th class="name">{% trans 'Format' %}</th> + {% if showtable['Row_format'] == 'Fixed' %} + <td class="value">{% trans 'static' %}</td> + {% elseif showtable['Row_format'] == 'Dynamic' %} + <td class="value">{% trans 'dynamic' %}</td> + {% else %} + <td class="value">{{ showtable['Row_format'] }}</td> + {% endif %} + </tr> + {% endif %} + + {% if showtable['Create_options'] is not empty %} + <tr> + <th class="name">{% trans 'Options' %}</th> + {% if showtable['Create_options'] == 'partitioned' %} + <td class="value">{% trans 'partitioned' %}</td> + {% else %} + <td class="value">{{ showtable['Create_options'] }}</td> + {% endif %} + </tr> + {% endif %} + + {% if table_collation is not empty %} + <tr> + <th class="name">{% trans 'Collation' %}</th> + <td class="value"> + <dfn title="{{ table_collation.description }}"> + {{ table_collation.name }} + </dfn> + </td> + </tr> + {% endif %} + + {% if not is_innodb and showtable['Rows'] is defined %} + <tr> + <th class="name">{% trans 'Rows' %}</th> + <td class="value">{{ format_number(showtable['Rows'], 0) }}</td> + </tr> + {% endif %} + + {% if not is_innodb + and showtable['Avg_row_length'] is defined + and showtable['Avg_row_length'] > 0 %} + <tr> + <th class="name">{% trans 'Row length' %}</th> + {% set avg_row_length = format_byte_down(showtable['Avg_row_length'], 6, 1) %} + <td class="value">{{ avg_row_length[0] }} {{ avg_row_length[1] }}</td> + </tr> + {% endif %} + + {% if not is_innodb + and showtable['Data_length'] is defined + and showtable['Rows'] is defined + and showtable['Rows'] > 0 + and mergetable == false %} + <tr> + <th class="name">{% trans 'Row size' %}</th> + <td class="value">{{ avg_size }} {{ avg_unit }}</td> + </tr> + {% endif %} + + {% if showtable['Auto_increment'] is defined %} + <tr> + <th class="name">{% trans 'Next autoindex' %}</th> + <td class="value">{{ format_number(showtable['Auto_increment'], 0) }}</td> + </tr> + {% endif %} + + {% if showtable['Create_time'] is defined %} + <tr> + <th class="name">{% trans 'Creation' %}</th> + <td class="value">{{ localised_date(showtable['Create_time']|date('U')) }}</td> + </tr> + {% endif %} + + {% if showtable['Update_time'] is defined %} + <tr> + <th class="name">{% trans 'Last update' %}</th> + <td class="value">{{ localised_date(showtable['Update_time']|date('U')) }}</td> + </tr> + {% endif %} + + {% if showtable['Check_time'] is defined %} + <tr> + <th class="name">{% trans 'Last check' %}</th> + <td class="value">{{ localised_date(showtable['Check_time']|date('U')) }}</td> + </tr> + {% endif %} + </tbody> + </table> + </fieldset> +</div> diff --git a/srcs/phpmyadmin/templates/table/structure/partition_definition_form.twig b/srcs/phpmyadmin/templates/table/structure/partition_definition_form.twig new file mode 100644 index 0000000..7cf5e8d --- /dev/null +++ b/srcs/phpmyadmin/templates/table/structure/partition_definition_form.twig @@ -0,0 +1,14 @@ +<form action="tbl_structure.php" method="post"> + {{ get_hidden_inputs(db, table) }} + <input type="hidden" name="edit_partitioning" value="true"> + + <fieldset> + <legend>{% trans 'Edit partitioning' %}</legend> + {% include 'columns_definitions/partitions.twig' with { + 'partition_details': partition_details + } only %} + </fieldset> + <fieldset class="tblFooters"> + <input class="btn btn-primary" type="submit" name="save_partitioning" value="{% trans 'Save' %}"> + </fieldset> +</form> |
