You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/11/17 22:24:22 UTC

[airavata-django-portal] branch master updated (219ede5 -> 8a785c7)

This is an automated email from the ASF dual-hosted git repository.

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


    from 219ede5  AIRAVATA-2538 refactored admin to use FetchUtils
     new 6b5ade6  AIRAVATA-2538 client side validation (WIP)
     new 8a785c7  AIRAVATA-2538 Remove Promise.finally since non-standard

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../api/static/django_airavata_api/js/models/Project.js   | 10 ++++++++++
 .../api/static/django_airavata_api/js/utils/FetchUtils.js |  4 ++--
 .../js/views/ProjectListContainer.vue                     | 15 ++++++++++++---
 3 files changed, 24 insertions(+), 5 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@airavata.apache.org" <co...@airavata.apache.org>'].

[airavata-django-portal] 01/02: AIRAVATA-2538 client side validation (WIP)

Posted by ma...@apache.org.
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 6b5ade60684c2cc72873a28c786cfc279fd8462b
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Fri Nov 17 13:54:54 2017 -0500

    AIRAVATA-2538 client side validation (WIP)
---
 .../api/static/django_airavata_api/js/models/Project.js   | 10 ++++++++++
 .../js/views/ProjectListContainer.vue                     | 15 ++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js b/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js
index f5d1608..2180806 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js
@@ -13,6 +13,16 @@ export default class Project extends BaseModel {
         this.copyData(data);
     }
 
+    validateForCreate() {
+        console.log("validateForCreate", this.name);
+        if (this.name === null || this.name.trim() === "") {
+            return {
+                name: ["Please provide a name."]
+            }
+        }
+        return null;
+    }
+
     toJSONForCreate() {
         // Remaining fields just get defaulted
         return JSON.stringify(this, ["name", "description"]);
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListContainer.vue
index 1684f98..d1347b2 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListContainer.vue
@@ -10,16 +10,16 @@
                 <!-- TODO: factor modal out into separate, reusable component -->
                 <b-modal id="modal-new-project" ref="modalNewProject" title="Create New Project" v-on:ok="onCreateProject">
                     <b-form @submit="onCreateProject" novalidate>
-                        <b-form-group label="Project Name" label-for="new-project-name" v-bind:feedback="newProjectFields.name.feedback" v-bind:state="newProjectFields.name.state">
+                        <b-form-group label="Project Name" label-for="new-project-name" v-bind:feedback="newProjectNameFeedback" v-bind:state="newProjectNameState">
                             <b-form-input id="new-project-name"
                                 type="text" v-model="newProject.name" required
                                 placeholder="Project name"
-                                v-bind:state="newProjectFields.name.state"></b-form-input>
+                                v-bind:state="newProjectNameState"></b-form-input>
                         </b-form-group>
                         <b-form-group label="Project Description" label-for="new-project-description">
                             <b-form-textarea id="new-project-description"
                                 type="text" v-model="newProject.description"
-                                placeholder="Project description"
+                                placeholder="(Optional) Project description"
                                 :rows="3"></b-form-textarea>
                         </b-form-group>
                     </b-form>
@@ -99,6 +99,15 @@ export default {
         projects: function() {
             return this.projectsPaginator ? this.projectsPaginator.results : null;
         },
+        newProjectValidationData: function() {
+            return this.newProject.validateForCreate();
+        },
+        newProjectNameState: function() {
+            return (this.newProjectValidationData && 'name' in this.newProjectValidationData) ? 'invalid' : null;
+        },
+        newProjectNameFeedback: function() {
+            return (this.newProjectValidationData && 'name' in this.newProjectValidationData) ? this.newProjectValidationData.name.join('; ') : null;
+        },
     },
     beforeMount: function () {
         services.ProjectService.list(this.initialProjectsData)

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata-django-portal] 02/02: AIRAVATA-2538 Remove Promise.finally since non-standard

Posted by ma...@apache.org.
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 8a785c78d530f2eaafa4dca4eeea14204f609a5d
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Fri Nov 17 17:24:16 2017 -0500

    AIRAVATA-2538 Remove Promise.finally since non-standard
---
 .../apps/api/static/django_airavata_api/js/utils/FetchUtils.js        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js b/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
index a55d2ca..8e09498 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
@@ -34,7 +34,7 @@ export default {
                 return response.json().then(json => {
                     error.data = json;
                 })
-                .finally(() => Promise.reject(error));
+                .then(() => Promise.reject(error),() => Promise.reject(error));
             }
         })
     },
@@ -56,7 +56,7 @@ export default {
                 return response.json().then(json => {
                     error.data = json;
                 })
-                .finally(() => Promise.reject(error));
+                .then(() => Promise.reject(error),() => Promise.reject(error));
             }
         })
     },

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.