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 2018/04/16 17:01:20 UTC
[airavata-django-portal] branch master updated: AIRAVATA-2739 Reset
UI state when group resource profile changes
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
The following commit(s) were added to refs/heads/master by this push:
new f77ae67 AIRAVATA-2739 Reset UI state when group resource profile changes
f77ae67 is described below
commit f77ae67a2e97cc18e1f55cfb123f30c77953533e
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Mon Apr 16 13:01:06 2018 -0400
AIRAVATA-2739 Reset UI state when group resource profile changes
---
.../ComputationalResourceSchedulingEditor.vue | 38 +++++++++++++++++-----
.../experiment/GroupResourceProfileSelector.vue | 5 +--
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ComputationalResourceSchedulingEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ComputationalResourceSchedulingEditor.vue
index 39fa2e6..93918f9 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ComputationalResourceSchedulingEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ComputationalResourceSchedulingEditor.vue
@@ -63,8 +63,7 @@ export default {
localComputationalResourceScheduling: this.value.clone(),
computeResources: {},
applicationDeployments: [],
- selectedGroupResourceProfile: null,
- appDeploymentId: null,
+ selectedGroupResourceProfileData: null,
resourceHostId: null,
// TODO: replace this with Loading spinner, better mechanism
loadingCount: 0,
@@ -111,18 +110,32 @@ export default {
return this.selectedGroupResourceProfile.batchQueueResourcePolicies.filter(bqrp => {
return bqrp.computeResourceId === this.localComputationalResourceScheduling.resourceHostId;
});
+ },
+ selectedGroupResourceProfile: function() {
+ // Reload selectedGroupResourceProfile when group-resource-profile-id changes
+ if (this.selectedGroupResourceProfileData
+ && this.selectedGroupResourceProfileData.groupResourceProfileId !== this.groupResourceProfileId) {
+ this.selectedGroupResourceProfileData = null;
+ this.loadGroupResourceProfile();
+ }
+ return this.selectedGroupResourceProfileData;
+ },
+ appDeploymentId: function() {
+ if (!this.resourceHostId) {
+ return null;
+ }
+ // Find application deployment that corresponds to this compute resource
+ let selectedApplicationDeployment = this.applicationDeployments.find(dep => dep.computeHostId === this.resourceHostId);
+ if (!selectedApplicationDeployment) {
+ throw new Error("Failed to find application deployment!");
+ }
+ return selectedApplicationDeployment.appDeploymentId;
}
},
methods: {
computeResourceChanged: function(selectedComputeResourceId) {
this.localComputationalResourceScheduling.resourceHostId = selectedComputeResourceId;
this.emitValueChanged();
- // Find application deployment that corresponds to this compute resource
- let selectedApplicationDeployment = this.applicationDeployments.find(dep => dep.computeHostId === selectedComputeResourceId);
- if (!selectedApplicationDeployment) {
- throw new Error("Failed to find application deployment!");
- }
- this.appDeploymentId = selectedApplicationDeployment.appDeploymentId;
},
loadApplicationDeployments: function(appModuleId) {
this.loadingCount++;
@@ -142,7 +155,7 @@ export default {
this.loadingCount++;
services.GroupResourceProfileService.get(this.groupResourceProfileId)
.then(groupResourceProfile => {
- this.selectedGroupResourceProfile = groupResourceProfile;
+ this.selectedGroupResourceProfileData = groupResourceProfile;
})
.then(()=> {this.loadingCount--;}, () => {this.loadingCount--;});
},
@@ -174,6 +187,13 @@ export default {
},
},
watch: {
+ computeResourceOptions: function(newOptions) {
+ // If the selected resourceHostId is not in the new list of
+ // computeResourceOptions, reset it to null
+ if (this.resourceHostId !== null && !newOptions.find(opt => opt.value === this.resourceHostId)) {
+ this.resourceHostId = null;
+ }
+ }
}
}
</script>
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/GroupResourceProfileSelector.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/GroupResourceProfileSelector.vue
index 3b3bbfc..923e8f6 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/GroupResourceProfileSelector.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/GroupResourceProfileSelector.vue
@@ -5,7 +5,7 @@
<b-form-select id="group-resource-profile"
v-model="groupResourceProfileId"
:options="groupResourceProfileOptions" required
- @changed="groupResourceProfileChanged"
+ @change="groupResourceProfileChanged"
:disabled="loading">
<template slot="first">
<option :value="null" disabled>Select an allocation</option>
@@ -72,7 +72,8 @@ export default {
})
.then(()=> {this.loadingCount--;}, () => {this.loadingCount--;});
},
- groupResourceProfileChanged: function() {
+ groupResourceProfileChanged: function(groupResourceProfileId) {
+ this.groupResourceProfileId = groupResourceProfileId
this.emitValueChanged();
},
emitValueChanged: function() {
--
To stop receiving notification emails like this one, please contact
machristie@apache.org.