Do not show tooltip in table navigation

Most tables don't have any comment set and this causes serious slow down
of a navigation.
This commit is contained in:
Michal Čihař 2013-08-27 11:06:21 +02:00
parent 2f3f1bcccb
commit 1084e4dfdd
15 changed files with 7 additions and 196 deletions

View File

@ -1312,14 +1312,6 @@ Navigation panel setup
The maximum number of recently used tables shown in the navigation
panel. Set this to 0 (zero) to disable the listing of recent tables.
.. config:option:: $cfg['ShowTooltip']
:type: boolean
:default: true
Defines whether to display item comments as tooltips in navigation
panel or not.
.. config:option:: $cfg['NavigationDisplayLogo']
:type: boolean

View File

@ -826,13 +826,6 @@ $cfg['NavigationTreeTableSeparator'] = '__';
*/
$cfg['NavigationTreeTableLevel'] = 1;
/**
* display table comment as tooltip in navigation panel
*
* @global boolean $cfg['ShowTooltip']
*/
$cfg['ShowTooltip'] = true;
/**
* display logo at top of navigation panel
*

View File

@ -482,7 +482,6 @@ $strConfigRetainQueryBox_desc = __('Defines whether the query box should stay on
$strConfigRetainQueryBox_name = __('Retain query box');
$strConfigShowStats_desc = __('Allow to display database and table statistics (eg. space usage)');
$strConfigShowStats_name = __('Show statistics');
$strConfigShowTooltip_name = __('Display table comments in tooltips');
$strConfigSkipLockedTables_desc = __('Mark used tables and make it possible to show databases with locked tables');
$strConfigSkipLockedTables_name = __('Skip locked tables');
$strConfigSQLQuery_Edit_name = __('Edit');

View File

@ -178,7 +178,7 @@ $forms['Navi_panel']['Navi_tables'] = array(
'NavigationTreeDefaultTabTable',
'NavigationTreeTableSeparator',
'NavigationTreeTableLevel',
'ShowTooltip');
);
$forms['Main_panel']['Startup'] = array(
'ShowCreateDb',
'ShowStats',

View File

@ -93,7 +93,7 @@ $forms['Navi_panel']['Navi_tables'] = array(
'NavigationTreeDefaultTabTable',
'NavigationTreeTableSeparator',
'NavigationTreeTableLevel',
'ShowTooltip');
);
$forms['Main_panel']['Startup'] = array(
'ShowCreateDb',
'ShowStats',

View File

@ -106,12 +106,6 @@ if (true === $cfg['SkipLockedTables']) {
continue;
}
if ($cfg['ShowTooltip']) {
PMA_Util::fillTooltip(
$tooltip_truename, $tooltip_aliasname, $sts_tmp
);
}
$tables[$sts_tmp['Name']] = $sts_tmp;
} else { // table in use
$tables[$tmp[0]] = array('Name' => $tmp[0]);
@ -190,14 +184,6 @@ if (! isset($sot_ready)) {
);
}
}
if ($cfg['ShowTooltip']) {
foreach ($tables as $each_table) {
PMA_Util::fillTooltip(
$tooltip_truename, $tooltip_aliasname, $each_table
);
}
}
}
/**

View File

@ -933,17 +933,7 @@ class PMA_NavigationTree
$retval .= htmlspecialchars($node->name);
$retval .= "</a>";
} else {
if ($GLOBALS['cfg']['ShowTooltip']) {
$title = $node->getComment();
if ($title) {
$title = ' title="'
. htmlentities($title, ENT_QUOTES, 'UTF-8')
. '"';
}
} else {
$title = '';
}
$retval .= "<a$dblinkclass$linkClass$title href='$link'>";
$retval .= "<a$dblinkclass$linkClass href='$link'>";
$retval .= htmlspecialchars($node->real_name);
$retval .= "</a>";
}

View File

@ -362,23 +362,12 @@ class Node
// @todo obey the DisableIS directive
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= $this->_getWhereClause($searchClause);
$query .= $this->_getWhereClause($searchClause);
$query .= "ORDER BY `SCHEMA_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
return PMA_DBI_fetch_result($query);
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
return '';
}
/**
* Returns the number of children of type $type present inside this container
* This method is overridden by the Node_Database and Node_Table classes
@ -394,7 +383,7 @@ class Node
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= $this->_getWhereClause($searchClause);
$query .= $this->_getWhereClause($searchClause);
$retval = (int)PMA_DBI_fetch_value($query);
} else {
$query = "SHOW DATABASES ";
@ -412,11 +401,11 @@ class Node
/**
* Returns the WHERE clause depending on the $searchClause parameter
* and the hide_db directive
* and the hide_db directive
*
* @param string $searchClause A string used to filter the results of the query
*
* @return string
* @return string
*/
private function _getWhereClause($searchClause = '')
{

View File

@ -41,31 +41,6 @@ class Node_Column extends Node
. '&amp;token=' . $GLOBALS['token']
);
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
$db = PMA_Util::sqlAddSlashes(
$this->realParent()->realParent()->real_name
);
$table = PMA_Util::sqlAddSlashes(
$this->realParent()->real_name
);
$column = PMA_Util::sqlAddSlashes(
$this->real_name
);
$query = "SELECT `COLUMN_COMMENT` ";
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
$query .= "AND `TABLE_NAME`='$table' ";
$query .= "AND `COLUMN_NAME`='$column' ";
return PMA_DBI_fetch_value($query);
}
}
?>

View File

@ -430,18 +430,6 @@ class Node_Database extends Node
}
return $retval;
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
return PMA_getDbComment($this->real_name);
}
}
?>

View File

@ -40,27 +40,6 @@ class Node_Event extends Node
);
$this->classes = 'event';
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
$db = PMA_Util::sqlAddSlashes(
$this->realParent()->real_name
);
$event = PMA_Util::sqlAddSlashes(
$this->real_name
);
$query = "SELECT `EVENT_COMMENT` ";
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
$query .= "WHERE `EVENT_SCHEMA`='$db' ";
$query .= "AND `EVENT_NAME`='$event' ";
return PMA_DBI_fetch_value($query);
}
}
?>

View File

@ -40,28 +40,6 @@ class Node_Function extends Node
);
$this->classes = 'function';
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
$db = PMA_Util::sqlAddSlashes(
$this->realParent()->real_name
);
$routine = PMA_Util::sqlAddSlashes(
$this->real_name
);
$query = "SELECT `ROUTINE_COMMENT` ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='$db' ";
$query .= "AND `ROUTINE_NAME`='$routine' ";
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
return PMA_DBI_fetch_value($query);
}
}
?>

View File

@ -40,28 +40,6 @@ class Node_Procedure extends Node
);
$this->classes = 'procedure';
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
$db = PMA_Util::sqlAddSlashes(
$this->realParent()->real_name
);
$routine = PMA_Util::sqlAddSlashes(
$this->real_name
);
$query = "SELECT `ROUTINE_COMMENT` ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='$db' ";
$query .= "AND `ROUTINE_NAME`='$routine' ";
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
return PMA_DBI_fetch_value($query);
}
}
?>

View File

@ -197,33 +197,6 @@ class Node_Table extends Node
}
return $retval;
}
/**
* Returns the comment associated with node
* This method should be overridden by specific type of nodes
*
* @return string
*/
public function getComment()
{
$db = $this->realParent()->real_name;
$table = PMA_Util::sqlAddSlashes($this->real_name);
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$query = "SELECT `TABLE_COMMENT` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
$query .= "AND `TABLE_NAME`='$table' ";
$retval = PMA_DBI_fetch_value($query);
} else {
$db = PMA_Util::backquote($db);
$query = "SHOW TABLE STATUS FROM $db ";
$query .= "WHERE Name = '$table'";
$arr = PMA_DBI_fetch_assoc(PMA_DBI_try_query($query));
$retval = $arr['Comment'];
}
return $retval;
}
}
?>

View File

@ -155,14 +155,5 @@ class Node_test extends PHPUnit_Framework_TestCase
$parent->addChild($child);
$this->assertEquals($child->hasSiblings(), false);
}
public function testComment()
{
// A non-qualified Node shouldn't have a comment
$this->assertEquals(
PMA_NodeFactory::getInstance()->getComment(),
''
);
}
}
?>