Updated the misc module javascripts to work with latest wcDocker.

This commit is contained in:
Neel Patel
2016-02-29 19:34:06 +05:30
committed by Ashesh Vashi
parent 18d767b107
commit 000c76871f
2 changed files with 79 additions and 21 deletions

View File

@@ -19,13 +19,30 @@ function(_, $, pgBrowser) {
var sqlPanels = pgBrowser.docker.findPanels('sql');
// We will listend to the visibility change of the SQL panel
pgBrowser.Events.on('pgadmin-browser:panel-sql:' + wcDocker.EVENT.VISIBILITY_CHANGED, this.sqlPanelVisibilityChanged);
pgBrowser.Events.on(
'pgadmin-browser:panel-sql:' + wcDocker.EVENT.VISIBILITY_CHANGED,
this.sqlPanelVisibilityChanged
);
// Hmm.. Did we find the SQL panel, and is it visible (openned)?
// If that is the case - we need to listen the browser tree selection
// events.
if ((sqlPanels.length == 1 && sqlPanels[0].isVisible()) || sqlPanels.length != 1) {
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showSQL);
if (sqlPanels.length == 0) {
pgBrowser.Events.on(
'pgadmin-browser:panel-sql:' + wcDocker.EVENT.INIT,
function() {
if ((sqlPanels[0].isVisible()) || sqlPanels.length != 1) {
pgBrowser.Events.on(
'pgadmin-browser:tree:selected', this.showSQL
);
}
}.bind(this)
);
}
else {
if ((sqlPanels[0].isVisible()) || sqlPanels.length != 1) {
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showSQL);
}
}
},
showSQL: function(item, data, node) {