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/29 19:44:44 UTC

[airavata-django-portal] branch master updated (5609380 -> 2cead47)

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git.


    from 5609380  AIRAVATA-2988 Initial WIP user management view
     new 9d85444  AIRAVATA-3018 Only show edit button when project is writeable
     new 2cead47  AIRAVATA-3018 PaginationIterator using FetchUtils to display spinner

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 django_airavata/apps/api/serializers.py                      |  7 +++++++
 .../apps/api/static/django_airavata_api/js/models/Project.js |  3 ++-
 .../django_airavata_api/js/utils/PaginationIterator.js       | 12 ++++--------
 .../js/components/project/ProjectListItem.vue                |  2 +-
 4 files changed, 14 insertions(+), 10 deletions(-)


[airavata-django-portal] 02/02: AIRAVATA-3018 PaginationIterator using FetchUtils to display spinner

Posted by ma...@apache.org.
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 2cead47e5248b2f6314889fec9932d0c244f2ae0
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed May 29 15:44:23 2019 -0400

    AIRAVATA-3018 PaginationIterator using FetchUtils to display spinner
---
 .../django_airavata_api/js/utils/PaginationIterator.js       | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/utils/PaginationIterator.js b/django_airavata/apps/api/static/django_airavata_api/js/utils/PaginationIterator.js
index a5ff955..92c19aa 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/utils/PaginationIterator.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/utils/PaginationIterator.js
@@ -1,4 +1,6 @@
 
+import FetchUtils from "./FetchUtils";
+
 export default class PaginationIterator {
 
     constructor(pagedResponse, resultType = null) {
@@ -7,10 +9,7 @@ export default class PaginationIterator {
     }
 
     next() {
-        return fetch(this._next, {
-            credentials: 'include'
-        })
-        .then(response => response.json())
+        return FetchUtils.get(this._next)
         .then(json => this.processResponse(json));
     }
 
@@ -19,10 +18,7 @@ export default class PaginationIterator {
     }
 
     previous() {
-        return fetch(this._previous, {
-            credentials: 'include'
-        })
-        .then(response => response.json())
+        return FetchUtils.get(this._previous)
         .then(json => this.processResponse(json));
     }
 


[airavata-django-portal] 01/02: AIRAVATA-3018 Only show edit button when project is writeable

Posted by ma...@apache.org.
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 9d85444118e41133859dfab863181b536e70db0b
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed May 29 15:43:42 2019 -0400

    AIRAVATA-3018 Only show edit button when project is writeable
---
 django_airavata/apps/api/serializers.py                            | 7 +++++++
 .../apps/api/static/django_airavata_api/js/models/Project.js       | 3 ++-
 .../js/components/project/ProjectListItem.vue                      | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index b36524e..26ebf7e 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -247,6 +247,7 @@ class ProjectSerializer(
         lookup_field='projectID',
         lookup_url_kwarg='project_id')
     creationTime = UTCPosixTimestampDateTimeField(allow_null=True)
+    userHasWriteAccess = serializers.SerializerMethodField()
 
     def create(self, validated_data):
         return Project(**validated_data)
@@ -257,6 +258,12 @@ class ProjectSerializer(
             'description', instance.description)
         return instance
 
+    def get_userHasWriteAccess(self, project):
+        request = self.context['request']
+        return request.airavata_client.userHasAccess(
+            request.authz_token, project.projectID,
+            ResourcePermissionType.WRITE)
+
 
 class ApplicationModuleSerializer(
         thrift_utils.create_serializer_class(ApplicationModule)):
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js b/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js
index 59bc6be..55ad97f 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/Project.js
@@ -10,6 +10,7 @@ const FIELDS = [
         name: 'creationTime',
         type: 'date'
     },
+    'userHasWriteAccess'
 ];
 
 export default class Project extends BaseModel {
@@ -25,4 +26,4 @@ export default class Project extends BaseModel {
         }
         return null;
     }
-}
\ No newline at end of file
+}
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/ProjectListItem.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/ProjectListItem.vue
index 2434240..8b690c1 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/ProjectListItem.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/ProjectListItem.vue
@@ -3,7 +3,7 @@
     <td>{{ project.name }}</td>
     <td>{{ project.owner }}</td>
     <td v-bind:title="project.creationTime">{{ creationTime }}</td>
-    <td><a :href="editLink">Edit <i
+    <td><a :href="editLink" v-if="project.userHasWriteAccess">Edit <i
           class="fa fa-edit"
           aria-hidden="true"
         ></i></a></td>