directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject directory-fortress-enmasse git commit: handle search
Date Mon, 19 Nov 2018 10:28:36 GMT
Repository: directory-fortress-enmasse
Updated Branches:
  refs/heads/FC-247 5aae8a26f -> 1979a679d


handle search


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/commit/1979a679
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/tree/1979a679
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/diff/1979a679

Branch: refs/heads/FC-247
Commit: 1979a679dfd41c69b4c026621e6a87ca24c71dd9
Parents: 5aae8a2
Author: Kiran Ayyagari <kayyagari@apache.org>
Authored: Mon Nov 19 15:58:18 2018 +0530
Committer: Kiran Ayyagari <kayyagari@apache.org>
Committed: Mon Nov 19 15:58:18 2018 +0530

----------------------------------------------------------------------
 embrasure/src/components/Users.vue | 40 +++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/blob/1979a679/embrasure/src/components/Users.vue
----------------------------------------------------------------------
diff --git a/embrasure/src/components/Users.vue b/embrasure/src/components/Users.vue
index f97757f..1a9435d 100644
--- a/embrasure/src/components/Users.vue
+++ b/embrasure/src/components/Users.vue
@@ -167,8 +167,9 @@ export default {
      },
       filters: [
         {
-          prop: ['userId', 'name', 'displayName', 'roles', 'adminRoles'],
-          value: ''
+          prop: ['userId', 'name', 'displayName'], // roles and adminRoles are handled specially
in filterRows function
+          value: '',
+          filterFn: this.filterRows
         }
       ]
     }
@@ -475,6 +476,41 @@ export default {
                       }
           let respPromise = await axios.post(ft.FT_BASE_URL+ '/userDelete', ftReq, ft.AXIOS_FT_CONFIG)
           return respPromise
+      },
+      filterRows(row, filter) {
+        let show = false
+        for(let i=0; i < filter.prop.length; i++){
+          let name = filter.prop[i]
+          let val = row[name]
+          if(val !== null && val !== undefined) {
+            val = (''+val).toLowerCase()
+            if(val.indexOf(filter.value) != -1) {
+              show = true
+              break
+            }
+          }
+        }
+        if(!show) {
+          if(this.searchRoleNames(filter.value, row.roles)) {
+            show = true
+          }
+          else {
+            show = this.searchRoleNames(filter.value, row.adminRoles)
+          }
+        }
+        return show
+      },
+      searchRoleNames(val, roles) {
+        if(roles == null || roles == undefined) {
+          return false
+        }
+        for(let i=0; i < roles.length; i++) {
+          let rname = roles[i].name.toLowerCase()
+          if(rname.indexOf(val) != -1) {
+            return true
+          }
+        }
+        return false
       }
     },
     components: {


Mime
View raw message