public inbox for [email protected]  
help / color / mirror / Atom feed
From: Yogesh Mahajan <[email protected]>
To: pgadmin-hackers <[email protected]>
Cc: Akshay Joshi <[email protected]>
Subject: Re: [pgAdmin][Patch] RM 6082 - Able to change connection when a long query is running
Date: Wed, 7 Apr 2021 13:40:16 +0530
Message-ID: <CAMa=N=PgzM_BTo_Be=M-B2SSushHhyQTqHXh9xNKq49P5rsc1w@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDebOVRcBFCnirC=cF=DoC5fZHksQi21jLO11BjUL47D9w@mail.gmail.com>
References: <CAMa=N=Pg3e9MVVzJT3jYj91STcwVQBWr_ki0=7F0OF-og3nw5Q@mail.gmail.com>
	<CANxoLDebOVRcBFCnirC=cF=DoC5fZHksQi21jLO11BjUL47D9w@mail.gmail.com>

Hello,

Sorry for the inconvenience.
Please update the patch.

Thanks,
Yogesh Mahajan
EnterpriseDB


On Tue, Apr 6, 2021 at 4:07 PM Akshay Joshi <[email protected]>
wrote:

> Hi Yogesh
>
> The issue is not fixed yet. I am able to change the connection while the
> transaction is in progress. Please check and resend the patch.
>
> On Tue, Apr 6, 2021 at 1:43 PM Yogesh Mahajan <
> [email protected]> wrote:
>
>> Hello,
>>
>> Please find a patch which diables change of connection from query tool
>> while query tool transaction is in progress.
>>
>>
>> Thanks,
>> Yogesh Mahajan
>> EnterpriseDB
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


Attachments:

  [application/octet-stream] RM6082_v2.patch (3.0K, 3-RM6082_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/sqleditor/execute_query.js b/web/pgadmin/static/js/sqleditor/execute_query.js
index 2c966550c..8b3e1d91b 100644
--- a/web/pgadmin/static/js/sqleditor/execute_query.js
+++ b/web/pgadmin/static/js/sqleditor/execute_query.js
@@ -13,6 +13,7 @@ import url_for from '../url_for';
 import axios from 'axios';
 import * as httpErrorHandler from './query_tool_http_error_handler';
 import * as queryTxnStatus from 'sources/sqleditor/query_txn_status_constants';
+import * as SqlEditorUtils from 'sources/sqleditor_utils';
 
 class LoadingScreen {
   constructor(sqlEditor) {
@@ -75,6 +76,8 @@ class ExecuteQuery {
 
         if (ExecuteQuery.isSqlCorrect(httpMessageData)) {
           self.loadingScreen.setMessage('Waiting for the query to complete...');
+          // Disable drop down arrow to change connections
+          SqlEditorUtils.disable_connection_dropdown(true);
 
           self.updateSqlEditorStateWithInformationFromServer(httpMessageData.data);
 
@@ -161,6 +164,10 @@ class ExecuteQuery {
           self.loadingScreen.hide();
           self.sqlServerObject.update_msg_history(false, 'Execution Cancelled!', true);
         }
+        // Enable dropdown arrow to change connection if status is not Busy
+        if(! ExecuteQuery.isQueryStillRunning(httpMessage)){
+          SqlEditorUtils.disable_connection_dropdown(false);
+        }
       }
     ).catch(
       error => {
@@ -168,6 +175,8 @@ class ExecuteQuery {
         self.sqlServerObject.resetQueryHistoryObject(self.sqlServerObject);
 
         self.loadingScreen.hide();
+        // Enable dropdown arrow to change connection
+        SqlEditorUtils.disable_connection_dropdown(false);
         self.sqlServerObject.setIsQueryRunning(false);
         if (self.sqlServerObject.is_query_tool) {
           self.enableSQLEditorButtons();
@@ -229,6 +238,7 @@ class ExecuteQuery {
     this.loadingScreen.hide();
     this.enableSQLEditorButtons();
 
+    SqlEditorUtils.disable_connection_dropdown(false);
     if (ExecuteQuery.wasConnectionLostToPythonServer(httpMessage.response)) {
       this.handleConnectionToServerLost();
       return;
diff --git a/web/pgadmin/static/js/sqleditor_utils.js b/web/pgadmin/static/js/sqleditor_utils.js
index 5f5b149e0..e51cab57b 100644
--- a/web/pgadmin/static/js/sqleditor_utils.js
+++ b/web/pgadmin/static/js/sqleditor_utils.js
@@ -57,6 +57,17 @@ define(['jquery', 'underscore', 'sources/gettext', 'sources/url_for'],
         return string.charAt(0).toUpperCase() + string.slice(1);
       },
 
+      // Disables arrow to change connection
+      disable_connection_dropdown: function (status) {
+        if (status){
+          $('.conn-info-dd').prop('disabled',true);
+          $('.connection-data').css({pointerEvents: 'none', cursor: 'arrow'});
+        }else{
+          $('.conn-info-dd').prop('disabled',false);
+          $('.connection-data').css({pointerEvents: 'auto', cursor: 'pointer'});
+        }
+      },
+
       // Status flag
       previousStatus: null,
 


view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin][Patch] RM 6082 - Able to change connection when a long query is running
  In-Reply-To: <CAMa=N=PgzM_BTo_Be=M-B2SSushHhyQTqHXh9xNKq49P5rsc1w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox