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/06/03 18:13:06 UTC

[airavata-django-portal] branch master updated (31b7e80 -> 2596010)

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 31b7e80  Adding `settings_local*.py` to .gitignore
     new 06b551e  AIRAVATA-3041 Adding search over identity server users
     new 2596010  AIRVATA-3041 Add creationTime to manage users view

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:
 .../ComputeResourcePreferenceDashboard.vue         |  8 +--
 .../dashboards/CredentialStoreDashboard.vue        |  6 ++-
 .../components/users/UserManagementContainer.vue   | 60 ++++++++++++++++++++--
 django_airavata/apps/api/serializers.py            |  1 +
 .../js/models/ManagedUserProfile.js                |  4 ++
 django_airavata/apps/api/views.py                  |  1 +
 .../components/storage/UserStoragePathViewer.vue   |  5 +-
 .../static/common/js/components/HumanDate.vue      | 18 +++++++
 django_airavata/static/common/js/index.js          |  2 +
 9 files changed, 93 insertions(+), 12 deletions(-)
 create mode 100644 django_airavata/static/common/js/components/HumanDate.vue


[airavata-django-portal] 01/02: AIRAVATA-3041 Adding search over identity server users

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 06b551e7d70347c34b7e71bafce3a9d52f5a967a
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Jun 3 10:35:46 2019 -0400

    AIRAVATA-3041 Adding search over identity server users
---
 .../components/users/UserManagementContainer.vue   | 50 +++++++++++++++++++---
 1 file changed, 45 insertions(+), 5 deletions(-)

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 25c5ba7..6f11a93 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
@@ -2,7 +2,29 @@
   <div>
     <div class="row">
       <div class="col">
-        <h1 class="h4 mb-4">Users</h1>
+        <h1 class="h4 mb-4">Manage Users</h1>
+      </div>
+    </div>
+    <div class="row">
+      <div class="col">
+        <div class="card">
+          <div class="card-body">
+            <b-input-group>
+              <b-form-input
+                v-model="search"
+                placeholder="Search by name, email or username"
+                @keydown.native.enter="searchUsers"
+              />
+              <b-input-group-append>
+                <b-button @click="resetSearch">Reset</b-button>
+                <b-button
+                  variant="primary"
+                  @click="searchUsers"
+                >Search</b-button>
+              </b-input-group-append>
+            </b-input-group>
+          </div>
+        </div>
       </div>
     </div>
     <div class="row">
@@ -59,7 +81,8 @@ export default {
     return {
       usersPaginator: null,
       allGroups: null,
-      showingDetails: {}
+      showingDetails: {},
+      search: null
     };
   },
   components: {
@@ -111,7 +134,8 @@ export default {
       return this.usersPaginator
         ? this.usersPaginator.results.map(u => {
             const user = u.clone();
-            user._showDetails = this.showingDetails[u.airavataInternalUserId] || false;
+            user._showDetails =
+              this.showingDetails[u.airavataInternalUserId] || false;
             return user;
           })
         : [];
@@ -141,15 +165,31 @@ export default {
       });
     },
     reloadUserProfiles() {
-      services.ManagedUserProfileService.list({
+      const params = {
         limit: 10,
         offset: this.currentOffset
-      }).then(users => (this.usersPaginator = users));
+      };
+      if (this.search) {
+        params["search"] = this.search;
+      }
+      services.ManagedUserProfileService.list(params).then(
+        users => (this.usersPaginator = users)
+      );
     },
     toggleDetails(row) {
       row.toggleDetails();
       this.showingDetails[row.item.airavataInternalUserId] = !this
         .showingDetails[row.item.airavataInternalUserId];
+    },
+    searchUsers() {
+      // Reset paginator when starting a search
+      this.usersPaginator = null;
+      this.reloadUserProfiles();
+    },
+    resetSearch() {
+      this.usersPaginator = null;
+      this.search = null;
+      this.reloadUserProfiles();
     }
   }
 };


[airavata-django-portal] 02/02: AIRVATA-3041 Add creationTime to manage users view

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 2596010042b99c39ffd511a9f33bd2f8ac20ce51
Author: Marcus Christie <ma...@apache.org>
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,