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 2018/04/04 17:31:17 UTC
[whimsy] branch master updated: support posting of out of cycle
reports
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 417228f support posting of out of cycle reports
417228f is described below
commit 417228f6cd84d4d8d079977073b8c375f3a562be
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Apr 4 13:30:38 2018 -0400
support posting of out of cycle reports
---
lib/whimsy/asf/committee.rb | 2 +-
lib/whimsy/asf/ldap.rb | 2 +-
www/board/agenda/views/actions/post.json.rb | 36 +++++++++++++++--
www/board/agenda/views/buttons/post.js.rb | 60 ++++++++++++++++++++++++++++-
4 files changed, 93 insertions(+), 7 deletions(-)
diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index 106602e..5c8afa1 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -431,7 +431,7 @@ module ASF
# a number of aliases for a given committee. Will set display name
# if the name being searched on contains an uppercase character.
def self.find(name)
- result = super(@@namemap.call(name))
+ result = super(@@namemap.call(name.downcase))
result.display_name = name if name =~ /[A-Z]/
result
end
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index a277fd7..81a667d 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -1303,7 +1303,7 @@ module ASF
if GUINEAPIGS.include? name
@dn ||= ASF::Project.find(name).dn
else
- @dn ||= ASF.search_one(base, "cn=#{name}", 'dn').first.first
+ @dn ||= ASF.search_one(base, "cn=#{name}", 'dn').first.first rescue nil
end
end
diff --git a/www/board/agenda/views/actions/post.json.rb b/www/board/agenda/views/actions/post.json.rb
index 2a32985..2849590 100644
--- a/www/board/agenda/views/actions/post.json.rb
+++ b/www/board/agenda/views/actions/post.json.rb
@@ -32,11 +32,41 @@ Agenda.update(@agenda, @message) do |agenda|
select {|attach| attach =~ /^7\w/}.length.times {order.succ!}
title = " #{order}. #{@title}\n\n"
- # insert into agenda
- agenda[/\n() 8\. Discussion Items/, 1] = "#{title}#{@report}\n\n"
-
# update the commit message that will be used
@message.sub! "7X", "7#{order}"
+
+ elsif @attach.start_with? '+'
+ pmc_reports = parsed.select {|section| section[:attach] =~ /^[A-Z]/}
+ attach = pmc_reports.last[:attach].succ
+ pmc = ASF::Committee.find(@attach[1..-1])
+ unless pmc.dn
+ raise Exception.new("#{@attach[1..-1].inspect} PMC not found")
+ end
+
+ # select shepherd
+ shepherds = pmc_reports.map {|section| section['shepherd']}.
+ select {|shepherd| not shepherd.include? ' '}.
+ group_by {|n| n}.map {|n, list| [n, list.length]}
+ min = shepherds.map {|name, count| count}.min
+ shepherd = shepherds.select {|name, count| count == min}.sample.first
+
+ # insert section into committee-reports
+ agenda[/\n() 7\. Special Orders/, 1] =
+ " #{attach}. Apache #{pmc.display_name} Project " +
+ "[#{pmc.chair.public_name} / #{shepherd}]\n\n" +
+ " See Attachment #{attach}\n\n" +
+ " [ #{pmc.display_name}.\n" +
+ " approved:\n" +
+ " comments:\n" +
+ " ]\n\n"
+
+ # insert report text as an attachment
+ agenda[/^()-+\nEnd of agenda/, 1] =
+ "-----------------------------------------\n" +
+ "Attachment #{attach}: Report from the Apache #{pmc.display_name} " +
+ "Project [#{pmc.chair.public_name}]\n" +
+ "#{@report.strip}\n\n"
+
else
item = parsed.find {|item| item[:attach]==@attach}
diff --git a/www/board/agenda/views/buttons/post.js.rb b/www/board/agenda/views/buttons/post.js.rb
index 3c224ea..9471ea1 100644
--- a/www/board/agenda/views/buttons/post.js.rb
+++ b/www/board/agenda/views/buttons/post.js.rb
@@ -43,7 +43,8 @@ class Post < Vue
end
_li do
- _button.btn.btn_primary 'Out of Cycle Report', disabled: true
+ _button.btn.btn_primary 'Out of Cycle Report', onClick: selectItem
+ _span '- report from a PMC not currently on the agenda for this month'
end
_li do
@@ -86,6 +87,20 @@ class Post < Vue
_button.btn_primary 'Draft', disabled: @disabled,
onClick: draft_chair_change_resolution
+ elsif @button == 'Out of Cycle Report'
+ _h4 'Out of Cycle PMC Report'
+
+ _div.form_group do
+ _label 'PMC', for: 'out-of-cycle-pmc'
+ _select.form_control.out_of_cycle_pmc! do
+ @pmcs.each {|pmc| _option pmc}
+ end
+ end
+
+ _button.btn_default 'Cancel', data_dismiss: 'modal', disabled: @disabled
+ _button.btn_primary 'Draft', disabled: @pmcs.empty?,
+ onClick: draft_out_of_cycle_report
+
else
_h4 @header
@@ -134,6 +149,8 @@ class Post < Vue
if @button == 'Change Chair'
initialize_chair_change()
+ elsif @button == 'Out of Cycle Report'
+ initialize_out_of_cycle()
end
retitle()
@@ -353,7 +370,7 @@ class Post < Vue
else
data = {
agenda: Agenda.file,
- attach: @@item.attach,
+ attach: @attach || @@item.attach,
digest: @digest,
message: @message,
report: @report
@@ -364,6 +381,7 @@ class Post < Vue
post 'post', data do |response|
jQuery('#post-report-form').modal(:hide)
document.body.classList.remove('modal-open')
+ @attach = nil
@disabled = false
Agenda.load response.agenda, response.digest
end
@@ -398,6 +416,43 @@ class Post < Vue
end
#########################################################################
+ # Out of Cycle report #
+ #########################################################################
+
+ def initialize_out_of_cycle()
+ @disabled = true
+
+ # gather a list of reports already on the agenda
+ scheduled = {}
+ Agenda.index.each do |item|
+ if item.attach =~ /^[A-Z]/
+ scheduled[item.title.downcase] = true
+ end
+ end
+
+ # get a list of PMCs and select ones that aren't on the agenda
+ @pmcs = []
+ post 'post-data', request: 'committee-list' do |response|
+ response.each do |pmc|
+ @pmcs << pmc unless scheduled[pmc]
+ end
+ end
+ end
+
+ def draft_out_of_cycle_report()
+ pmc = document.getElementById('out-of-cycle-pmc').value.
+ gsub(/\b[a-z]/) {|s| s.upcase()}
+ @button = 'post report'
+ @disabled = true
+ @report = ''
+ @header = 'Post Report'
+ @label = 'report'
+ @message = "Post Out of Cycle #{pmc} Report"
+ @attach = '+' + pmc
+ @disabled = false
+ end
+
+ #########################################################################
# Change Project Chair #
#########################################################################
@@ -435,6 +490,7 @@ class Post < Vue
@button = @header = 'Add Resolution'
@title = response.title
@report = response.draft
+ @label = 'resolution'
@disabled = false
end
end
--
To stop receiving notification emails like this one, please contact
rubys@apache.org.