whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: rough in podlings list
Date Mon, 02 Jan 2017 19:19:47 GMT
This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/master by this push:
       new  1918af2   rough in podlings list
1918af2 is described below

commit 1918af22d07dd4dd35e07fc20aad98c34c49293a
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Jan 2 14:19:14 2017 -0500

    rough in podlings list
---
 lib/whimsy/asf/ldap.rb                   |  26 +++++--
 lib/whimsy/asf/podlings.rb               |   5 ++
 www/roster/main.rb                       |  21 +++++-
 www/roster/models.rb                     |   1 +
 www/roster/models/ppmc.rb                |  20 +++++
 www/roster/views/app.js.rb               |   3 +
 www/roster/views/committees.html.rb      |   4 +-
 www/roster/views/index.html.rb           |  11 ++-
 www/roster/views/ppmc.html.rb            |  22 ++++++
 www/roster/views/ppmc/.members.js.rb.swp | Bin 0 -> 12288 bytes
 www/roster/views/ppmc/main.js.rb         |  47 ++++++++++++
 www/roster/views/ppmc/members.js.rb      | 122 +++++++++++++++++++++++++++++++
 www/roster/views/ppmcs.html.rb           |  42 +++++++++++
 13 files changed, 312 insertions(+), 12 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 41bb1a5..a2ad810 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -39,15 +39,13 @@ module ASF
   module LDAP
      # https://www.pingmybox.com/dashboard?location=304
      # https://github.com/apache/infrastructure-puppet/blob/deployment/data/common.yaml (ldapserver::slapd_peers)
-     # Updated 2016-04-11 
+     # Updated 2017-01-02 
     HOSTS = %w(
-      ldaps://devops.apache.org:636
-      ldaps://ldap1-lw-eu.apache.org:636
+      ldaps://themis.apache.org:636
       ldaps://ldap1-lw-us.apache.org:636
-      ldaps://ldap2-lw-eu.apache.org:636
-      ldaps://ldap2-lw-us.apache.org:636
+      ldaps://ldap1-lw-eu.apache.org:636
+      ldaps://devops.apache.org:636
       ldaps://snappy5.apache.org:636
-      ldaps://themis.apache.org:636
     )
 
     CONNECT_LOCK = Mutex.new
@@ -693,6 +691,22 @@ module ASF
     end
   end
 
+  class Project < Base
+    @base = 'ou=project,ou=groups,dc=apache,dc=org'
+
+    def self.list(filter='cn=*')
+      ASF.search_one(base, filter, 'cn').flatten
+    end
+
+    def members
+      members = weakref(:members) do
+        ASF.search_one(base, "cn=#{name}", 'member').flatten
+      end
+
+      members.map {|uid| Person.find uid[/uid=(.*?),/,1]}
+    end
+  end
+
   class Committee < Base
     @base = 'ou=pmc,ou=committees,ou=groups,dc=apache,dc=org'
 
diff --git a/lib/whimsy/asf/podlings.rb b/lib/whimsy/asf/podlings.rb
index 0dc5270..4c383b0 100644
--- a/lib/whimsy/asf/podlings.rb
+++ b/lib/whimsy/asf/podlings.rb
@@ -142,6 +142,11 @@ module ASF
       return self.send name if self.respond_to? name
     end
 
+    # list of PPMC members
+    def members
+      ASF::Project.find(id).members
+    end
+
     # development mailing list associated with a given podling
     def dev_mail_list
       case name
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 8fd0013..4d8100d 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -119,7 +119,26 @@ get '/members.json' do
   _json Hash[ASF.members.map {|person| [person.id, person.public_name]}.sort]
 end
 
-# member list
+# active podling list
+get '/ppmc/' do
+  @projects = ASF::Project.list
+  @ppmcs = ASF::Podling.list.select {|podling| podling.status == 'current'}
+  _html :ppmcs
+end
+
+# individual podling info
+get '/ppmc/:name.json' do |name|
+  _json PPMC.serialize(name)
+end
+
+get '/ppmc/:name' do |name|
+  @ppmc = PPMC.serialize(name)
+  pass unless @ppmc
+  _html :ppmc
+end
+
+
+# complete podling list
 get '/podlings' do
   attic = ASF::SVN['asf/attic/site/xdocs/projects']
   @attic = Dir["#{attic}/*.xml"].map {|file| File.basename(file, '.xml')}
diff --git a/www/roster/models.rb b/www/roster/models.rb
index e497682..ee790f5 100644
--- a/www/roster/models.rb
+++ b/www/roster/models.rb
@@ -4,6 +4,7 @@ require_relative 'models/committer'
 require_relative 'models/committee'
 require_relative 'models/group'
 require_relative 'models/orgchart'
+require_relative 'models/ppmc'
 
 require_relative 'models/ldap'
 require_relative 'models/svn'
diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
new file mode 100644
index 0000000..7b8fd8c
--- /dev/null
+++ b/www/roster/models/ppmc.rb
@@ -0,0 +1,20 @@
+class PPMC
+  def self.serialize(id)
+    response = {}
+
+    ppmc = ASF::Podling.find(id)
+
+    response = {
+      id: id,
+      display_name: ppmc.display_name,
+      description: ppmc.description,
+      schedule: ppmc.reporting,
+      established: ppmc.startdate,
+      roster: ppmc.members.map {|person|
+        [person.id, {name: person.public_name}]
+      }.to_h,
+    }
+
+    response
+  end
+end
diff --git a/www/roster/views/app.js.rb b/www/roster/views/app.js.rb
index 59ae46e..5227136 100644
--- a/www/roster/views/app.js.rb
+++ b/www/roster/views/app.js.rb
@@ -17,6 +17,9 @@ require_relative 'person/memtext'
 require_relative 'person/forms'
 require_relative 'person/sascore'
 
+require_relative 'ppmc/main'
+require_relative 'ppmc/members'
+
 require_relative 'committerSearch'
 
 require_relative 'group'
diff --git a/www/roster/views/committees.html.rb b/www/roster/views/committees.html.rb
index 90ce446..2145de2 100644
--- a/www/roster/views/committees.html.rb
+++ b/www/roster/views/committees.html.rb
@@ -19,7 +19,7 @@ _html do
       _tr do
         _th 'Name'
         _th 'Chair(s)'
-        _th 'Notes'
+        _th 'Description'
       end
     end
 
@@ -44,7 +44,7 @@ _html do
         if not pmc.established
           _td.issue 'Not in committee-info.txt'
         else
-          _td
+          _td pmc.description
         end
       end
     end
diff --git a/www/roster/views/index.html.rb b/www/roster/views/index.html.rb
index 373ce61..38346f5 100644
--- a/www/roster/views/index.html.rb
+++ b/www/roster/views/index.html.rb
@@ -61,14 +61,19 @@ _html do
     _tr do
       _td do
         _a @podlings.select {|podling| podling.status == 'current'}.length,
-          href: 'podlings'
+          href: 'ppmc/'
       end
 
       _td do
-        _a 'Podlings', href: 'podlings'
+        _a 'Podlings', href: 'ppmc/'
+      end
+
+      _td! do 
+        _span 'Active podlings at the ASF ('
+        _a @podlings.length, href: 'podlings'
+        _span ' total)'
       end
 
-      _td 'Active podlings at the ASF'
     end
 
     ### Groups
diff --git a/www/roster/views/ppmc.html.rb b/www/roster/views/ppmc.html.rb
new file mode 100644
index 0000000..f7530e6
--- /dev/null
+++ b/www/roster/views/ppmc.html.rb
@@ -0,0 +1,22 @@
+#
+# A single Podling PMC
+#
+
+_html do
+  _base href: '..'
+  _title @ppmc[:display_name]
+  _link rel: 'stylesheet', href: 'stylesheets/app.css'
+
+  _banner breadcrumbs: {
+    roster: '.',
+    ppmc: 'ppmc/',
+    @ppmc[:id] => "/committere/#{@ppmc[:id]}"
+  }
+
+  _div_.main!
+
+  _script src: 'app.js'
+  _.render '#main' do
+    _PPMC ppmc: @ppmc, auth: @auth
+  end
+end
diff --git a/www/roster/views/ppmc/.members.js.rb.swp b/www/roster/views/ppmc/.members.js.rb.swp
new file mode 100644
index 0000000..1e01bfa
Binary files /dev/null and b/www/roster/views/ppmc/.members.js.rb.swp differ
diff --git a/www/roster/views/ppmc/main.js.rb b/www/roster/views/ppmc/main.js.rb
new file mode 100644
index 0000000..f5bba47
--- /dev/null
+++ b/www/roster/views/ppmc/main.js.rb
@@ -0,0 +1,47 @@
+#
+# Show a PPMC
+#
+
+class PPMC < React
+  def render
+    auth = @@auth and (@@auth.secretary or @@auth.root)
+
+    # header
+    _h1 do
+      _a @ppmc.display_name, href: @ppmc.site
+    end
+
+    _p @ppmc.description
+
+    # usage information for authenticated users (PMC chair, etc.)
+    if auth
+      _div.alert.alert_success do
+        _span 'Double click on a row to edit.'
+        unless @ppmc.roster.keys().empty?
+          _span "  Double click on \u2795 to add."
+        end
+      end
+    end
+
+    # main content
+    _PPMCMembers auth: auth, ppmc: @ppmc
+
+    # hidden form
+    # _PPMCConfirm pmc: @ppmc.id, update: self.update if auth
+  end
+
+  # capture ppmc on initial load
+  def componentWillMount()
+    self.update(@@ppmc)
+  end
+
+  # capture ppmc on subsequent loads
+  def componentWillReceiveProps()
+    self.update(@@ppmc)
+  end
+
+  # update ppmc from conformation form
+  def update(ppmc)
+    @ppmc = ppmc
+  end
+end
diff --git a/www/roster/views/ppmc/members.js.rb b/www/roster/views/ppmc/members.js.rb
new file mode 100644
index 0000000..8abf671
--- /dev/null
+++ b/www/roster/views/ppmc/members.js.rb
@@ -0,0 +1,122 @@
+#
+# Show PPMC members
+#
+
+class PPMCMembers < React
+  def initialize
+    @ppmc = {}
+    @state = :closed
+  end
+
+  def render
+    _h2.pmc! 'PPMC'
+    _table.table.table_hover do
+      _thead do
+        _tr do
+          _th 'id'
+          _th 'public name'
+        end
+      end
+
+      _tbody do
+        @roster.each do |person|
+          _PPMCMember auth: @@auth, person: person, ppmc: @@ppmc
+        end
+
+        if @@auth and not @@ppmc.roster.keys().empty?
+          _tr onDoubleClick: self.select do
+            _td((@state == :open ? '' : "\u2795"), colspan: 4)
+          end
+        end
+      end
+    end
+
+   if @state == :open
+     _div.search_box do
+       _CommitterSearch add: self.add
+     end
+   end
+  end
+
+  # update props on initial load
+  def componentWillMount()
+    self.componentWillReceiveProps()
+  end
+
+  # compute roster
+  def componentWillReceiveProps()
+    roster = []
+    
+    for id in @@ppmc.roster
+      person = @@ppmc.roster[id]
+      person.id = id
+      roster << person
+    end
+
+    for id in @@ppmc.ldap
+      person = @@ppmc.roster[id]
+      if person
+        person.ldap = true
+      else
+        roster << {id: id, name: @@ppmc.ldap[id], ldap: true}
+      end
+    end
+
+    @roster = roster.sort_by {|person| person.name}
+  end
+
+  # open search box
+  def select()
+    return unless @@auth
+    window.getSelection().removeAllRanges()
+    @state = ( @state == :open ? :closed : :open )
+  end
+
+  # add a person to the displayed list of PMC members
+  def add(person)
+    person.date = 'pending'
+    @roster << person
+    @state = :closed
+  end
+end
+
+#
+# Show a member of the PMC
+#
+
+class PPMCMember < React
+  def initialize
+    @state = :closed
+  end
+
+  def render
+    _tr onDoubleClick: self.select do
+
+      if false # @@ppmc.asfmembers.include? @@person.id
+        _td { _b @@person.name }
+        _td { _b { _a @@person.id, href: "committer/#{@@person.id}" } }
+      else
+        _td { _a @@person.id, href: "committer/#{@@person.id}" }
+        _td @@person.name
+      end
+    end
+  end
+
+  # update props on initial load
+  def componentWillMount()
+    self.componentWillReceiveProps()
+  end
+
+  # automatically open pending entries
+  def componentWillReceiveProps(newprops)
+    @state = :closed if @ppmc and newprops.ppmc.id != @ppmc.id
+    @state = :open if @@person.date == 'pending'
+  end
+
+  # toggle display of buttons
+  def select()
+    return unless @@auth
+    window.getSelection().removeAllRanges()
+    @state = ( @state == :open ? :closed : :open )
+  end
+end
diff --git a/www/roster/views/ppmcs.html.rb b/www/roster/views/ppmcs.html.rb
new file mode 100644
index 0000000..9666353
--- /dev/null
+++ b/www/roster/views/ppmcs.html.rb
@@ -0,0 +1,42 @@
+#
+# List of committees
+#
+
+_html do
+  _base href: '..'
+  _title 'ASF Podling PMC Roster'
+  _link rel: 'stylesheet', href: 'stylesheets/app.css'
+
+  _banner breadcrumbs: {
+    roster: '.',
+    ppmc: 'ppmc/'
+  }
+
+  _h1 'Podling Project Management Committees (PPMCs)'
+
+  _table.table.table_hover do
+    _thead do
+      _tr do
+        _th 'Name'
+        _th 'Established'
+        _th 'Description'
+      end
+    end
+
+    @ppmcs.sort_by {|ppmc| ppmc.display_name.downcase}.each do |ppmc|
+      _tr_ do
+        _td do
+          if @projects.include? ppmc.name
+            _a ppmc.display_name, href: "ppmc/#{ppmc.name}"
+          else
+            _span ppmc.display_name
+          end
+        end
+
+        _td ppmc.startdate
+
+        _td ppmc.description
+      end
+    end
+  end
+end

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

Mime
View raw message