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 2023/02/22 20:37:25 UTC

[airavata-django-portal] branch develop updated: AIRAVATA-3682 Sort the shared directory first

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 fbcbf853 AIRAVATA-3682 Sort the shared directory first
fbcbf853 is described below

commit fbcbf85356c0cfe6172dd53aa8f4ff709c7be843
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Feb 22 15:37:17 2023 -0500

    AIRAVATA-3682 Sort the shared directory first
---
 .../js/components/storage/UserStoragePathViewer.vue    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
index 2e4c2898..3c008bb4 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
@@ -28,6 +28,7 @@
       :fields="fields"
       :items="items"
       sort-by="name"
+      :sort-compare="sortCompare"
     >
       <template slot="cell(name)" slot-scope="data">
         <b-link
@@ -251,6 +252,23 @@ export default {
         ) !== undefined
       );
     },
+    sortCompare(aRow, bRow, key) {
+      if (key === "name") {
+        // Sort the shared directory first
+        if (aRow.isSharedDir) {
+          return -1;
+        }
+        if (bRow.isSharedDir) {
+          return 1;
+        }
+        const a = aRow[key];
+        const b = bRow[key];
+        return a.localeCompare(b);
+      } else {
+        // Use default logic for all other fields
+        return null;
+      }
+    },
   },
 };
 </script>