mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added support to copy SQL from main window to query tool. Fixes #4904
This commit is contained in:
committed by
Akshay Joshi
parent
78b041465e
commit
7483ddf2b2
@@ -902,6 +902,7 @@ define('pgadmin.browser.node', [
|
||||
|
||||
// Callback to render query editor
|
||||
show_query_tool: function(args, item) {
|
||||
var preference = pgBrowser.get_preference('sqleditor', 'copy_sql_to_query_tool');
|
||||
var t = pgBrowser.tree,
|
||||
i = item || t.selected(),
|
||||
d = i && i.length == 1 ? t.itemData(i) : undefined;
|
||||
@@ -910,7 +911,17 @@ define('pgadmin.browser.node', [
|
||||
return;
|
||||
|
||||
// Here call data grid method to render query tool
|
||||
pgAdmin.DataGrid.show_query_tool('', i);
|
||||
//Open query tool with create script if copy_sql_to_query_tool is true else open blank query tool
|
||||
if(preference.value && !d._type.includes('coll-')){
|
||||
var stype = d._type.toLowerCase();
|
||||
var data = {
|
||||
'script': stype,
|
||||
data_disabled: gettext('The selected tree node does not support this option.'),
|
||||
};
|
||||
pgBrowser.Node.callbacks.show_script(data);
|
||||
}else{
|
||||
pgAdmin.DataGrid.show_query_tool('', i);
|
||||
}
|
||||
},
|
||||
|
||||
// Callback to render psql tool.
|
||||
|
||||
Reference in New Issue
Block a user