You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ya...@apache.org on 2025/06/22 16:13:01 UTC
(airavata-portals) 33/39: Added sort by Last Mofified
This is an automated email from the ASF dual-hosted git repository.
yasith pushed a commit to branch merge-portals
in repository https://gitbox.apache.org/repos/asf/airavata-portals.git
commit bde3e886ab5c80df55b7d62767572bbd64709cf8
Author: Akhil Nagulavancha <ak...@Akhils-MacBook-Pro.local>
AuthorDate: Tue Jul 21 16:21:18 2020 -0400
Added sort by Last Mofified
---
.../airavata_mft_workspace/js/containers/Storage.vue | 4 ++++
.../js/containers/StorageResources.vue | 6 +++++-
airavata_mft/apps/workspace/views.py | 18 +++++++++---------
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/Storage.vue b/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/Storage.vue
index 3085694dd..5b7a5aef9 100644
--- a/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/Storage.vue
+++ b/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/Storage.vue
@@ -11,6 +11,7 @@
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" @click="sortBy('name')">Name</a>
<a class="dropdown-item" href="#" @click="sortBy('size')">Size</a>
+ <a class="dropdown-item" href="#" @click="sortDateBy('lastModified')">Last Modified</a>
</div>
</div>
</div>
@@ -120,6 +121,9 @@ export default {
showDescription(unit) {
this.selectedStorage = unit
this.$bvModal.show("description-dialog")
+ },
+ sortDateBy(prop){
+ this.storageList.sort((a,b)=>a[prop] > b[prop] ? -1 : 1)
},
sortBy(prop){
this.storageList.sort((a,b)=>a[prop] < b[prop] ? -1 : 1)
diff --git a/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/StorageResources.vue b/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/StorageResources.vue
index f0618c43f..601624356 100644
--- a/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/StorageResources.vue
+++ b/airavata_mft/apps/workspace/static/airavata_mft_workspace/js/containers/StorageResources.vue
@@ -1,7 +1,7 @@
<template>
<div class="row">
<div class="col-7">
- <h1 class="h4 mb-4">{{heading}}</h1>
+ <h1 class="h4 mb-4">Storage Unit >{{heading}}</h1>
</div>
<div class="col-4">
<div class="btn-toolbar">
@@ -11,6 +11,7 @@
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" @click="sortBy('name')">Name</a>
<a class="dropdown-item" href="#" @click="sortBy('size')">Size</a>
+ <a class="dropdown-item" href="#" @click="sortDateBy('lastModified')">Last Modified</a>
</div>
</div>
</div>
@@ -61,6 +62,9 @@
}
},
methods:{
+ sortDateBy(prop){
+ this.resourcesList.sort((a,b)=>a[prop] > b[prop] ? -1 : 1)
+ },
sortBy(prop){
this.resources.sort((a,b)=>a[prop] < b[prop] ? -1 : 1)
}
diff --git a/airavata_mft/apps/workspace/views.py b/airavata_mft/apps/workspace/views.py
index b413e447f..859350b2a 100644
--- a/airavata_mft/apps/workspace/views.py
+++ b/airavata_mft/apps/workspace/views.py
@@ -5,10 +5,10 @@ import json
def storage(request):
# TODO: grpc calls to backend
- storage_json = [{"storageId": "ssh-storage1", "name": "One Drive", "size": "20GB", "occupied": "10GB", "lastModified":"26, March 2020", "host": "localhost", "port": 22, "user": "root"},
- {"storageId": "ssh-storage1", "name": "Google Drive", "size": "10GB", "occupied": "10GB", "lastModified":"26, March 2020", "host": "scp1", "port": 22, "user": "root"},
- {"storageId": "ssh-storage1", "name": "Box", "size": "30GB", "occupied": "10GB", "lastModified":"26, March 2020", "host": "scp2", "port": 22, "user": "root"},
- {"storageId": "ssh-storage1", "name": "Drop Box", "size": "40GB", "occupied": "10GB", "lastModified":"26, March 2020"}]
+ storage_json = [{"storageId": "ssh-storage1", "name": "One Drive", "size": "20GB", "occupied": "10GB", "lastModified":"01/15/2020", "host": "localhost", "port": 22, "user": "root"},
+ {"storageId": "ssh-storage1", "name": "Google Drive", "size": "10GB", "occupied": "10GB", "lastModified":"01/16/2020", "host": "scp1", "port": 22, "user": "root"},
+ {"storageId": "ssh-storage1", "name": "Box", "size": "30GB", "occupied": "10GB", "lastModified":"02/15/2020", "host": "scp2", "port": 22, "user": "root"},
+ {"storageId": "ssh-storage1", "name": "Drop Box", "size": "40GB", "occupied": "10GB", "lastModified":"01/15/2019"}]
return render(request, 'storage.html', {'bundle_name': 'storage',
'data': json.dumps(storage_json),
@@ -16,11 +16,11 @@ def storage(request):
def resources(request, storage_id):
- resource_json = [{"resourceId": "Spring project", "name": "Spring project", "size": "11 GB", "lastModified": "Jan 15, 2020"},
- {"resourceId": "Trial", "name": "Trial", "size": "12 GB", "lastModified": "Jan 15, 2020"},
- {"resourceId": "New", "name": "New", "size": "13 GB", "lastModified": "Jan 15, 2020"},
- {"resourceId": "Random testing", "name": "Random testing", "size": "14 GB", "lastModified": "Jan 15, 2020"}]
+ resource_json = [{"resourceId": "Spring project", "name": "Spring project", "size": "11 GB", "lastModified": "01/15/2020"},
+ {"resourceId": "Trial", "name": "Trial", "size": "12 GB", "lastModified": "02/15/2020"},
+ {"resourceId": "New", "name": "New", "size": "13 GB", "lastModified": "03/15/2020"},
+ {"resourceId": "Random testing", "name": "Random testing", "size": "14 GB", "lastModified": "01/16/2020"}]
return render(request, 'resources.html', {'bundle_name': 'resources',
'data': json.dumps(resource_json),
- 'title': 'Storage Unit > ' + storage_id})
+ 'title': storage_id})