public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - Cloud Wizard fixes
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch] - Cloud Wizard fixes
@ 2022-03-02 12:04  Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Khushboo Vashi @ 2022-03-02 12:04 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

Please find the attached patch to fix the below issues/suggestions:

- Mask the credentials input fields
- Loading symbol doesn't work while reloading the options in the select
control
- Decrease the wizard opening timeout
- Host IP fetch issue due to urllib library upgrade

Thanks,
Khushboo


Attachments:

  [application/octet-stream] cloud_aws_fixes.patch (4.8K, 3-cloud_aws_fixes.patch)
  download | inline diff:
diff --git a/web/pgacloud/utils/misc.py b/web/pgacloud/utils/misc.py
index 5d66f354c..ddbbf04cb 100644
--- a/web/pgacloud/utils/misc.py
+++ b/web/pgacloud/utils/misc.py
@@ -16,16 +16,14 @@ def get_my_ip():
     """ Return the public IP of this host """
     http = urllib3.PoolManager()
     try:
-        external_ip = http.request.urlopen(
-            'https://ident.me').read().decode('utf8')
+        external_ip = http.request('GET', 'https://ident.me').data
     except Exception:
         try:
-            external_ip = http.request.urlopen(
-                'https://ifconfig.me/ip').read().decode('utf8')
+            external_ip = http.request('GET', 'https://ifconfig.me/ip').data
         except Exception:
             external_ip = '127.0.0.1'
 
-    return external_ip
+    return '{}/{}'.format(external_ip, 32)
 
 
 def get_random_id():
diff --git a/web/pgadmin/misc/cloud/__init__.py b/web/pgadmin/misc/cloud/__init__.py
index b94fd018e..c03502813 100644
--- a/web/pgadmin/misc/cloud/__init__.py
+++ b/web/pgadmin/misc/cloud/__init__.py
@@ -114,7 +114,9 @@ def script():
                  methods=['GET'], endpoint='get_host_ip')
 @login_required
 def get_host_ip():
-    return make_json_response(data=get_my_ip())
+    """test"""
+    ip = get_my_ip()
+    return make_json_response(data=ip)
 
 
 @blueprint.route('/verify_credentials/',
diff --git a/web/pgadmin/misc/cloud/static/js/cloud.js b/web/pgadmin/misc/cloud/static/js/cloud.js
index 4200f1db9..b57337d87 100644
--- a/web/pgadmin/misc/cloud/static/js/cloud.js
+++ b/web/pgadmin/misc/cloud/static/js/cloud.js
@@ -128,7 +128,7 @@ define('pgadmin.misc.cloud', [
                 return setTimeout((function () {
                   ReactDOM.unmountComponentAtNode(document.getElementById('cloudWizardDlg'));
                   return Alertify.cloudWizardDialog().destroy();
-                }), 500);
+                }), 10);
               },
             }
           };
diff --git a/web/pgadmin/misc/cloud/static/js/cloud_db_details_schema.ui.js b/web/pgadmin/misc/cloud/static/js/cloud_db_details_schema.ui.js
index 1a6b50973..593deb601 100644
--- a/web/pgadmin/misc/cloud/static/js/cloud_db_details_schema.ui.js
+++ b/web/pgadmin/misc/cloud/static/js/cloud_db_details_schema.ui.js
@@ -88,10 +88,10 @@ class CloudDBCredSchema extends BaseUISchema {
         noEmpty: true,
         helpMessage: gettext('The cloud instance will be deployed in the selected region.')
       },{
-        id: 'aws_access_key', label: gettext('AWS access key'), type: 'text',
+        id: 'aws_access_key', label: gettext('AWS access key'), type: 'password',
         mode: ['create'], noEmpty: true,
       }, {
-        id: 'aws_secret_access_key', label: gettext('AWS secret access key'), type: 'text',
+        id: 'aws_secret_access_key', label: gettext('AWS secret access key'), type: 'password',
         mode: ['create'], noEmpty: true,
       }, {
         id: 'aws_session_token', label: gettext('AWS session token'), type: 'multiline',
@@ -205,8 +205,7 @@ export class InstanceSchema extends BaseUISchema {
       ],  noEmpty: true, orientation: 'vertical',
     },{
       id: 'aws_instance_type', label: gettext('Instance type'),
-      options: this.instanceOpts,  noEmpty: true,
-      controlProps: { allowClear: false },
+      options: this.instanceOpts,
       deps: ['aws_db_version', 'aws_db_instance_class'],
       depChange: (state, source)=> {
         if (source[0] == 'aws_db_instance_class') {
diff --git a/web/pgadmin/misc/cloud/utils/__init__.py b/web/pgadmin/misc/cloud/utils/__init__.py
index 00ac8fce8..ba4b73331 100644
--- a/web/pgadmin/misc/cloud/utils/__init__.py
+++ b/web/pgadmin/misc/cloud/utils/__init__.py
@@ -14,13 +14,11 @@ def get_my_ip():
     """ Return the public IP of this host """
     http = urllib3.PoolManager()
     try:
-        external_ip = http.request.urlopen(
-            'https://ident.me').read().decode('utf8')
+        external_ip = http.request('GET', 'https://ident.me').data
     except Exception:
         try:
-            external_ip = http.request.urlopen(
-                'https://ifconfig.me/ip').read().decode('utf8')
+            external_ip = http.request('GET', 'https://ifconfig.me/ip').data
         except Exception:
             external_ip = '127.0.0.1'
 
-    return external_ip
+    return '{}/{}'.format(external_ip, 32)
diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx
index e9edfd03d..cdcfab643 100644
--- a/web/pgadmin/static/js/components/FormComponents.jsx
+++ b/web/pgadmin/static/js/components/FormComponents.jsx
@@ -762,6 +762,7 @@ export const InputSelect = forwardRef(({
     if(typeof options === 'function') {
       optPromise = options();
     }
+    setFinalOptions([[], true]);
     Promise.resolve(optPromise)
       .then((res)=>{
         /* If component unmounted, dont update state */


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin4][Patch] - Cloud Wizard fixes
@ 2022-03-02 13:33  Akshay Joshi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2022-03-02 13:33 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks, the patch applied.

On Wed, Mar 2, 2022 at 5:34 PM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch to fix the below issues/suggestions:
>
> - Mask the credentials input fields
> - Loading symbol doesn't work while reloading the options in the select
> control
> - Decrease the wizard opening timeout
> - Host IP fetch issue due to urllib library upgrade
>
> Thanks,
> Khushboo
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-03-02 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 12:04 [pgAdmin4][Patch] - Cloud Wizard fixes Khushboo Vashi <[email protected]>
2022-03-02 13:33 ` Akshay Joshi <[email protected]>

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