airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 05/06: AIRAVATA-2907 Formatting storage pref listing
Date Fri, 16 Nov 2018 22:00:17 GMT
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 fd358e4781ff804e1c3e4a2602d1ea3b6a7b75c3
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Fri Nov 16 15:49:56 2018 -0500

    AIRAVATA-2907 Formatting storage pref listing
---
 .../gatewayprofile/StoragePreferenceList.vue       | 43 ++++++++++++++++------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
index 7f1424d..00c259f 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
@@ -65,7 +65,8 @@ export default {
       showingDetails: {},
       showNewItemEditor: false,
       newStoragePreference: null,
-      storageResourceNames: null
+      storageResourceNames: null,
+      credentials: null
     };
   },
   computed: {
@@ -88,8 +89,7 @@ export default {
         },
         {
           label: "File System Location",
-          key: "fileSystemRootLocation",
-          formatter: value => this.formatFileSystemLocation(value)
+          key: "fileSystemRootLocation"
         },
         {
           label: "Action",
@@ -122,25 +122,46 @@ export default {
         }
       }
       return utils.StringUtils.sortIgnoreCase(options, a => a.text);
+    },
+    defaultCredentialSummary() {
+      if (this.defaultCredentialStoreToken && this.credentials) {
+        return this.credentials.find(
+          cred => cred.token === this.defaultCredentialStoreToken
+        );
+      } else {
+        return null;
+      }
     }
   },
   created() {
     services.StorageResourceService.names().then(names => {
       this.storageResourceNames = names;
     });
+    services.CredentialSummaryService.allSSHCredentials().then(
+      creds => (this.credentials = creds)
+    );
   },
   methods: {
     getStorageResourceName(storageResourceId) {
-      // TODO: fetch storage resources
-      return storageResourceId;
+      if (
+        this.storageResourceNames &&
+        storageResourceId in this.storageResourceNames
+      ) {
+        return this.storageResourceNames[storageResourceId];
+      } else {
+        return storageResourceId.substring(0, 10) + "...";
+      }
     },
     getCredentialName(token) {
-      // TODO: fetch credential name
-      return token;
-    },
-    formatFileSystemLocation(fileSystemRootLocation) {
-      // TODO: truncate to fit
-      return fileSystemRootLocation;
+      if (token === null && this.defaultCredentialSummary) {
+        return this.defaultCredentialSummary.description + " (default)";
+      } else if (this.credentials) {
+        const cred = this.credentials.find(cred => cred.token === token);
+        if (cred) {
+          return cred.description;
+        }
+      }
+      return "...";
     },
     updatedStoragePreference(newValue) {
       this.$emit("updated", newValue);


Mime
View raw message