Remove multiple navigation reloads, fix autoexpand on use query
This commit is contained in:
parent
278145ffd3
commit
f7e298bbf4
@ -73,7 +73,6 @@ var PMA_commonParams = (function () {
|
||||
set: function (name, value) {
|
||||
if (params[name] !== undefined && params[name] !== value) {
|
||||
PMA_querywindow.refresh();
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
if(name == 'db' && value !== '') {
|
||||
PMA_autoExpandDatabaseInUse(params['db'], value);
|
||||
|
||||
@ -177,12 +177,14 @@ function PMA_expandNavigationTree($expandElem) {
|
||||
}
|
||||
} else {
|
||||
var $destination = $expandElem.closest('li');
|
||||
var $throbber = $('#pma_navigation .throbber')
|
||||
.first()
|
||||
.clone()
|
||||
.css('visibility', 'visible');
|
||||
$icon.hide();
|
||||
$throbber.insertBefore($icon);
|
||||
if($icon.siblings('.throbber').length <= 0) {
|
||||
var $throbber = $('#pma_navigation .throbber')
|
||||
.first()
|
||||
.clone()
|
||||
.css('visibility', 'visible');
|
||||
$icon.hide();
|
||||
$throbber.insertBefore($icon);
|
||||
}
|
||||
|
||||
var searchClause = PMA_fastFilter.getSearchClause();
|
||||
var searchClause2 = PMA_fastFilter.getSearchClause2($expandElem);
|
||||
@ -215,7 +217,8 @@ function PMA_expandNavigationTree($expandElem) {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
$icon.show();
|
||||
$throbber.remove();
|
||||
if($icon.siblings('.throbber').length)
|
||||
$icon.siblings('.throbber').remove();
|
||||
});
|
||||
}
|
||||
$expandElem.blur();
|
||||
@ -229,10 +232,14 @@ function PMA_expandNavigationTree($expandElem) {
|
||||
*
|
||||
*/
|
||||
function scrollToView($element, $container) {
|
||||
var pushToOffset = $element.offset().top - $container.offset().top + $container.scrollTop();
|
||||
$('#pma_navigation_tree_content').stop().animate({
|
||||
scrollTop: pushToOffset
|
||||
});
|
||||
var elementOffset = $element.offset(),
|
||||
containerOffset = $container.offset();
|
||||
if(elementOffset != undefined && containerOffset != undefined) {
|
||||
var pushToOffset = elementOffset.top - containerOffset.top + $container.scrollTop();
|
||||
$('#pma_navigation_tree_content').stop().animate({
|
||||
scrollTop: pushToOffset
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -263,7 +270,7 @@ function PMA_autoExpandDatabaseInUse($oldDb, $newDb) {
|
||||
if ($oldDb !== $newDb) {
|
||||
setTimeout(function() {
|
||||
scrollToView($expandElem.closest('li'), $('#pma_navigation_tree_content'));
|
||||
}, 150);
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,6 +329,7 @@ function PMA_reloadNavigation(callback) {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call();
|
||||
}
|
||||
PMA_autoExpandDatabaseInUse('', PMA_commonParams.get('db'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
|
||||
@ -296,7 +296,6 @@ AJAX.registerOnload('sql.js', function() {
|
||||
} else if (typeof data.reload != 'undefined') {
|
||||
// this happens if a USE or DROP command was typed
|
||||
PMA_commonActions.setDb(data.db);
|
||||
PMA_reloadNavigation();
|
||||
PMA_commonActions.refreshMain(false, function () {
|
||||
if ($('#result_query').length) {
|
||||
$('#result_query').remove();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user