The following issues related to cloud deployment have been resolved:

- Masking the credentials input fields
- The loading symbol doesn't work while reloading the options in the select control
- Reduce the wizard opening timeout
- urllib library upgrade impacts host IP fetch

refs #7177
This commit is contained in:
Khushboo Vashi 2022-03-02 19:02:35 +05:30 committed by Akshay Joshi
parent 83660ec9ed
commit 69069e9af3
6 changed files with 14 additions and 16 deletions

View File

@ -16,16 +16,14 @@ def get_my_ip():
""" Return the public IP of this host """ """ Return the public IP of this host """
http = urllib3.PoolManager() http = urllib3.PoolManager()
try: try:
external_ip = http.request.urlopen( external_ip = http.request('GET', 'https://ident.me').data
'https://ident.me').read().decode('utf8')
except Exception: except Exception:
try: try:
external_ip = http.request.urlopen( external_ip = http.request('GET', 'https://ifconfig.me/ip').data
'https://ifconfig.me/ip').read().decode('utf8')
except Exception: except Exception:
external_ip = '127.0.0.1' external_ip = '127.0.0.1'
return external_ip return '{}/{}'.format(external_ip, 32)
def get_random_id(): def get_random_id():

View File

@ -114,7 +114,9 @@ def script():
methods=['GET'], endpoint='get_host_ip') methods=['GET'], endpoint='get_host_ip')
@login_required @login_required
def get_host_ip(): 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/', @blueprint.route('/verify_credentials/',

View File

@ -128,7 +128,7 @@ define('pgadmin.misc.cloud', [
return setTimeout((function () { return setTimeout((function () {
ReactDOM.unmountComponentAtNode(document.getElementById('cloudWizardDlg')); ReactDOM.unmountComponentAtNode(document.getElementById('cloudWizardDlg'));
return Alertify.cloudWizardDialog().destroy(); return Alertify.cloudWizardDialog().destroy();
}), 500); }), 10);
}, },
} }
}; };

View File

@ -88,10 +88,10 @@ class CloudDBCredSchema extends BaseUISchema {
noEmpty: true, noEmpty: true,
helpMessage: gettext('The cloud instance will be deployed in the selected region.') 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, 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, mode: ['create'], noEmpty: true,
}, { }, {
id: 'aws_session_token', label: gettext('AWS session token'), type: 'multiline', id: 'aws_session_token', label: gettext('AWS session token'), type: 'multiline',
@ -205,8 +205,7 @@ export class InstanceSchema extends BaseUISchema {
], noEmpty: true, orientation: 'vertical', ], noEmpty: true, orientation: 'vertical',
},{ },{
id: 'aws_instance_type', label: gettext('Instance type'), id: 'aws_instance_type', label: gettext('Instance type'),
options: this.instanceOpts, noEmpty: true, options: this.instanceOpts,
controlProps: { allowClear: false },
deps: ['aws_db_version', 'aws_db_instance_class'], deps: ['aws_db_version', 'aws_db_instance_class'],
depChange: (state, source)=> { depChange: (state, source)=> {
if (source[0] == 'aws_db_instance_class') { if (source[0] == 'aws_db_instance_class') {

View File

@ -14,13 +14,11 @@ def get_my_ip():
""" Return the public IP of this host """ """ Return the public IP of this host """
http = urllib3.PoolManager() http = urllib3.PoolManager()
try: try:
external_ip = http.request.urlopen( external_ip = http.request('GET', 'https://ident.me').data
'https://ident.me').read().decode('utf8')
except Exception: except Exception:
try: try:
external_ip = http.request.urlopen( external_ip = http.request('GET', 'https://ifconfig.me/ip').data
'https://ifconfig.me/ip').read().decode('utf8')
except Exception: except Exception:
external_ip = '127.0.0.1' external_ip = '127.0.0.1'
return external_ip return '{}/{}'.format(external_ip, 32)

View File

@ -762,6 +762,7 @@ export const InputSelect = forwardRef(({
if(typeof options === 'function') { if(typeof options === 'function') {
optPromise = options(); optPromise = options();
} }
setFinalOptions([[], true]);
Promise.resolve(optPromise) Promise.resolve(optPromise)
.then((res)=>{ .then((res)=>{
/* If component unmounted, dont update state */ /* If component unmounted, dont update state */