The branch, master has been updated via e16182441861e255b26d0216ae3e531b1c309098 (commit) from eb21b9704137e9ab3e9b1efbc4d65d9bf8e9d04c (commit)
- Log ----------------------------------------------------------------- commit e16182441861e255b26d0216ae3e531b1c309098 Author: Marc Delisle marc@infomarc.info Date: Sun Nov 14 07:37:14 2010 -0500
adjust totals when emptying a table; also use classes for more precise handling of td
-----------------------------------------------------------------------
Summary of changes: db_structure.php | 8 ++++---- js/db_structure.js | 50 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/db_structure.php b/db_structure.php index d5c960d..416e1cc 100644 --- a/db_structure.php +++ b/db_structure.php @@ -381,7 +381,7 @@ foreach ($tables as $keyname => $each_table) { $show_superscript = ''; } ?> - <td class="value"><?php echo $row_count_pre . PMA_formatNumber($each_table['TABLE_ROWS'], 0) . $show_superscript; ?></td> + <td class="value tbl_rows"><?php echo $row_count_pre . PMA_formatNumber($each_table['TABLE_ROWS'], 0) . $show_superscript; ?></td> <?php if (!($cfg['PropertiesNumColumns'] > 1)) { ?> <td nowrap="nowrap"><?php echo ($table_is_view ? __('View') : $each_table['ENGINE']); ?></td> <?php if (isset($collation)) { ?> @@ -390,7 +390,7 @@ foreach ($tables as $keyname => $each_table) { <?php } ?>
<?php if ($is_show_stats) { ?> - <td class="value"><a + <td class="value tbl_size"><a href="tbl_structure.php?<?php echo $tbl_url_query; ?>#showusage" ><?php echo $formatted_size . ' ' . $unit; ?></a></td> <td class="value"><?php echo $overhead; ?></td> @@ -439,7 +439,7 @@ if ($is_show_stats) { ?> <th colspan="<?php echo ($db_is_information_schema ? 3 : 6) ?>" align="center"> <?php echo __('Sum'); ?></th> - <th class="value"><?php echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0); ?></th> + <th class="value tbl_rows"><?php echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0); ?></th> <?php if (!($cfg['PropertiesNumColumns'] > 1)) { $default_engine = PMA_DBI_get_default_engine(); @@ -458,7 +458,7 @@ if (!($cfg['PropertiesNumColumns'] > 1)) {
if ($is_show_stats) { ?> - <th class="value"><?php echo $sum_formatted . ' ' . $unit; ?></th> + <th class="value tbl_size"><?php echo $sum_formatted . ' ' . $unit; ?></th> <th class="value"><?php echo $overhead_formatted . ' ' . $overhead_unit; ?></th> <?php } diff --git a/js/db_structure.js b/js/db_structure.js index 034f56d..1c8c64c 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -1,3 +1,4 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * @fileoverview functions used on the database structure page * @name Database Structure @@ -47,27 +48,40 @@ $(document).ready(function() { PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) { - if(data.success == true) { + if (data.success == true) { PMA_ajaxShowMessage(data.message); - //Fetch inner span of this anchor - //and replace the icon with its disabled version - var span = $this_anchor.html().replace(/b_empty.png/, 'bd_empty.png'); - // find parent td of this anchor - $this_anchor.parent() - // set number of rows to 0 - .next().next().text('0') - // set size to unknown (not sure how to get the exact - // value here, as an empty InnoDB table would have a size) - .next().next().next().text('-'); + //Fetch inner span of this anchor + //and replace the icon with its disabled version + var span = $this_anchor.html().replace(/b_empty.png/, 'bd_empty.png'); + var $parent_tr = $this_anchor.closest('tr'); + var $rows_td = $parent_tr.find('.tbl_rows'); + var $size_td = $parent_tr.find('.tbl_size'); + var num_rows = parseInt($rows_td.text()); + // set number of rows to 0 + $rows_td.text('0'); + // set size to unknown (not sure how to get the exact + // value here, as an empty InnoDB table would have a size) + $size_td.text('-'); + + // try to compute a new total row number + if (! isNaN(num_rows)) { + $total_rows_td = $('#tbl_summary_row').find('.tbl_rows'); + var total_rows = parseInt($total_rows_td.text()); + if (! isNaN(total_rows)) { + $total_rows_td.text(total_rows - num_rows); + } + }
- $this_anchor - //To disable further attempts to truncate the table, - //replace the a element with its inner span (modified) - .replaceWith(span) - .removeClass('truncate_table_anchor'); + // prefix total size with "~" + var $total_size_td = $('#tbl_summary_row').find('.tbl_size'); + $total_size_td.text($total_size_td.text().replace(/^/,'~'));
- } - else { + //To disable further attempts to truncate the table, + //replace the a element with its inner span (modified) + $this_anchor + .replaceWith(span) + .removeClass('truncate_table_anchor'); + } else { PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error); } }) // end $.get()
hooks/post-receive