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 2019/05/13 13:53:19 UTC

[airavata-django-portal] 01/02: AIRAVATA-3038 Remove old GroupResourceProfileService class

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

commit e4ff4e3edf69ae1b71aa879be16f81664394a84f
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon May 13 09:47:30 2019 -0400

    AIRAVATA-3038 Remove old GroupResourceProfileService class
---
 .../ComputePreference.vue                          | 12 +++-------
 .../GroupComputeResourcePreference.vue             |  4 ++--
 .../js/services/GroupResourceProfileService.js     | 27 ----------------------
 3 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/ComputePreference.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/ComputePreference.vue
index 459b404..090e835 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/ComputePreference.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/ComputePreference.vue
@@ -224,9 +224,7 @@ export default {
       );
       // TODO: success and error handling are the same so we can just combine those
       if (this.id) {
-        DjangoAiravataAPI.services.ServiceFactory.service(
-          "GroupResourceProfiles"
-        )
+        DjangoAiravataAPI.services.GroupResourceProfileService
           .update({ data: groupResourceProfile, lookup: this.id })
           .then(groupResourceProfile => {
             // Navigate back to GroupResourceProfile with success message
@@ -239,9 +237,7 @@ export default {
             });
           });
       } else {
-        DjangoAiravataAPI.services.ServiceFactory.service(
-          "GroupResourceProfiles"
-        )
+        DjangoAiravataAPI.services.GroupResourceProfileService
           .create({ data: groupResourceProfile })
           .then(groupResourceProfile => {
             // Navigate back to GroupResourceProfile with success message
@@ -261,9 +257,7 @@ export default {
         this.host_id
       );
       if (removedChildren) {
-        DjangoAiravataAPI.services.ServiceFactory.service(
-          "GroupResourceProfiles"
-        )
+        DjangoAiravataAPI.services.GroupResourceProfileService
           .update({ data: groupResourceProfile, lookup: this.id })
           .then(groupResourceProfile => {
             // Navigate back to GroupResourceProfile with success message
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
index 6c1eec8..7bca11c 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
@@ -88,7 +88,7 @@ export default {
   mounted: function() {
     if (this.id) {
       if (!this.value.groupResourceProfileId) {
-        services.ServiceFactory.service("GroupResourceProfiles")
+        services.GroupResourceProfileService
           .retrieve({ lookup: this.id })
           .then(grp => (this.data = grp));
       }
@@ -98,7 +98,7 @@ export default {
     let data = this.value.clone();
     return {
       data: data,
-      service: services.ServiceFactory.service("GroupResourceProfiles"),
+      service: services.GroupResourceProfileService,
       computePreferencesFields: [
         {
           label: "Name",
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/services/GroupResourceProfileService.js b/django_airavata/apps/api/static/django_airavata_api/js/services/GroupResourceProfileService.js
deleted file mode 100644
index 29e05c5..0000000
--- a/django_airavata/apps/api/static/django_airavata_api/js/services/GroupResourceProfileService.js
+++ /dev/null
@@ -1,27 +0,0 @@
-
-import FetchUtils from '../utils/FetchUtils'
-import GroupResourceProfile from '../models/GroupResourceProfile'
-
-class GroupResourceProfileService {
-    list(data = null) {
-        if (data) {
-            return Promise.resolve(data.map(result => new GroupResourceProfile(result)));
-        } else {
-            return FetchUtils.get('/api/group-resource-profiles/')
-                .then(results => results.map(result => new GroupResourceProfile(result)));
-        }
-    }
-
-    get(groupResourceProfileId, data = null) {
-        if (data) {
-            return Promise.resolve(new GroupResourceProfile(data));
-        } else {
-            return FetchUtils.get('/api/group-resource-profiles/'
-                    + encodeURIComponent(groupResourceProfileId) + '/')
-                .then(result => new GroupResourceProfile(result));
-        }
-    }
-}
-
-// Export as a singleton
-export default new GroupResourceProfileService();
\ No newline at end of file