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 2596010042b99c39ffd511a9f33bd2f8ac20ce51
Author: Marcus Christie <[email protected]>
AuthorDate: Mon Jun 3 10:58:12 2019 -0400

    AIRVATA-3041 Add creationTime to manage users view
    
    Also added common component HumanDate for friendly display of dates.
---
 .../dashboards/ComputeResourcePreferenceDashboard.vue  |  8 +++++---
 .../components/dashboards/CredentialStoreDashboard.vue |  6 ++++--
 .../src/components/users/UserManagementContainer.vue   | 10 ++++++++++
 django_airavata/apps/api/serializers.py                |  1 +
 .../js/models/ManagedUserProfile.js                    |  4 ++++
 django_airavata/apps/api/views.py                      |  1 +
 .../js/components/storage/UserStoragePathViewer.vue    |  5 +++--
 .../static/common/js/components/HumanDate.vue          | 18 ++++++++++++++++++
 django_airavata/static/common/js/index.js              |  2 ++
 9 files changed, 48 insertions(+), 7 deletions(-)

diff --git 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/ComputeResourcePreferenceDashboard.vue
 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/ComputeResourcePreferenceDashboard.vue
index c9b108e..c72813d 100644
--- 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/ComputeResourcePreferenceDashboard.vue
+++ 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/ComputeResourcePreferenceDashboard.vue
@@ -3,6 +3,9 @@
     <template slot="item-list" slot-scope="slotProps">
 
       <b-table striped hover :fields="fields" :items="slotProps.items">
+        <template slot="updatedTime" slot-scope="data">
+          <human-date :date="data.value"/>
+        </template>
         <template slot="action" slot-scope="data">
           <router-link class="action-link" v-if="data.item.userHasWriteAccess" 
:to="{name: 'group_resource_preference', params: {value: data.item, id: 
data.item.groupResourceProfileId}}">
             Edit
@@ -19,13 +22,13 @@
 </template>
 
 <script>
-import { layouts } from "django-airavata-common-ui";
+import { components, layouts } from "django-airavata-common-ui";
 import { services } from "django-airavata-api";
-import moment from "moment";
 
 export default {
   name: "compute-resource-preference",
   components: {
+    "human-date": components.HumanDate,
     "list-layout": layouts.ListLayout
   },
   data: function() {
@@ -39,7 +42,6 @@ export default {
         {
           label: "Updated",
           key: "updatedTime",
-          formatter: value => moment(new Date(value)).fromNow()
         },
         {
           label: "Action",
diff --git 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
index ea3f797..4b6bebe 100644
--- 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
+++ 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
@@ -7,6 +7,9 @@
           <template slot="sharing" slot-scope="data">
             <share-button :entity-id="data.item.token" 
:disallow-editing-admin-groups="false" />
           </template>
+          <template slot="persistedTime" slot-scope="data">
+            <human-date :date="data.value"/>
+          </template>
           <template slot="action" slot-scope="data">
             <clipboard-copy-link :text="data.item.publicKey.trim()" 
class="mr-1" />
             <delete-link v-if="data.item.userHasWriteAccess" 
@delete="deleteSSHCredential(data.item)">
@@ -42,13 +45,13 @@
 <script>
 import { services } from "django-airavata-api";
 import { components, layouts } from "django-airavata-common-ui";
-import moment from "moment";
 import NewSSHCredentialModal from "../credentials/NewSSHCredentialModal.vue";
 import NewPasswordCredentialModal from 
"../credentials/NewPasswordCredentialModal.vue";
 
 export default {
   components: {
     "delete-link": components.DeleteLink,
+    "human-date": components.HumanDate,
     "list-layout": layouts.ListLayout,
     "clipboard-copy-link": components.ClipboardCopyLink,
     "new-password-credential-modal": NewPasswordCredentialModal,
@@ -79,7 +82,6 @@ export default {
         {
           label: "Created",
           key: "persistedTime",
-          formatter: value => moment(new Date(value)).fromNow()
         },
         {
           label: "Sharing",
diff --git 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
index 6f11a93..92e5c25 100644
--- 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
+++ 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
@@ -37,6 +37,11 @@
               :items="items"
             >
               <template
+                slot="creationTime"
+                slot-scope="data">
+                <human-date :date="data.value"/>
+              </template>
+              <template
                 slot="action"
                 slot-scope="data"
               >
@@ -87,6 +92,7 @@ export default {
   },
   components: {
     pager: components.Pager,
+    'human-date': components.HumanDate,
     UserDetailsContainer
   },
   created() {
@@ -125,6 +131,10 @@ export default {
           key: "emailVerified"
         },
         {
+          label: "Created",
+          key: "creationTime"
+        },
+        {
           label: "Action",
           key: "action"
         }
diff --git a/django_airavata/apps/api/serializers.py 
b/django_airavata/apps/api/serializers.py
index 4ab470f..614330c 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -819,6 +819,7 @@ class ManagedUserProfile(serializers.Serializer):
     enabled = serializers.BooleanField()
     emailVerified = serializers.BooleanField()
     airavataUserProfileExists = serializers.BooleanField()
+    creationTime = UTCPosixTimestampDateTimeField()
     groups = GroupSerializer(many=True)
     url = FullyEncodedHyperlinkedIdentityField(
         view_name='django_airavata_api:managed-user-profile-detail',
diff --git 
a/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
 
b/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
index 0a7b4f0..3c87783 100644
--- 
a/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
+++ 
b/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
@@ -13,6 +13,10 @@ const FIELDS = [
   "emailVerified",
   "airavataUserProfileExists",
   {
+    name: "creationTime",
+    type: 'date',
+  },
+  {
     name: "groups",
     type: Group,
     list: true
diff --git a/django_airavata/apps/api/views.py 
b/django_airavata/apps/api/views.py
index f8a8938..d3f1393 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -1436,5 +1436,6 @@ class ManagedUserViewSet(mixins.CreateModelMixin,
             'enabled': user_profile.State == Status.CONFIRMED,
             'emailVerified': user_profile.State == Status.CONFIRMED,
             'airavataUserProfileExists': airavata_user_profile_exists,
+            'creationTime': user_profile.creationTime,
             'groups': groups
         }
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 7b6826a..fb33193 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
@@ -26,7 +26,7 @@
         slot="createdTimestamp"
         slot-scope="data"
       >
-        <span :title="data.item.createdTime.toString()">{{ 
fromNow(data.item.createdTime)}}</span>
+        <human-date :date="data.value"/>
       </template>
       <template
         slot="actions"
@@ -53,6 +53,7 @@ export default {
   },
   components: {
     "delete-button": components.DeleteButton,
+    "human-date": components.HumanDate,
     UserStoragePathBreadcrumb
   },
   computed: {
@@ -71,7 +72,7 @@ export default {
         },
         {
           label: "Created Time",
-          key: "createdTimestamp",
+          key: "createdTime",
           sortable: true
         },
         {
diff --git a/django_airavata/static/common/js/components/HumanDate.vue 
b/django_airavata/static/common/js/components/HumanDate.vue
new file mode 100644
index 0000000..26bd3fa
--- /dev/null
+++ b/django_airavata/static/common/js/components/HumanDate.vue
@@ -0,0 +1,18 @@
+<template>
+  <span :title="date.toString()">{{ fromNow }}</span>
+</template>
+<script>
+import moment from "moment";
+export default {
+  name: "human-date",
+  props: {
+    date: Date
+  },
+  computed: {
+    fromNow() {
+      return moment(this.date).fromNow();
+    }
+  }
+};
+</script>
+
diff --git a/django_airavata/static/common/js/index.js 
b/django_airavata/static/common/js/index.js
index 5de0d98..74c1d3e 100644
--- a/django_airavata/static/common/js/index.js
+++ b/django_airavata/static/common/js/index.js
@@ -5,6 +5,7 @@ import ClipboardCopyLink from 
"./components/ClipboardCopyLink.vue";
 import ConfirmationDialog from "./components/ConfirmationDialog.vue";
 import DeleteButton from "./components/DeleteButton.vue";
 import DeleteLink from "./components/DeleteLink.vue";
+import HumanDate from "./components/HumanDate.vue";
 import MainLayout from "./components/MainLayout.vue";
 import Pager from "./components/Pager.vue";
 import ShareButton from "./components/ShareButton.vue";
@@ -36,6 +37,7 @@ const components = {
   ConfirmationDialog,
   DeleteButton,
   DeleteLink,
+  HumanDate,
   MainLayout,
   ShareButton,
   Sidebar,

Reply via email to