From 108f445ee6c88968b2d553d117c9a265670673a4 Mon Sep 17 00:00:00 2001 From: Leonardo Strozzi Date: Wed, 11 Jul 2018 17:14:05 -0300 Subject: [PATCH] Merge table structure tamplates Signed-off-by: Leonardo Strozzi --- .../structure/actions_in_table_structure.twig | 140 ------ templates/table/structure/add_column.twig | 24 - .../structure/check_all_table_column.twig | 93 ---- .../table/structure/display_structure.twig | 452 +++++++++++++++--- .../table/structure/display_table_stats.twig | 105 +++- .../table/structure/move_columns_dialog.twig | 9 - .../structure/optional_action_links.twig | 31 -- .../table/structure/row_stats_table.twig | 95 ---- .../structure/table_structure_header.twig | 21 - .../table/structure/table_structure_row.twig | 64 --- 10 files changed, 483 insertions(+), 551 deletions(-) delete mode 100644 templates/table/structure/actions_in_table_structure.twig delete mode 100644 templates/table/structure/add_column.twig delete mode 100644 templates/table/structure/check_all_table_column.twig delete mode 100644 templates/table/structure/move_columns_dialog.twig delete mode 100644 templates/table/structure/optional_action_links.twig delete mode 100644 templates/table/structure/row_stats_table.twig delete mode 100644 templates/table/structure/table_structure_header.twig delete mode 100644 templates/table/structure/table_structure_row.twig diff --git a/templates/table/structure/actions_in_table_structure.twig b/templates/table/structure/actions_in_table_structure.twig deleted file mode 100644 index 6607f851da..0000000000 --- a/templates/table/structure/actions_in_table_structure.twig +++ /dev/null @@ -1,140 +0,0 @@ - diff --git a/templates/table/structure/add_column.twig b/templates/table/structure/add_column.twig deleted file mode 100644 index 9c88c0a2d2..0000000000 --- a/templates/table/structure/add_column.twig +++ /dev/null @@ -1,24 +0,0 @@ -
- {{ Url_getHiddenInputs(db, table) }} - {% if Util_showIcons('ActionLinksMode') %} - {{ Util_getImage('b_insrow', 'Add column'|trans) }}  - {% endif %} - {% set num_fields -%} - - {%- endset %} - {{ 'Add %s column(s)'|trans|format(num_fields)|raw }} -   - {# I tried displaying the drop-down inside the label but with Firefox the drop-down was blinking #} - - -
diff --git a/templates/table/structure/check_all_table_column.twig b/templates/table/structure/check_all_table_column.twig deleted file mode 100644 index 57e6e11220..0000000000 --- a/templates/table/structure/check_all_table_column.twig +++ /dev/null @@ -1,93 +0,0 @@ - diff --git a/templates/table/structure/display_structure.twig b/templates/table/structure/display_structure.twig index e1f3b9ee07..1e5aea5caa 100644 --- a/templates/table/structure/display_structure.twig +++ b/templates/table/structure/display_structure.twig @@ -12,11 +12,27 @@
{# Table header #} - {% include 'table/structure/table_structure_header.twig' with { - 'db_is_system_schema': db_is_system_schema, - 'tbl_is_view': tbl_is_view, - 'show_column_comments': show_column_comments - } only %} + + + + + + + + + + + {% if show_column_comments -%} + + {%- endif %} + + {# @see tbl_structure.js, function moreOptsMenuResize() #} + {% if not db_is_system_schema and not tbl_is_view %} + + {% endif %} + + {# Table body #} {% set rownum = 0 %} @@ -30,64 +46,325 @@ {# Underline commented fields and display a hover-title (CSS only) #} - {% include 'table/structure/table_structure_row.twig' with { - 'row': row, - 'rownum': rownum, - 'displayed_field': displayed_fields[rownum], - 'type_nowrap': Util_getClassForType(extracted_columnspec['type']), - 'extracted_columnspec': extracted_columnspec, - 'attribute': attributes[rownum], - 'tbl_is_view': tbl_is_view, - 'db_is_system_schema': db_is_system_schema, - 'url_query': url_query, - 'titles': titles, - 'table': table, - 'tbl_storage_engine': tbl_storage_engine, - 'field_charset': row['Collation'], - 'comments': comments, - 'show_column_comments': show_column_comments, - 'relation_commwork': relation_commwork, - 'relation_mimework': relation_mimework, - 'browse_mime': browse_mime - } only %} + + + + + + + + + {% if show_column_comments %} + + {% endif %} + {% if not tbl_is_view and not db_is_system_schema %} - {% include 'table/structure/actions_in_table_structure.twig' with { - 'row': row, - 'rownum': rownum, - 'extracted_columnspec': extracted_columnspec, - 'type': extracted_columnspec['print_type'] is not empty ? extracted_columnspec['print_type'], - 'tbl_storage_engine': tbl_storage_engine, - 'primary': primary, - 'field_name': field_name, - 'url_query': url_query, - 'titles': titles, - 'columns_with_unique_index': columns_with_unique_index, - 'is_in_central_columns': row['Field'] in central_list ? true : false, - 'central_columns_work': central_columns_work, - 'table': table, - 'hide_structure_actions': hide_structure_actions, - 'mysql_int_version': mysql_int_version - } only %} + + + {% 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'] %} + {% endif %} {% endfor %}
#{% trans 'Name' %}{% trans 'Type' %}{% trans 'Collation' %}{% trans 'Attributes' %}{% trans 'Null' %}{% trans 'Default' %}{% trans 'Comments' %}{% trans 'Extra' %}{% trans 'Action' %}
{{ rownum }} + + + + {{ extracted_columnspec['displayed_type']|raw }} + {% if relation_commwork and relation_mimework and browse_mime + and mime_map[row['Field']]['mimetype'] is defined %} +
MIME: {{ mime_map[row['Field']]['mimetype']|replace({'_': '/'})|lower }} + {% endif %} +
+
+ {% if row['Collation'] is not empty %} + {{ row['Collation'] }} + {% endif %} + {{ attributes[rownum] }}{{ row['Null'] == 'YES' ? 'Yes'|trans : 'No'|trans }} + {% if row['Default'] is not null %} + {% if extracted_columnspec['type'] == 'bit' %} + {{ Util_convertBitDefaultValue(row['Default']) }} + {% else %} + {{ row['Default']|raw }} + {% endif %} + {% else %} + {% trans %}None{% context %}None for default{% endtrans %} + {% endif %} + + {{ comments }} + {{ row['Extra']|upper }}
- {% include 'table/structure/check_all_table_column.twig' with { - 'pma_theme_image': pma_theme_image, - 'text_dir': text_dir, - 'tbl_is_view': tbl_is_view, - 'db_is_system_schema': db_is_system_schema, - 'tbl_storage_engine': tbl_storage_engine, - 'central_columns_work': central_columns_work - } only %} + -{% include 'table/structure/move_columns_dialog.twig' with { - 'db': db, - 'table': table -} only %} +
+

{% trans 'Move the columns by dragging them up and down.' %}

+
+
+ {{ Url_getHiddenInputs(db, table) }} +
    +
    +
    +
    {# Work on the table #} {% if not tbl_is_view and not db_is_system_schema %} - {% include 'table/structure/add_column.twig' with { - 'columns_list': columns_list, - 'db': db, - 'table': table - } only %} +
    + {{ Url_getHiddenInputs(db, table) }} + {% if Util_showIcons('ActionLinksMode') %} + {{ Util_getImage('b_insrow', 'Add column'|trans) }}  + {% endif %} + {% set num_fields -%} + + {%- endset %} + {{ 'Add %s column(s)'|trans|format(num_fields)|raw }} +   + {# I tried displaying the drop-down inside the label but with Firefox the drop-down was blinking #} + + +
    {% endif %} {# Displays indexes #} diff --git a/templates/table/structure/display_table_stats.twig b/templates/table/structure/display_table_stats.twig index 14e6ab332d..2fd7e29e48 100644 --- a/templates/table/structure/display_table_stats.twig +++ b/templates/table/structure/display_table_stats.twig @@ -67,13 +67,102 @@ {% endif %} - {% include 'table/structure/row_stats_table.twig' with { - 'showtable': showtable, - 'tbl_collation': tbl_collation, - 'is_innodb': is_innodb, - 'mergetable': mergetable, - 'avg_size': avg_size is defined ? avg_size : null, - 'avg_unit': avg_unit is defined ? avg_unit : null - } only %} + {% set avg_size = avg_size is defined ? avg_size : null %} + {% set avg_unit = avg_unit is defined ? avg_unit : null %} + + + + {% if showtable['Row_format'] is defined %} + + + {% if showtable['Row_format'] == 'Fixed' %} + + {% elseif showtable['Row_format'] == 'Dynamic' %} + + {% else %} + + {% endif %} + + {% endif %} + + {% if showtable['Create_options'] is not empty %} + + + {% if showtable['Create_options'] == 'partitioned' %} + + {% else %} + + {% endif %} + + {% endif %} + + {% if tbl_collation is not empty %} + + + + + {% endif %} + + {% if not is_innodb and showtable['Rows'] is defined %} + + + + + {% endif %} + + {% if not is_innodb + and showtable['Avg_row_length'] is defined + and showtable['Avg_row_length'] > 0 %} + + + {% set avg_row_length = Util_formatByteDown(showtable['Avg_row_length'], 6, 1) %} + + + {% endif %} + + {% if not is_innodb + and showtable['Data_length'] is defined + and showtable['Rows'] is defined + and showtable['Rows'] > 0 + and mergetable == false %} + + + + + {% endif %} + + {% if showtable['Auto_increment'] is defined %} + + + + + {% endif %} + + {% if showtable['Create_time'] is defined %} + + + + + {% endif %} + + {% if showtable['Update_time'] is defined %} + + + + + {% endif %} + + {% if showtable['Check_time'] is defined %} + + + + + {% endif %} + +
    {% trans 'Row statistics' %}
    {% trans 'Format' %}{% trans 'static' %}{% trans 'dynamic' %}{{ showtable['Row_format'] }}
    {% trans 'Options' %}{% trans 'partitioned' %}{{ showtable['Create_options'] }}
    {% trans 'Collation' %} + + {{ tbl_collation }} + +
    {% trans 'Rows' %}{{ Util_formatNumber(showtable['Rows'], 0) }}
    {% trans 'Row length' %}{{ avg_row_length[0] }} {{ avg_row_length[1] }}
    {% trans 'Row size' %}{{ avg_size }} {{ avg_unit }}
    {% trans 'Next autoindex' %}{{ Util_formatNumber(showtable['Auto_increment'], 0) }}
    {% trans 'Creation' %}{{ Util_localisedDate(showtable['Create_time']|date('U')) }}
    {% trans 'Last update' %}{{ Util_localisedDate(showtable['Update_time']|date('U')) }}
    {% trans 'Last check' %}{{ Util_localisedDate(showtable['Check_time']|date('U')) }}
    diff --git a/templates/table/structure/move_columns_dialog.twig b/templates/table/structure/move_columns_dialog.twig deleted file mode 100644 index bf826952a0..0000000000 --- a/templates/table/structure/move_columns_dialog.twig +++ /dev/null @@ -1,9 +0,0 @@ -
    -

    {% trans 'Move the columns by dragging them up and down.' %}

    -
    -
    - {{ Url_getHiddenInputs(db, table) }} -
      -
      -
      -
      diff --git a/templates/table/structure/optional_action_links.twig b/templates/table/structure/optional_action_links.twig deleted file mode 100644 index fe7cce13ff..0000000000 --- a/templates/table/structure/optional_action_links.twig +++ /dev/null @@ -1,31 +0,0 @@ -{{ Util_getIcon('b_print', 'Print'|trans, true) }} -{% if not tbl_is_view and not db_is_system_schema %} - - {{ Util_getIcon( - 'b_tblanalyse', - 'Propose table structure'|trans, - true - ) }} - - {{ Util_showMySQLDocu('procedure_analyse') }} - {% if is_active %} - - {{ Util_getIcon('eye', 'Track table'|trans, true) }} - - {% endif %} - - {{ Util_getIcon('b_move', 'Move columns'|trans, true) }} - - - {{ Util_getIcon('normalize', 'Normalize'|trans, true) }} - -{% endif %} -{% if tbl_is_view and not db_is_system_schema %} - {% if is_active %} - - {{ Util_getIcon('eye', 'Track view'|trans, true) }} - - {% endif %} -{% endif %} diff --git a/templates/table/structure/row_stats_table.twig b/templates/table/structure/row_stats_table.twig deleted file mode 100644 index e176e904bd..0000000000 --- a/templates/table/structure/row_stats_table.twig +++ /dev/null @@ -1,95 +0,0 @@ - - - - {% if showtable['Row_format'] is defined %} - - - {% if showtable['Row_format'] == 'Fixed' %} - - {% elseif showtable['Row_format'] == 'Dynamic' %} - - {% else %} - - {% endif %} - - {% endif %} - - {% if showtable['Create_options'] is not empty %} - - - {% if showtable['Create_options'] == 'partitioned' %} - - {% else %} - - {% endif %} - - {% endif %} - - {% if tbl_collation is not empty %} - - - - - {% endif %} - - {% if not is_innodb and showtable['Rows'] is defined %} - - - - - {% endif %} - - {% if not is_innodb - and showtable['Avg_row_length'] is defined - and showtable['Avg_row_length'] > 0 %} - - - {% set avg_row_length = Util_formatByteDown(showtable['Avg_row_length'], 6, 1) %} - - - {% endif %} - - {% if not is_innodb - and showtable['Data_length'] is defined - and showtable['Rows'] is defined - and showtable['Rows'] > 0 - and mergetable == false %} - - - - - {% endif %} - - {% if showtable['Auto_increment'] is defined %} - - - - - {% endif %} - - {% if showtable['Create_time'] is defined %} - - - - - {% endif %} - - {% if showtable['Update_time'] is defined %} - - - - - {% endif %} - - {% if showtable['Check_time'] is defined %} - - - - - {% endif %} - -
      {% trans 'Row statistics' %}
      {% trans 'Format' %}{% trans 'static' %}{% trans 'dynamic' %}{{ showtable['Row_format'] }}
      {% trans 'Options' %}{% trans 'partitioned' %}{{ showtable['Create_options'] }}
      {% trans 'Collation' %} - - {{ tbl_collation }} - -
      {% trans 'Rows' %}{{ Util_formatNumber(showtable['Rows'], 0) }}
      {% trans 'Row length' %}{{ avg_row_length[0] }} {{ avg_row_length[1] }}
      {% trans 'Row size' %}{{ avg_size }} {{ avg_unit }}
      {% trans 'Next autoindex' %}{{ Util_formatNumber(showtable['Auto_increment'], 0) }}
      {% trans 'Creation' %}{{ Util_localisedDate(showtable['Create_time']|date('U')) }}
      {% trans 'Last update' %}{{ Util_localisedDate(showtable['Update_time']|date('U')) }}
      {% trans 'Last check' %}{{ Util_localisedDate(showtable['Check_time']|date('U')) }}
      diff --git a/templates/table/structure/table_structure_header.twig b/templates/table/structure/table_structure_header.twig deleted file mode 100644 index 5af12980a2..0000000000 --- a/templates/table/structure/table_structure_header.twig +++ /dev/null @@ -1,21 +0,0 @@ - - - - # - {% trans 'Name' %} - {% trans 'Type' %} - {% trans 'Collation' %} - {% trans 'Attributes' %} - {% trans 'Null' %} - {% trans 'Default' %} - {% if show_column_comments -%} - {% trans 'Comments' %} - {%- endif %} - {% trans 'Extra' %} - {# @see tbl_structure.js, function moreOptsMenuResize() #} - {% if not db_is_system_schema and not tbl_is_view %} - {% trans 'Action' %} - {% endif %} - - diff --git a/templates/table/structure/table_structure_row.twig b/templates/table/structure/table_structure_row.twig deleted file mode 100644 index dd48b3dcb8..0000000000 --- a/templates/table/structure/table_structure_row.twig +++ /dev/null @@ -1,64 +0,0 @@ - - - -{{ rownum }} - - - - - - {{ extracted_columnspec['displayed_type']|raw }} - {% if relation_commwork and relation_mimework and browse_mime - and mime_map[row['Field']]['mimetype'] is defined %} -
      MIME: {{ mime_map[row['Field']]['mimetype']|replace({'_': '/'})|lower }} - {% endif %} -
      - - -{% if field_charset is not empty %} - {{ field_charset }} -{% endif %} - -{{ attribute }} -{{ row['Null'] == 'YES' ? 'Yes'|trans : 'No'|trans }} - - {% if row['Default'] is not null %} - {% if extracted_columnspec['type'] == 'bit' %} - {{ Util_convertBitDefaultValue(row['Default']) }} - {% else %} - {{ row['Default']|raw }} - {% endif %} - {% else %} - {% trans %}None{% context %}None for default{% endtrans %} - {% endif %} - -{% if show_column_comments %} - - {{ comments }} - -{% endif %} -{{ row['Extra']|upper }} -{% if not tbl_is_view and not db_is_system_schema %} - - - {{ titles['Change']|raw }} - - - - - {{ titles['Drop']|raw }} - - -{% endif %}