(_data, treeIdentifier, connectionInfo=null)
| 104 | } |
| 105 | |
| 106 | openPsqlTool(_data, treeIdentifier, connectionInfo=null) { |
| 107 | let parentData = null; |
| 108 | let panelTitle = ''; |
| 109 | if (connectionInfo){ |
| 110 | parentData = { |
| 111 | server_group: { |
| 112 | _id: connectionInfo.sgid || 0 |
| 113 | }, |
| 114 | server: { |
| 115 | _id: connectionInfo.sid, |
| 116 | server_type: connectionInfo.server_type, |
| 117 | label: connectionInfo.server_name, |
| 118 | user: { |
| 119 | name: connectionInfo.user |
| 120 | } |
| 121 | }, |
| 122 | database: { |
| 123 | _id: connectionInfo.did, |
| 124 | _label: connectionInfo.db |
| 125 | }, |
| 126 | schema: { |
| 127 | _id: connectionInfo.scid || null, |
| 128 | }, |
| 129 | table: { |
| 130 | _id: connectionInfo.tid || null, |
| 131 | } |
| 132 | }; |
| 133 | |
| 134 | }else{ |
| 135 | const serverInformation = retrieveAncestorOfTypeServer(pgBrowser, treeIdentifier, gettext('PSQL Error')); |
| 136 | if (!hasBinariesConfiguration(pgBrowser, serverInformation)) { |
| 137 | return; |
| 138 | } |
| 139 | |
| 140 | const node = pgBrowser.tree.findNodeByDomElement(treeIdentifier); |
| 141 | if (node === undefined || !node.getData()) { |
| 142 | pgAdmin.Browser.notifier.alert( |
| 143 | gettext('PSQL Error'), |
| 144 | gettext('No object selected.') |
| 145 | ); |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | parentData = pgBrowser.tree.getTreeNodeHierarchy(treeIdentifier); |
| 150 | if(_.isUndefined(parentData.server)) { |
| 151 | pgAdmin.Browser.notifier.alert( |
| 152 | gettext('PSQL Error'), |
| 153 | gettext('Please select a server/database object.') |
| 154 | ); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | } |
| 159 | |
| 160 | const transId = getRandomInt(1, 9999999); |
| 161 | // Set psql tab title as per prefrences setting. |
| 162 | let title_data = { |
| 163 | 'database': parentData.database ? _.unescape(parentData.database._label) : 'postgres' , |
no test coverage detected