This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch airavata-3453 in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 25293ca04a7012eb2bdc0e9e5a9ff4d115296c90 Author: Marcus Christie <[email protected]> AuthorDate: Thu May 13 16:31:35 2021 -0400 AIRAVATA-3453 Handle user no longer has access to GRP --- .../js/web-components/ResourceSelectionEditor.vue | 23 ++++++++++++++-------- .../js/web-components/store.js | 19 +++++++++++++++--- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue index 5aea35a..1cf0426 100644 --- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue +++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue @@ -345,14 +345,20 @@ export default { }, async loadData() { if (this.groupResourceProfileId) { - // TODO: handle user no longer has access to GRP - await this.loadGroupResourceProfile(); - await this.loadApplicationDeployments(); - await this.loadAppDeploymentQueues(); - await this.applyGroupResourceProfile(); - // If existing values are no longer selectable, the userConfigurationData - // may have changed - this.emitValueChanged(); + let groupResourceProfile = await this.loadGroupResourceProfile(); + // handle user no longer has access to GRP + if (!groupResourceProfile) { + await this.initializeGroupResourceProfileId(); + groupResourceProfile = await this.loadGroupResourceProfile(); + } + if (groupResourceProfile) { + await this.loadApplicationDeployments(); + await this.loadAppDeploymentQueues(); + await this.applyGroupResourceProfile(); + // If existing values are no longer selectable, the userConfigurationData + // may have changed + this.emitValueChanged(); + } } else { await this.initializeGroupResourceProfileId(); if (this.groupResourceProfileId) { @@ -367,6 +373,7 @@ export default { this.groupResourceProfile = await getGroupResourceProfile( this.groupResourceProfileId ); + return this.groupResourceProfile; }, async getDefaultResourceHostId() { const defaultComputeResourceId = await getDefaultComputeResourceId(); diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js index dbf9818..5007bdf 100644 --- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js +++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js @@ -70,9 +70,22 @@ export async function getGroupResourceProfiles() { } export async function getGroupResourceProfile(groupResourceProfileId) { - return await services.GroupResourceProfileService.retrieve({ - lookup: groupResourceProfileId, - }); + return await services.GroupResourceProfileService.retrieve( + { + lookup: groupResourceProfileId, + }, + { ignoreErrors: true } + ) + .catch((error) => { + // Ignore unauthorized errors, force user to pick a different GroupResourceProfile + if (!errors.ErrorUtils.isUnauthorizedError(error)) { + return Promise.reject(error); + } else { + return Promise.resolve(null); + } + }) + // Report all other error types + .catch(utils.FetchUtils.reportError); } export async function getApplicationDeployments(
