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/12/06 15:11:46 UTC
[airavata-django-portal] branch develop updated: AIRAVATA-3678 Only validate/save ext. user profile if it is defined in gateway
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/develop by this push:
new 2b1c9292 AIRAVATA-3678 Only validate/save ext. user profile if it is defined in gateway
new 5170fe36 Merge branch 'AIRAVATA-3678' into develop
2b1c9292 is described below
commit 2b1c929221d568493227e5e01f4989dd0f8b62f5
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Dec 6 10:10:47 2022 -0500
AIRAVATA-3678 Only validate/save ext. user profile if it is defined in gateway
---
.../js/containers/UserProfileContainer.vue | 22 ++++++++++++++--------
.../js/store/modules/extendedUserProfile.js | 3 +++
2 files changed, 17 insertions(+), 8 deletions(-)
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 3467781e..69c909af 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
@@ -23,9 +23,7 @@
@resend-email-verification="handleResendEmailVerification"
/>
<!-- include extended-user-profile-editor if there are extendedUserProfileFields -->
- <template
- v-if="extendedUserProfileFields && extendedUserProfileFields.length > 0"
- >
+ <template v-if="hasExtendedUserProfileFields">
<hr />
<extended-user-profile-editor ref="extendedUserProfileEditor" />
</template>
@@ -53,7 +51,9 @@ export default {
async created() {
await this.loadCurrentUser();
await this.loadExtendedUserProfileFields();
- await this.loadExtendedUserProfileValues();
+ if (this.hasExtendedUserProfileFields) {
+ await this.loadExtendedUserProfileValues();
+ }
const queryParams = new URLSearchParams(window.location.search);
if (queryParams.has("code")) {
@@ -76,7 +76,10 @@ export default {
},
computed: {
...mapGetters("userProfile", ["user"]),
- ...mapGetters("extendedUserProfile", ["extendedUserProfileFields"]),
+ ...mapGetters("extendedUserProfile", [
+ "extendedUserProfileFields",
+ "hasExtendedUserProfileFields",
+ ]),
mustComplete() {
return (
this.user && (!this.user.complete || !this.user.ext_user_profile_valid)
@@ -98,10 +101,13 @@ export default {
async onSave() {
if (
this.$refs.userProfileEditor.valid &&
- this.$refs.extendedUserProfileEditor.valid
+ (!this.hasExtendedUserProfileFields ||
+ this.$refs.extendedUserProfileEditor.valid)
) {
await this.updateUser();
- await this.saveExtendedUserProfileValues();
+ if (this.hasExtendedUserProfileFields) {
+ await this.saveExtendedUserProfileValues();
+ }
// Reload current user to get updated 'complete' and 'ext_user_profile_valid'
await this.loadCurrentUser();
notifications.NotificationList.add(
@@ -111,7 +117,7 @@ export default {
duration: 5,
})
);
- } else {
+ } else if (this.hasExtendedUserProfileFields) {
this.$refs.extendedUserProfileEditor.touch();
}
},
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/store/modules/extendedUserProfile.js b/django_airavata/apps/auth/static/django_airavata_auth/js/store/modules/extendedUserProfile.js
index 084731b4..aef9dace 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/store/modules/extendedUserProfile.js
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/store/modules/extendedUserProfile.js
@@ -8,6 +8,9 @@ const state = () => ({
const getters = {
extendedUserProfileFields: (state) => state.extendedUserProfileFields,
extendedUserProfileValues: (state) => state.extendedUserProfileValues,
+ hasExtendedUserProfileFields: (state) =>
+ state.extendedUserProfileFields &&
+ state.extendedUserProfileFields.length > 0,
getTextValue: (state) => (id) => {
const value = state.extendedUserProfileValues.find(
(v) => v.ext_user_profile_field === id