airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [2/3] airavata-django-portal git commit: AIRAVATA-2537 Fleshing out project list table
Date Wed, 11 Oct 2017 19:42:30 GMT
AIRAVATA-2537 Fleshing out project list table


Project: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/commit/ae10daf4
Tree: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/tree/ae10daf4
Diff: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/diff/ae10daf4

Branch: refs/heads/master
Commit: ae10daf49f6f21b85c7102f25ad58e11453ba53c
Parents: 71ca603
Author: Marcus Christie <machrist@iu.edu>
Authored: Thu Sep 28 15:46:18 2017 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Thu Sep 28 15:46:18 2017 -0400

----------------------------------------------------------------------
 django_airavata/apps/api/serializers.py           | 12 ++++++++++++
 django_airavata/apps/workspace/package-lock.json  |  5 +++++
 django_airavata/apps/workspace/package.json       |  1 +
 .../js/views/ProjectList.vue                      | 18 ++++++++++++++----
 .../js/views/ProjectListItem.vue                  | 15 ++++++++++++---
 .../django_airavata_workspace/projects_list.html  |  2 +-
 django_airavata/static/common/scss/main.scss      |  1 +
 django_airavata/templates/base.html               |  2 +-
 8 files changed, 47 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/apps/api/serializers.py
----------------------------------------------------------------------
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index afdb09d..45c6d10 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -5,6 +5,7 @@ from django.conf import settings
 
 from rest_framework import serializers
 
+import datetime
 from urllib.parse import quote
 
 
@@ -19,6 +20,16 @@ class FullyEncodedHyperlinkedIdentityField(serializers.HyperlinkedIdentityField)
         url = self.reverse(view_name, kwargs=kwargs, request=request, format=format)
         return url.replace("__PLACEHOLDER__", encoded_lookup_value)
 
+class UTCPosixTimestampDateTimeField(serializers.DateTimeField):
+    def to_representation(self, obj):
+        dt = datetime.datetime.utcfromtimestamp(obj/1000)
+        return super().to_representation(dt)
+
+    def to_internal_value(self, data):
+        dt = super().to_internal_value(data)
+        return int(dt.timestamp() * 1000)
+
+
 class GetGatewayUsername(object):
 
     def __call__(self):
@@ -49,6 +60,7 @@ class ProjectSerializer(serializers.Serializer):
     owner = GatewayUsernameDefaultField()
     gatewayId = GatewayIdDefaultField()
     experiments = FullyEncodedHyperlinkedIdentityField(view_name='django_airavata_api:project-experiments',
lookup_field='projectID', lookup_url_kwarg='project_id')
+    creationTime = UTCPosixTimestampDateTimeField()
 
     def create(self, validated_data):
         return Project(**validated_data)

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/apps/workspace/package-lock.json
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/package-lock.json b/django_airavata/apps/workspace/package-lock.json
index 07d2363..dbcf1e2 100644
--- a/django_airavata/apps/workspace/package-lock.json
+++ b/django_airavata/apps/workspace/package-lock.json
@@ -3934,6 +3934,11 @@
         "minimist": "0.0.8"
       }
     },
+    "moment": {
+      "version": "2.18.1",
+      "resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz",
+      "integrity": "sha1-w2GT3Tzhwu7SrbfIAtu8d6gbHA8="
+    },
     "ms": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/apps/workspace/package.json
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/package.json b/django_airavata/apps/workspace/package.json
index 028d70d..5a2c4de 100644
--- a/django_airavata/apps/workspace/package.json
+++ b/django_airavata/apps/workspace/package.json
@@ -10,6 +10,7 @@
     "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
   },
   "dependencies": {
+    "moment": "^2.18.1",
     "vue": "^2.3.3"
   },
   "devDependencies": {

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
index a7fdfcc..4951cbb 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
@@ -1,8 +1,18 @@
 <template>
-    <ul id="project-list">
-        <project-list-item v-bind:project="project" v-for="project in projects" v-bind:key="project.projectID">
-        </project-list-item>
-    </ul>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Name</th>
+                <th>Owner</th>
+                <th>Creation Time</th>
+                <th>Actions</th>
+            </tr>
+        </thead>
+        <tbody>
+            <project-list-item v-bind:project="project" v-for="project in projects" v-bind:key="project.projectID">
+            </project-list-item>
+        </tbody>
+    </table>
 </template>
 
 <script>

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListItem.vue
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListItem.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListItem.vue
index 9903dd1..fd5bf92 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListItem.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectListItem.vue
@@ -1,13 +1,22 @@
 <template>
-    <li>{{ project.name }}</li>
+    <tr>
+        <td>{{ project.name }}</td>
+        <td>{{ project.owner }}</td>
+        <td v-bind:title="project.creationTime">{{ creationTime }}</td>
+        <td><a href="#">View <i class="fa fa-bar-chart" aria-hidden="true"></i></a></td>
+    </tr>
 </template>
 
 <script>
+import moment from 'moment';
+
 export default {
     name: 'project-list-item',
     props: ['project'],
-    data: function () {
-        return {
+    computed: {
+        creationTime: function () {
+            var dt = new Date(this.project.creationTime);
+            return moment(dt).fromNow();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
b/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
index 3ab4184..02943e7 100644
--- a/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
+++ b/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
@@ -4,7 +4,7 @@
 
 {% block content %}
 
-<h1>Projects</h1>
+<h4>Browse Projects</h4>
 
 <div id="project-list" data-projects="{{ projects_data }}"></div>
 

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/static/common/scss/main.scss
----------------------------------------------------------------------
diff --git a/django_airavata/static/common/scss/main.scss b/django_airavata/static/common/scss/main.scss
index e5d88cf..46167fe 100644
--- a/django_airavata/static/common/scss/main.scss
+++ b/django_airavata/static/common/scss/main.scss
@@ -99,6 +99,7 @@ body {
 .main-content {
     flex-grow: 1;
     padding: 1rem;
+    overflow-y: scroll;
 }
 
 .sidebar {

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/ae10daf4/django_airavata/templates/base.html
----------------------------------------------------------------------
diff --git a/django_airavata/templates/base.html b/django_airavata/templates/base.html
index 29af934..6a4823c 100644
--- a/django_airavata/templates/base.html
+++ b/django_airavata/templates/base.html
@@ -1,10 +1,10 @@
 {% load static %}
 <!DOCTYPE html>
 <head>
-    <link rel=stylesheet type=text/css href="{% static 'common/dist/main.css' %}">
     <link rel=stylesheet type=text/css href="{% static 'bootstrap-4.0.0-beta/css/bootstrap.min.css'
%}">
     <link rel=stylesheet type=text/css
           href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css>
+    <link rel=stylesheet type=text/css href="{% static 'common/dist/main.css' %}">
     {% block css %}
 
     {% endblock %}


Mime
View raw message