mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following issues related to cloud deployment:
1) No options are shown in the instance type. 2) No options for the last 2 types. 3) Unable to change Storage config - size and iops 4) Unable to create an instance when pgAdmin is installed using the installer in Desktop mode 5) Can not create cloud instance with the temporary credentials. 6) Mapped region display name (hardcoded) with region code.
This commit is contained in:
committed by
Akshay Joshi
parent
cbd29cf45b
commit
448ede53c6
@@ -87,7 +87,7 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
|
||||
var _url = url_for('cloud.get_aws_db_instances') ;
|
||||
|
||||
if (engine) _url += '?eng_version=' + engine;
|
||||
if (reload) {
|
||||
if (reload || options === undefined || options.length == 0) {
|
||||
api.get(_url)
|
||||
.then(res=>{
|
||||
let data = res.data.data;
|
||||
|
||||
@@ -200,9 +200,9 @@ export class InstanceSchema extends BaseUISchema {
|
||||
deps: ['aws_db_version', 'aws_db_instance_class'],
|
||||
depChange: (state, source)=> {
|
||||
if (source[0] == 'aws_db_instance_class') {
|
||||
state.reload_instances = false;
|
||||
return {reload_instances: false};
|
||||
} else {
|
||||
state.reload_instances = true;
|
||||
return {reload_instances: true};
|
||||
}
|
||||
},
|
||||
type: (state) => {
|
||||
@@ -215,6 +215,7 @@ export class InstanceSchema extends BaseUISchema {
|
||||
controlProps: {
|
||||
allowClear: false,
|
||||
filter: (options) => {
|
||||
if (options.length == 0) return;
|
||||
let pattern = 'db.m';
|
||||
let pattern_1 = 'db.m';
|
||||
|
||||
@@ -260,26 +261,31 @@ export class StorageSchema extends BaseUISchema {
|
||||
},{
|
||||
id: 'aws_storage_size', label: gettext('Allocated storage'), type: 'text',
|
||||
mode: ['create'], noEmpty: true, deps: ['aws_storage_type'],
|
||||
depChange: (state)=> {
|
||||
if(state.aws_storage_type === 'io1') {
|
||||
state.aws_storage_size = 100;
|
||||
} else if(state.aws_storage_type === 'gp2') {
|
||||
state.aws_storage_size = 20;
|
||||
} else {
|
||||
state.aws_storage_size = 5;
|
||||
}
|
||||
depChange: (state, source)=> {
|
||||
if (source[0] !== 'aws_storage_size')
|
||||
if(state.aws_storage_type === 'io1') {
|
||||
return {aws_storage_size: 100};
|
||||
} else if(state.aws_storage_type === 'gp2') {
|
||||
return {aws_storage_size: 20};
|
||||
} else {
|
||||
return {aws_storage_size: 5};
|
||||
}
|
||||
},
|
||||
helpMessage: gettext('Size in GiB.')
|
||||
}, {
|
||||
id: 'aws_storage_IOPS', label: gettext('Provisioned IOPS'), type: 'text',
|
||||
mode: ['create'],
|
||||
visible: (state) => {
|
||||
if(state.aws_storage_type === 'io1') {
|
||||
state.aws_storage_IOPS = 3000;
|
||||
return true;
|
||||
}
|
||||
if(state.aws_storage_type === 'io1') return true;
|
||||
return false;
|
||||
} , deps: ['aws_storage_type']
|
||||
} , deps: ['aws_storage_type'],
|
||||
depChange: (state, source) => {
|
||||
if (source[0] !== 'aws_storage_IOPS') {
|
||||
if(state.aws_storage_type === 'io1') {
|
||||
return {aws_storage_IOPS: 3000};
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
36
web/pgadmin/misc/cloud/utils/aws_regions.py
Normal file
36
web/pgadmin/misc/cloud/utils/aws_regions.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# ##########################################################################
|
||||
# #
|
||||
# # pgAdmin 4 - PostgreSQL Tools
|
||||
# #
|
||||
# # Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
||||
# # This software is released under the PostgreSQL Licence
|
||||
# #
|
||||
# ##########################################################################
|
||||
#
|
||||
# # AWS Regions
|
||||
|
||||
|
||||
AWS_REGIONS = {
|
||||
'us-gov-east-1': 'AWS GovCloud (US-East)',
|
||||
'us-gov-west-1': 'AWS GovCloud (US-West)',
|
||||
'ap-east-1': 'Asia Pacific (Hong Kong)',
|
||||
'ap-south-': 'Asia Pacific (Mumbai)',
|
||||
'ap-northeast-3': 'Asia Pacific (Osaka-Local)',
|
||||
'ap-northeast-2': 'Asia Pacific (Seoul)',
|
||||
'ap-southeast-1': 'Asia Pacific (Singapore)',
|
||||
'ap-southeast-2': 'Asia Pacific (Sydney)',
|
||||
'ap-northeast-1': 'Asia Pacific (Tokyo)',
|
||||
'ca-central-1': 'Canada (Central)',
|
||||
'cn-north-1': 'China (Beijing)',
|
||||
'cn-northwest-1': 'China (Ningxia)',
|
||||
'eu-central-1': 'EU (Frankfurt)',
|
||||
'eu-west-1': 'EU (Ireland)',
|
||||
'eu-west-2': 'EU (London)',
|
||||
'eu-west-3': 'EU (Paris)',
|
||||
'eu-north-1': 'EU (Stockholm)',
|
||||
'sa-east-1': 'South America (Sao Paulo)',
|
||||
'us-east-1': 'US East (N. Virginia)',
|
||||
'us-east-2': 'US East (Ohio)',
|
||||
'us-west-1': 'US West (N. California)',
|
||||
'us-west-2': 'US West (Oregon)',
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import boto3
|
||||
import pickle
|
||||
from flask import session
|
||||
from boto3.session import Session
|
||||
from .aws_regions import AWS_REGIONS
|
||||
|
||||
|
||||
class RDS():
|
||||
@@ -163,9 +164,11 @@ def get_aws_regions():
|
||||
_session = Session()
|
||||
res = _session.get_available_regions('rds')
|
||||
regions = []
|
||||
|
||||
for value in res:
|
||||
regions.append({
|
||||
'label': value,
|
||||
'value': value
|
||||
})
|
||||
if value in AWS_REGIONS:
|
||||
regions.append({
|
||||
'label': AWS_REGIONS[value] + ' | ' + value,
|
||||
'value': value
|
||||
})
|
||||
return True, regions
|
||||
|
||||
Reference in New Issue
Block a user