Feature Requests item #3300418: Fast database search.
This commit is contained in:
parent
f447066be6
commit
6130edd505
@ -202,6 +202,37 @@ function clear_fast_filter()
|
||||
fast_filter('');
|
||||
}
|
||||
|
||||
/**
|
||||
* hide all LI elements with second A tag which doesn`t contain requested value
|
||||
*
|
||||
* @param string value requested value
|
||||
*
|
||||
*/
|
||||
function fast_db_filter(value)
|
||||
{
|
||||
var lowercase_value = value.toLowerCase();
|
||||
|
||||
$('#databaseList li a').each(function(idx, elem) {
|
||||
var $elem = $(elem);
|
||||
if (value && $elem.html().toLowerCase().indexOf(lowercase_value) == -1) {
|
||||
$elem.parent().hide();
|
||||
} else {
|
||||
$elem.parents('li').show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears fast database filter.
|
||||
*/
|
||||
function clear_fast_db_filter()
|
||||
{
|
||||
var $elm = $('#fast_db_filter');
|
||||
$elm.val('');
|
||||
fast_db_filter('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the recent tables list.
|
||||
*/
|
||||
@ -251,6 +282,32 @@ $(function(){
|
||||
}
|
||||
});
|
||||
|
||||
/* Fast database filter */
|
||||
var txtDb = $('#fast_db_filter').val();
|
||||
|
||||
$('#fast_db_filter.gray').live('focus', function() {
|
||||
$(this).removeClass('gray');
|
||||
clear_fast_db_filter();
|
||||
});
|
||||
|
||||
$('#fast_db_filter:not(.gray)').live('focusout', function() {
|
||||
var $input = $(this);
|
||||
if ($input.val() == '') {
|
||||
$input
|
||||
.addClass('gray')
|
||||
.val(txtDb);
|
||||
}
|
||||
});
|
||||
|
||||
$('#clear_fast_db_filter').click(function() {
|
||||
clear_fast_db_filter();
|
||||
$('#fast_db_filter').focus();
|
||||
});
|
||||
|
||||
$('#fast_db_filter').keyup(function(evt) {
|
||||
fast_db_filter($(this).val());
|
||||
});
|
||||
|
||||
/* Jump to recent table */
|
||||
$('#recentTable').change(function() {
|
||||
if (this.value != '') {
|
||||
|
||||
@ -883,6 +883,14 @@ $cfg['DisplayServersList'] = false;
|
||||
*/
|
||||
$cfg['DisplayDatabasesList'] = 'auto';
|
||||
|
||||
/**
|
||||
* display a JavaScript database filter in the left frame
|
||||
* when more then x databases are present
|
||||
*
|
||||
* @global boolean $cfg['LeftDisplayDatabaseFilterMinimum']
|
||||
*/
|
||||
$cfg['LeftDisplayDatabaseFilterMinimum'] = 30;
|
||||
|
||||
/**
|
||||
* target of the navigation panel quick access icon
|
||||
*
|
||||
|
||||
@ -278,6 +278,7 @@ $strConfigLeftDisplayLogo_name = __('Display logo');
|
||||
$strConfigLeftDisplayServers_desc = __('Display server choice at the top of the left frame');
|
||||
$strConfigLeftDisplayServers_name = __('Display servers selection');
|
||||
$strConfigLeftDisplayTableFilterMinimum_name = __('Minimum number of tables to display the table filter box');
|
||||
$strConfigLeftDisplayDatabaseFilterMinimum_name = __('Minimum number of databases to display the database filter box');
|
||||
$strConfigLeftFrameDBSeparator_desc = __('String that separates databases into different tree levels');
|
||||
$strConfigLeftFrameDBSeparator_name = __('Database tree separator');
|
||||
$strConfigLeftFrameDBTree_desc = __('Only light version; display databases in a tree (determined by the separator defined below)');
|
||||
|
||||
@ -84,6 +84,7 @@ $forms['Left_frame']['Left_frame'] = array(
|
||||
'LeftPointerEnable',
|
||||
'LeftRecentTable');
|
||||
$forms['Left_frame']['Left_databases'] = array(
|
||||
'LeftDisplayDatabaseFilterMinimum',
|
||||
'DisplayDatabasesList',
|
||||
'LeftFrameDBTree',
|
||||
'LeftFrameDBSeparator',
|
||||
|
||||
@ -201,8 +201,19 @@ if (! $GLOBALS['server']) {
|
||||
.'</form>' . "\n"
|
||||
. '</div>' . "\n";
|
||||
} else {
|
||||
|
||||
if (count($GLOBALS['pma']->databases) >= $GLOBALS['cfg']['LeftDisplayDatabaseFilterMinimum']) {
|
||||
?>
|
||||
<span id="NavDbFilter">
|
||||
<span id="clear_fast_db_filter" title="<?php echo __('Clear'); ?>">X</span>
|
||||
<input type="text" class="gray" name="fast_db_filter" id="fast_db_filter" title="<?php echo __('Filter databases by name'); ?>" value="<?php echo __('Filter databases by name'); ?>" />
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
|
||||
}
|
||||
|
||||
$_url_params = array('pos' => $pos);
|
||||
PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
|
||||
}
|
||||
|
||||
@ -232,7 +232,8 @@ div#left_tableList ul ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#clear_fast_filter {
|
||||
#clear_fast_filter,
|
||||
#clear_fast_db_filter {
|
||||
background: white;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
@ -242,13 +243,16 @@ div#left_tableList ul ul {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#fast_filter {
|
||||
#fast_filter,
|
||||
#fast_db_filter {
|
||||
width: 100%;
|
||||
padding: 2px 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#fast_filter.gray {
|
||||
#fast_filter.gray,
|
||||
#fast_db_fiter.gray {
|
||||
color: gray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -292,7 +292,8 @@ div#left_tableList ul ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#clear_fast_filter {
|
||||
#clear_fast_filter,
|
||||
#clear_fast_db_filter {
|
||||
background: white;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
@ -302,11 +303,13 @@ div#left_tableList ul ul {
|
||||
right: 3ex;
|
||||
}
|
||||
|
||||
#fast_filter {
|
||||
#fast_filter,
|
||||
#fast_db_filter {
|
||||
width: 85%;
|
||||
padding: .1em;
|
||||
}
|
||||
|
||||
#fast_filter.gray {
|
||||
#fast_filter.gray,
|
||||
#fast_db_filter.gray {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user