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 2021/06/08 21:07:15 UTC

[airavata-django-portal] 03/04: AIRAVATA-3455 Handle enter key press

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

machristie pushed a commit to branch AIRAVATA-3319-handle-missing-name-and-email-attributes-from-cilo
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit 0123bc485fa2ef9762c014e5debf0036925847d0
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jun 8 16:21:43 2021 -0400

    AIRAVATA-3455 Handle enter key press
---
 .../js/components/UserProfileEditor.vue                  | 16 +++++++++-------
 .../js/containers/UserProfileContainer.vue               |  9 ++++++++-
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/UserProfileEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/UserProfileEditor.vue
index 9ccd0fe..55eca90 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/UserProfileEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/UserProfileEditor.vue
@@ -4,13 +4,13 @@
       <b-form-input disabled :value="user.username" />
     </b-form-group>
     <b-form-group label="First Name">
-      <b-form-input v-model="user.first_name" />
+      <b-form-input v-model="user.first_name" @keydown.native.enter="save" />
     </b-form-group>
     <b-form-group label="Last Name">
-      <b-form-input v-model="user.last_name" />
+      <b-form-input v-model="user.last_name" @keydown.native.enter="save" />
     </b-form-group>
     <b-form-group label="Email">
-      <b-form-input v-model="user.email" />
+      <b-form-input v-model="user.email" @keydown.native.enter="save" />
       <b-alert class="mt-1" show v-if="user.pending_email_change"
         >Once you verify your email address at
         <strong>{{ user.pending_email_change.email_address }}</strong
@@ -21,8 +21,7 @@
         ></b-alert
       >
     </b-form-group>
-    <b-button variant="primary" @click="$emit('save', user)">Save</b-button>
-    <b-button>Cancel</b-button>
+    <b-button variant="primary" @click="save">Save</b-button>
   </b-card>
 </template>
 
@@ -45,12 +44,15 @@ export default {
     cloneValue() {
       return JSON.parse(JSON.stringify(this.value));
     },
+    save() {
+      this.$emit("save", this.user);
+    },
   },
   watch: {
     value() {
       this.user = this.cloneValue();
-    }
-  }
+    },
+  },
 };
 </script>
 
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/containers/UserProfileContainer.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/containers/UserProfileContainer.vue
index 389b965..d6eebce 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/containers/UserProfileContainer.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/containers/UserProfileContainer.vue
@@ -41,6 +41,13 @@ export default {
         lookup: value.id,
         data: value,
       }).then((user) => {
+        notifications.NotificationList.add(
+          new notifications.Notification({
+            type: "SUCCESS",
+            message: "User profile saved",
+            duration: 5,
+          })
+        );
         this.user = user;
       });
     },
@@ -72,7 +79,7 @@ export default {
           })
         );
         // Update URL, removing the code from the query string
-        window.history.replaceState({}, '', '/auth/user-profile/');
+        window.history.replaceState({}, "", "/auth/user-profile/");
       });
     },
   },