airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 03/07: AIRAVATA-2835 Bug fix: don't try to convert null/undefined field value
Date Fri, 13 Jul 2018 00:18:08 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit 011b325c92ebbe2dca57d276f2dfebb159071cae
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Thu Jul 12 11:24:57 2018 -0400

    AIRAVATA-2835 Bug fix: don't try to convert null/undefined field value
---
 .../apps/api/static/django_airavata_api/js/models/BaseModel.js        | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js b/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js
index 5bb0c63..56cf29f 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js
@@ -33,7 +33,9 @@ export default class BaseModel {
     }
 
     convertField(fieldType, fieldValue, fieldDefault) {
-        if (fieldType === 'string' || fieldType === 'boolean' || fieldType === 'number')
{
+        if (fieldValue === null || typeof fieldValue === 'undefined') {
+            return fieldDefault;
+        } else if (fieldType === 'string' || fieldType === 'boolean' || fieldType === 'number')
{
             return this.convertSimpleField(fieldValue, fieldDefault);
         } else if (fieldType === 'date') {
             return this.convertDateField(fieldValue, fieldDefault);


Mime
View raw message