public inbox for [email protected]  
help / color / mirror / Atom feed
From: Yogesh Mahajan <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][Patch] RM 6082 - Able to change connection when a long query is running
Date: Tue, 6 Apr 2021 13:42:24 +0530
Message-ID: <CAMa=N=Pg3e9MVVzJT3jYj91STcwVQBWr_ki0=7F0OF-og3nw5Q@mail.gmail.com> (raw)

Hello,

Please find a patch which diables change of connection from query tool
while query tool transaction is in progress.


Thanks,
Yogesh Mahajan
EnterpriseDB


Attachments:

  [application/octet-stream] RM6082_v1.patch (2.0K, 3-RM6082_v1.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..60ca49296 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) {
@@ -59,6 +60,7 @@ class ExecuteQuery {
 
     const self = this;
     self.explainPlan = explainPlan;
+    SqlEditorUtils.disable_connection_dropdown(true);
 
     const sqlStatementWithAnalyze = ExecuteQuery.prepareAnalyzeSql(sqlStatement, explainPlan);
 
@@ -98,6 +100,7 @@ class ExecuteQuery {
           // Highlight the error in the sql panel
           self.sqlServerObject._highlight_error(httpMessageData.data.result);
         }
+        SqlEditorUtils.disable_connection_dropdown(false);
       }).catch(function (error) {
         self.onExecuteHTTPError(error);
       }
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]
  Subject: Re: [pgAdmin][Patch] RM 6082 - Able to change connection when a long query is running
  In-Reply-To: <CAMa=N=Pg3e9MVVzJT3jYj91STcwVQBWr_ki0=7F0OF-og3nw5Q@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