diff --git a/web/pgadmin/misc/cloud/static/js/azure_schema.ui.js b/web/pgadmin/misc/cloud/static/js/azure_schema.ui.js index 22bfee7d8..0ab334ee6 100644 --- a/web/pgadmin/misc/cloud/static/js/azure_schema.ui.js +++ b/web/pgadmin/misc/cloud/static/js/azure_schema.ui.js @@ -155,6 +155,7 @@ class AzureProjectDetailsSchema extends BaseUISchema { id: 'subscription', label: gettext('Subscription'), mode: ['create'], + noEmpty: true, type: () => { return { type: 'select', @@ -182,6 +183,7 @@ class AzureProjectDetailsSchema extends BaseUISchema { label: gettext('Resource group'), mode: ['create'], deps: ['subscription'], + noEmpty: true, type: (state) => { return { type: 'select', @@ -201,6 +203,7 @@ class AzureProjectDetailsSchema extends BaseUISchema { label: gettext('Location'), mode: ['create'], deps: ['subscription'], + noEmpty: true, type: (state) => { return { type: 'select', @@ -217,6 +220,7 @@ class AzureProjectDetailsSchema extends BaseUISchema { label: gettext('Availability zone'), deps: ['region'], allowClear: false, + noEmpty: true, type: (state) => { return { type: 'select', @@ -256,6 +260,7 @@ class AzureInstanceSchema extends BaseUISchema { id: 'db_version', label: gettext('Database version'), deps: ['availability_zone'], + noEmpty: true, type: (state) => { return { type: 'select', @@ -270,6 +275,7 @@ class AzureInstanceSchema extends BaseUISchema { id: 'db_instance_class', label: gettext('Instance class'), type: 'select', + noEmpty: true, options: [ { label: gettext('Burstable (1-2 vCores) '), @@ -288,6 +294,7 @@ class AzureInstanceSchema extends BaseUISchema { id: 'instance_type', label: gettext('Instance type'), deps: ['db_version', 'db_instance_class'], + noEmpty: true, depChange: (state, source)=>{ if(source[0] == 'db_instance_class'){ state.instance_type = undefined; @@ -322,6 +329,7 @@ class AzureInstanceSchema extends BaseUISchema { id: 'storage_size', label: gettext('Storage Size'), deps: ['db_version', 'db_instance_class'], + noEmpty: true, type: (state) => { return { type: 'select', @@ -616,66 +624,11 @@ class AzureClusterSchema extends BaseUISchema { ]; } - validateProjectDetails(data, setErr){ - if(isEmptyString(data.subscription)){ - setErr('subscription',gettext('Subscription cannot be empty.')); - return true; - } - - if(isEmptyString(data.resource_group)){ - setErr('resource_group',gettext('Resource group cannot be empty.')); - return true; - } - - if(isEmptyString(data.region)){ - setErr('region',gettext('Location cannot be empty.')); - return true; - } - } - - validateInstanceDetails(data, setErr){ - if(isEmptyString(data.availability_zone)){ - setErr('availability_zone',gettext('Availability zone cannot be empty.')); - return true; - } - - if(isEmptyString(data.db_version)){ - setErr('db_version',gettext('Database version cannot be empty.')); - return true; - } - - if(isEmptyString(data.db_instance_class)){ - setErr('db_instance_class',gettext('Instance class cannot be empty.')); - return true; - } - } - - validateNetworkDetails(data, setErr){ - if(isEmptyString(data.instance_type)){ - setErr('instance_type',gettext('Instance type cannot be empty.')); - return true; - } - - if(isEmptyString(data.storage_size)){ - setErr('storage_size',gettext('Storage size cannot be empty.')); - return true; - } - - if(isEmptyString(data.public_ips)){ - setErr('public_ips',gettext('Public IP range cannot be empty.')); - return true; - } - } - validate(data, setErr) { if ( !isEmptyString(data.name) && (!/^[a-z0-9\-]*$/.test(data.name) || data.name.length < 3)) { setErr('name',gettext('Name must be more than 2 characters or more & must only contain lowercase letters, numbers, and hyphens')); return true; } - - if(this.validateProjectDetails(data, setErr) || this.validateInstanceDetails(data, setErr) || this.validateNetworkDetails(data, setErr)){ - return true; - } return false; } } diff --git a/web/pgadmin/static/js/SchemaView/index.jsx b/web/pgadmin/static/js/SchemaView/index.jsx index 9a8919f2f..7c124561f 100644 --- a/web/pgadmin/static/js/SchemaView/index.jsx +++ b/web/pgadmin/static/js/SchemaView/index.jsx @@ -289,9 +289,11 @@ function validateSchema(schema, sessData, setError, accessPath=[], collLabel=nul setError(accessPath.concat(field.id), message); return true; } + if(schema.validate(sessData, (id, message)=>setError(accessPath.concat(id), message))){ + return true; + } } } - return schema.validate(sessData, (id, message)=>setError(accessPath.concat(id), message)); } export const SCHEMA_STATE_ACTIONS = {