(tab: SQLEditorTab)
| 38 | }; |
| 39 | |
| 40 | export const isConnectedSQLEditorTab = (tab: SQLEditorTab): boolean => { |
| 41 | const { instance, database } = getConnectionForSQLEditorTab(tab); |
| 42 | if (!instance) { |
| 43 | return false; |
| 44 | } |
| 45 | if (!isValidInstanceName(instance.name)) { |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | if (instanceV1AllowsCrossDatabaseQuery(instance)) { |
| 50 | // Connecting to instance directly. |
| 51 | return true; |
| 52 | } |
| 53 | return !!database && isValidDatabaseName(database.name); |
| 54 | }; |
| 55 | |
| 56 | /** |
| 57 | * Resolves the connection record for a worksheet by hydrating its database |
no test coverage detected