Skip to content

Commit

Permalink
Ensure browser toolbar are enabled only on database object selection.p…
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshmahajan-1903 committed Jan 8, 2025
1 parent bac50e1 commit 2ebec27
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export class FileTreeItem extends React.Component<IItemRendererXProps & IItemRen
data-depth={item.depth}
onContextMenu={this.handleContextMenu}
onClick={this.handleClick}
onDoubleClick={this.handleDoubleClick}
onDragStart={this.handleDragStartItem}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
Expand All @@ -107,7 +106,7 @@ export class FileTreeItem extends React.Component<IItemRendererXProps & IItemRen
: null
}

<span className='file-label'>
<span className='file-label' onDoubleClick={this.handleDoubleClick}>
{
item._metadata?.data?.icon ?
<i className={cn('file-icon', item._metadata?.data?.icon ? item._metadata.data.icon : fileOrDir)} /> : null
Expand Down
5 changes: 4 additions & 1 deletion web/pgadmin/tools/psql/static/js/PsqlModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export default class Psql {
let isEnabled = (() => {
if (!_.isUndefined(obj) && !_.isNull(obj) && pgAdmin['enable_psql']) {
if (_.indexOf(pgAdmin.unsupported_nodes, obj._type) == -1) {
if (obj._type == 'database' && obj.allowConn) {
let t = pgBrowser.tree,
selected_item = t.selected(),
selected_item_type = t.findNodeByDomElement(selected_item).getData()._type;
if (selected_item_type == 'database' && obj._type == 'database' && obj.allowConn) {
return true;
} else if (obj._type != 'database') {
return true;
Expand Down
5 changes: 4 additions & 1 deletion web/pgadmin/tools/search_objects/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export default class SearchObjectModule {
let isEnabled = (() => {
if (!_.isUndefined(obj) && !_.isNull(obj)) {
if (_.indexOf(pgAdmin.unsupported_nodes, obj._type) == -1) {
if (obj._type == 'database' && obj.allowConn) {
let t = pgBrowser.tree,
selected_item = t.selected(),
selected_item_type = t.findNodeByDomElement(selected_item).getData()._type;
if (selected_item_type == 'database' && obj._type == 'database' && obj.allowConn) {
return true;
} else if (obj._type != 'database') {
return true;
Expand Down
5 changes: 4 additions & 1 deletion web/pgadmin/tools/sqleditor/static/js/SQLEditorModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export default class SQLEditor {
let isEnabled = (() => {
if (!_.isUndefined(obj) && !_.isNull(obj)) {
if (_.indexOf(pgAdmin.unsupported_nodes, obj._type) == -1) {
if (obj._type == 'database' && obj.allowConn) {
let t = pgBrowser.tree,
selected_item = t.selected(),
selected_item_type = t.findNodeByDomElement(selected_item).getData()._type;
if ( selected_item_type == 'database' && obj._type == 'database' && obj.allowConn) {
return true;
} else if (obj._type != 'database') {
return true;
Expand Down

0 comments on commit 2ebec27

Please sign in to comment.