Subject: pgAdmin 4 commit: Refactor server dialogue validation for better unit t

From: Dave Page <[email-masked]>
Date: Tue, 13 Mar 2018 18:47:37 +0000

Refactor server dialogue validation for better unit testing.

Victoria & Joao @ Pivotal.

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=6b03cb78af607b04c75de44d635bf201babb4c5a
Author: Victoria Henry <[email-masked]>

Modified Files
--------------
web/package.json                                   |   3 +-
.../server_groups/servers/static/js/server.js      | 113 ++-------------------
web/pgadmin/static/bundle/browser.js               |   2 +-
web/pgadmin/static/js/browser/index.js             |  10 ++
.../static/js/browser/server_groups/index.js       |  10 ++
.../server_groups/servers/databases/index.js       |  10 ++
.../js/browser/server_groups/servers/index.js      |  11 ++
.../server_groups/servers/model_validation.js      | 104 +++++++++++++++++++
.../server_groups/servers/model_validation_spec.js | 101 ++++++++++++++++++
web/yarn.lock                                      |  46 ++++++++-
10 files changed, 299 insertions(+), 111 deletions(-)

---

From: Khushboo Vashi <[email-masked]>
Date: Wed, 14 Mar 2018 20:07:10 +0530

Hi Joao/Victoria,

I am getting an error while editing the server properties. Please refer the
attached screen-shot for the same.

Thanks,
Khushboo

---

From: Joao De Almeida Pereira <[email-masked]>
Date: Wed, 14 Mar 2018 16:10:53 +0000

Hi Khushboo,
Good catch, attached you can find the fix for the problem.

Thanks
Victoria & Joao

On Wed, Mar 14, 2018 at 10:37 AM Khushboo Vashi <
[email-masked]> wrote:

> Hi Joao/Victoria,
>
> I am getting an error while editing the server properties. Please refer
> the attached screen-shot for the same.
>
> Thanks,
> Khushboo
>
diff --git a/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js b/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js
index 7ab129ba..948af3d4 100644
--- a/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js
+++ b/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js
@@ -99,6 +99,6 @@ export class ModelValidation {
   }
 
   static isEmptyString(string) {
-    return _.isUndefined(string) || _.isNull(string) || string.trim() === '';
+    return _.isUndefined(string) || _.isNull(string) || String(string).trim() === '';
   }
 }
diff --git a/web/regression/javascript/browser/server_groups/servers/model_validation_spec.js b/web/regression/javascript/browser/server_groups/servers/model_validation_spec.js
index a05cd455..560d8b60 100644
--- a/web/regression/javascript/browser/server_groups/servers/model_validation_spec.js
+++ b/web/regression/javascript/browser/server_groups/servers/model_validation_spec.js
@@ -31,7 +31,7 @@ describe('Server#ModelValidation', () => {
         model.isNew.and.returnValue(true);
         model.allValues['name'] = 'some name';
         model.allValues['username'] = 'some username';
-        model.allValues['port'] = 'some port';
+        model.allValues['port'] = 12345;
       });
 
       describe('No service id', () => {

---

From: Dave Page <[email-masked]>
Date: Wed, 14 Mar 2018 17:58:13 -0400

Thanks, applied.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company