You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/07/12 22:42:56 UTC

[whimsy] branch master updated: rough in search

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

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 05f53de  rough in search
05f53de is described below

commit 05f53de2868e904edbc8e4898916d680ea936385
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Jul 12 18:42:41 2017 -0400

    rough in search
---
 www/roster/models/committee.rb        | 18 +++++++++++-
 www/roster/views/app.js.rb            |  1 +
 www/roster/views/pmc/committers.js.rb |  4 +--
 www/roster/views/pmc/main.js.rb       | 23 ++++++++++++----
 www/roster/views/pmc/pmc.js.rb        | 15 +++-------
 www/roster/views/pmc/roster.js.rb     | 52 +++++++++++++++++++++++++++++++++++
 6 files changed, 94 insertions(+), 19 deletions(-)

diff --git a/www/roster/models/committee.rb b/www/roster/models/committee.rb
index e3c1a1f..3a59c12 100644
--- a/www/roster/models/committee.rb
+++ b/www/roster/models/committee.rb
@@ -29,6 +29,21 @@ class Committee
       lists = lists.select {|list, mode| mode == 'public'}
     end
 
+    roster = pmc.roster.dup
+    roster.each {|key, info| info['role'] = 'PMC member'}
+
+    members.each do |person|
+      roster[person.id] ||= {name: person.public_name, role: 'PMC member'}
+      roster[person.id]['ldap'] = true
+    end
+
+    committers.each do |person|
+      roster[person.id] ||= {name: person.public_name}
+      roster[person.id]['role'] ||= 'Committer'
+    end
+
+    roster[pmc.chair.id]['role'] = 'PMC chair' if pmc.chair
+
     response = {
       id: id,
       chair: pmc.chair && pmc.chair.id,
@@ -39,9 +54,10 @@ class Committee
       site: pmc.site,
       established: pmc.established,
       ldap: Hash[members.map {|person| [person.id, person.cn]}],
+      members: pmc.roster.keys,
       committers: Hash[committers.map {|person| [person.id, person.cn]}],
       asfmembers: (ASF.members & people).map(&:id),
-      roster: pmc.roster,
+      roster: roster,
       mail: Hash[lists.sort],
       moderators: moderators,
       modtime: modtime,
diff --git a/www/roster/views/app.js.rb b/www/roster/views/app.js.rb
index 6740b00..ca21f99 100644
--- a/www/roster/views/app.js.rb
+++ b/www/roster/views/app.js.rb
@@ -3,6 +3,7 @@ require_relative 'polyfill'
 require_relative 'pmc/main'
 require_relative 'pmc/pmc'
 require_relative 'pmc/committers'
+require_relative 'pmc/roster'
 
 require_relative 'person'
 require_relative 'person/fullname'
diff --git a/www/roster/views/pmc/committers.js.rb b/www/roster/views/pmc/committers.js.rb
index 280f4d6..d073915 100644
--- a/www/roster/views/pmc/committers.js.rb
+++ b/www/roster/views/pmc/committers.js.rb
@@ -6,7 +6,7 @@ class PMCCommitters < React
   def render
     if
       @@committee.committers.keys().all? do |id|
-        @@committee.roster[id] or @@committee.ldap[id]
+        @@committee.roster[id] or @@committee.members.include? id
       end
     then
       _p 'All committers are members of the PMC'
@@ -26,7 +26,7 @@ class PMCCommitters < React
 
         _tbody do
           @committers.each do |person|
-            next if @@committee.roster[person.id]
+            next if @@committee.members.include? person.id
             next if @@committee.ldap[person.id]
             _PMCCommitter auth: @@auth, person: person, committee: @@committee
           end
diff --git a/www/roster/views/pmc/main.js.rb b/www/roster/views/pmc/main.js.rb
index 2f2bf48..a8d820f 100644
--- a/www/roster/views/pmc/main.js.rb
+++ b/www/roster/views/pmc/main.js.rb
@@ -10,7 +10,7 @@ class PMC < React
   def render
     if @committee.guinea_pig
       auth = (@@auth.secretary or @@auth.root or
-        @committee.ldap.keys().include? @@auth.id)
+        @committee.members.include? @@auth.id)
     else
       auth = (@@auth.id == @committee.chair or @@auth.secretary or @@auth.root)
     end
@@ -55,7 +55,7 @@ class PMC < React
     end
 
     # usage information for authenticated users (PMC chair, etc.)
-    if auth
+    if auth and not @search
       _div.alert.alert_success do
         _span 'Double click on a row to edit.'
         unless @committee.roster.keys().empty?
@@ -65,9 +65,22 @@ class PMC < React
       end
     end
 
+    _div.row key: 'databar' do
+      _div.col_sm_6 do
+      end
+      _div.col_sm_6 do
+        _input.form_control type: 'search', placeholder: 'search',
+          value: @search
+      end
+    end
+
     # main content
-    _PMCMembers auth: auth, committee: @committee
-    _PMCCommitters auth: auth, committee: @committee
+    if @search
+      _PMCRoster auth: auth, committee: @committee, search: @search
+    else
+      _PMCMembers auth: auth, committee: @committee
+      _PMCCommitters auth: auth, committee: @committee
+    end
 
     # mailing lists
     if @committee.moderators
@@ -121,7 +134,7 @@ class PMC < React
             _a 'Prior reports', href: 'https://whimsy.apache.org/board/minutes/' +
               @committee.display_name.gsub(/\s+/, '_')
           end
-          if @committee.ldap[@@auth.id] or @@auth.member
+          if @committee.members.include?(@@auth.id) or @@auth.member
             _li do
               _a 'Apache Committee Report Helper',
                 href: "https://reporter.apache.org/?#{@committee.id}"
diff --git a/www/roster/views/pmc/pmc.js.rb b/www/roster/views/pmc/pmc.js.rb
index 60e6e54..8e2edf0 100644
--- a/www/roster/views/pmc/pmc.js.rb
+++ b/www/roster/views/pmc/pmc.js.rb
@@ -49,17 +49,10 @@ class PMCMembers < React
     roster = []
     
     for id in @@committee.roster
-      person = @@committee.roster[id]
-      person.id = id
-      roster << person
-    end
-
-    for id in @@committee.ldap
-      person = @@committee.roster[id]
-      if person
-        person.ldap = true
-      else
-        roster << {id: id, name: @@committee.ldap[id], ldap: true}
+      if @@committee.members.include?(id) or @@committee.ldap[id]
+        person = @@committee.roster[id]
+        person.id = id
+        roster << person
       end
     end
 
diff --git a/www/roster/views/pmc/roster.js.rb b/www/roster/views/pmc/roster.js.rb
new file mode 100644
index 0000000..8f0daac
--- /dev/null
+++ b/www/roster/views/pmc/roster.js.rb
@@ -0,0 +1,52 @@
+#
+# Searchable PMC roster
+#
+
+class PMCRoster < React
+  def render
+    matches = []
+
+    search = @@search.downcase().strip().split(/\s+/)
+
+    for id in @@committee.roster do
+      person = @@committee.roster[id]
+
+      next unless search.all? {|term|
+        id.include? term or person.name.downcase().include? term
+      }
+
+      person.id = id
+      matches << person
+    end
+
+    matches = matches.sort_by {|person| person.name}
+
+    _table.table.table_hover do
+      _thead do
+        _tr do
+          _th 'id'
+          _th 'public name'
+        end
+      end
+
+      _tbody do
+        matches.each do |person|
+          _tr do
+            if @@committee.asfmembers.include? person.id
+              _td { _b { _a person.id, href: "committer/#{person.id}" } }
+              _td { _b person.name }
+            else
+              _td { _a person.id, href: "committer/#{person.id}" }
+              _td person.name
+            end
+            _td person.role
+          end
+        end
+      end
+    end
+
+    if matches.length == 0
+      _div.alert.alert_warning 'No matches'
+    end
+  end
+end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].