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 2022/05/17 16:18:29 UTC

[airavata-django-portal] branch AIRAVATA-3562 updated (71774e3a -> 1759716e)

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

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


    from 71774e3a AIRAVATA-3565 Better handling of extended user profile validation
     new fef0a18f AIRAVATA-3565 Fixes to how other options are validated
     new 1759716e AIRAVATA-3565 Fix updating field choice

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:
 django_airavata/apps/auth/serializers.py           |  4 +--
 .../components/ExtendedUserProfileFieldEditor.vue  |  1 +
 .../ExtendedUserProfileMultiChoiceFieldEditor.vue  | 31 ++++++++++++----------
 .../ExtendedUserProfileSingleChoiceFieldEditor.vue | 31 ++++++++++++----------
 4 files changed, 37 insertions(+), 30 deletions(-)


[airavata-django-portal] 02/02: AIRAVATA-3565 Fix updating field choice

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1759716e74d29a8e5e4d2bf657ea20a715ba3bb9
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue May 17 12:18:18 2022 -0400

    AIRAVATA-3565 Fix updating field choice
---
 django_airavata/apps/auth/serializers.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/auth/serializers.py b/django_airavata/apps/auth/serializers.py
index 1b752362..148e93d1 100644
--- a/django_airavata/apps/auth/serializers.py
+++ b/django_airavata/apps/auth/serializers.py
@@ -188,7 +188,7 @@ class ExtendedUserProfileFieldSerializer(serializers.ModelSerializer):
                     choice_id = choice.pop('id', None)
                     models.ExtendedUserProfileSingleChoiceFieldChoice.objects.update_or_create(
                         id=choice_id,
-                        defaults=choice,
+                        defaults={**choice, "single_choice_field": instance.single_choice},
                     )
             instance.single_choice.save()
         elif instance.field_type == 'multi_choice':
@@ -202,7 +202,7 @@ class ExtendedUserProfileFieldSerializer(serializers.ModelSerializer):
                     choice_id = choice.pop('id', None)
                     models.ExtendedUserProfileMultiChoiceFieldChoice.objects.update_or_create(
                         id=choice_id,
-                        defaults=choice,
+                        defaults={**choice, "multi_choice_field": instance.multi_choice},
                     )
             instance.multi_choice.save()
         elif instance.field_type == 'user_agreement':


[airavata-django-portal] 01/02: AIRAVATA-3565 Fixes to how other options are validated

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fef0a18fa3355ce96144dec11bddfaffda9a18f1
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue May 17 12:16:48 2022 -0400

    AIRAVATA-3565 Fixes to how other options are validated
---
 .../components/ExtendedUserProfileFieldEditor.vue  |  1 +
 .../ExtendedUserProfileMultiChoiceFieldEditor.vue  | 31 ++++++++++++----------
 .../ExtendedUserProfileSingleChoiceFieldEditor.vue | 31 ++++++++++++----------
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue
index 13b7a664..d9e3ca46 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue
@@ -15,6 +15,7 @@
       v-for="link in extendedUserProfileField.links"
       :key="link.id"
       :header="link.label"
+      class="ml-3 mb-3"
     >
       <b-card-text v-if="link.display_inline">
         <iframe :src="link.url" />
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue
index 17faef61..9e99fb7f 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue
@@ -7,7 +7,9 @@
       @change="onChange"
       :state="validateStateErrorOnly($v.value)"
     >
-      <b-form-checkbox :value="otherOptionValue"
+      <b-form-checkbox
+        :value="otherOptionValue"
+        v-if="extendedUserProfileField.other"
         >Other (please specify)</b-form-checkbox
       >
 
@@ -15,24 +17,25 @@
         >This field is required.</b-form-invalid-feedback
       >
     </b-form-checkbox-group>
-    <b-form-input
-      class="mt-2"
-      v-if="showOther"
-      v-model="other"
-      placeholder="Please specify"
-      :state="validateState($v.other)"
-      @input="onInput"
-    />
-    <b-form-invalid-feedback :state="validateState($v.other)"
-      >Please specify a value for 'Other'.</b-form-invalid-feedback
-    >
+    <template v-if="showOther">
+      <b-form-input
+        class="mt-2"
+        v-model="other"
+        placeholder="Please specify"
+        :state="validateState($v.other)"
+        @input="onInput"
+      />
+      <b-form-invalid-feedback :state="validateState($v.other)"
+        >Please specify a value for 'Other'.</b-form-invalid-feedback
+      >
+    </template>
   </extended-user-profile-field-editor>
 </template>
 
 <script>
 import { mapGetters, mapMutations } from "vuex";
 import { validationMixin } from "vuelidate";
-import { requiredIf } from "vuelidate/lib/validators";
+import { required, requiredIf } from "vuelidate/lib/validators";
 import { errors } from "django-airavata-common-ui";
 import ExtendedUserProfileFieldEditor from "./ExtendedUserProfileFieldEditor.vue";
 const OTHER_OPTION = new Object(); // sentinel value
@@ -113,7 +116,7 @@ export default {
       other: {},
     };
     if (this.showOther) {
-      validations.other = { required: requiredIf("required") };
+      validations.other = { required };
     }
     return validations;
   },
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue
index 61c672f5..7bc1f26d 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue
@@ -12,31 +12,34 @@
         >
       </template>
 
-      <b-form-select-option :value="otherOptionValue"
+      <b-form-select-option
+        :value="otherOptionValue"
+        v-if="extendedUserProfileField.other"
         >Other (please specify)</b-form-select-option
       >
     </b-form-select>
     <b-form-invalid-feedback :state="validateState($v.value)"
       >This field is required.</b-form-invalid-feedback
     >
-    <b-form-input
-      class="mt-2"
-      v-if="showOther"
-      v-model="other"
-      placeholder="Please specify"
-      :state="validateState($v.other)"
-      @input="onInput"
-    />
-    <b-form-invalid-feedback :state="validateState($v.other)"
-      >Please specify a value for 'Other'.</b-form-invalid-feedback
-    >
+    <template v-if="showOther">
+      <b-form-input
+        class="mt-2"
+        v-model="other"
+        placeholder="Please specify"
+        :state="validateState($v.other)"
+        @input="onInput"
+      />
+      <b-form-invalid-feedback :state="validateState($v.other)"
+        >Please specify a value for 'Other'.</b-form-invalid-feedback
+      >
+    </template>
   </extended-user-profile-field-editor>
 </template>
 
 <script>
 import { mapGetters, mapMutations } from "vuex";
 import { validationMixin } from "vuelidate";
-import { requiredIf } from "vuelidate/lib/validators";
+import { required, requiredIf } from "vuelidate/lib/validators";
 import { errors } from "django-airavata-common-ui";
 import ExtendedUserProfileFieldEditor from "./ExtendedUserProfileFieldEditor.vue";
 const OTHER_OPTION = new Object(); // sentinel value
@@ -116,7 +119,7 @@ export default {
       other: {},
     };
     if (this.showOther) {
-      validations.other = { required: requiredIf("required") };
+      validations.other = { required };
     } else {
       validations.value = { required: requiredIf("required") };
     }