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: wire up podlingnamesearch
Date Sat, 03 Jun 2017 02:49:07 GMT
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  6752628   wire up podlingnamesearch
6752628 is described below

commit 6752628340f330303089fd7521724381f653ca97
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Fri Jun 2 22:46:20 2017 -0400

    wire up podlingnamesearch
---
 www/board/agenda/public/stylesheets/app.css |  7 ++++
 www/board/agenda/routes.rb                  |  7 ++--
 www/board/agenda/views/app.js.rb            |  1 +
 www/board/agenda/views/elements/pns.rb      | 51 +++++++++++++++++++++++++++++
 www/board/agenda/views/layout/header.js.rb  |  4 +++
 5 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/public/stylesheets/app.css b/www/board/agenda/public/stylesheets/app.css
index 570f502..87dfb44 100644
--- a/www/board/agenda/public/stylesheets/app.css
+++ b/www/board/agenda/public/stylesheets/app.css
@@ -499,3 +499,10 @@ input[type=file]#upload {
 #post-report-text {
   font-family: monospace
 }
+
+/* podling name search */
+.pns {
+  float: left;
+  font-size: 24px;
+  padding-top: 5px;
+}
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 96a1ff8..945355e 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -187,7 +187,7 @@ end
 get '/json/podlingnamesearch' do
 
   query = 'https://issues.apache.org/jira/rest/api/2/search?' +
-    'jql=project=PODLINGNAMESEARCH&fields=summary'
+    'jql=project=PODLINGNAMESEARCH&fields=summary,resolution'
 
   issues = JSON.parse(Net::HTTP.get URI(query))['issues']
 
@@ -197,7 +197,10 @@ get '/json/podlingnamesearch' do
     name ||= title[/'Apache ([A-Z].*?)'/, 1]
     name ||= title[/.*Apache ([A-Z]\S*)/, 1]
     name ||= title.gsub('Apache', '')[/.*\b([A-Z]\S*)/, 1]
-    [name, {link: issue['self']}] if name
+    next unless name
+    resolution = issue['fields']['resolution']
+    resolution = resolution ? resolution['name'] : 'Unresolved'
+    [name, {issue: issue['key'], resolution: resolution}]
   end
 
   _json issues.compact.sort.to_h
diff --git a/www/board/agenda/views/app.js.rb b/www/board/agenda/views/app.js.rb
index def71e6..1366739 100644
--- a/www/board/agenda/views/app.js.rb
+++ b/www/board/agenda/views/app.js.rb
@@ -52,6 +52,7 @@ require_relative 'elements/link'
 require_relative 'elements/modal-dialog'
 require_relative 'elements/text'
 require_relative 'elements/info'
+require_relative 'elements/pns'
 
 # Model
 require_relative 'models/events'
diff --git a/www/board/agenda/views/elements/pns.rb b/www/board/agenda/views/elements/pns.rb
new file mode 100644
index 0000000..881fc90
--- /dev/null
+++ b/www/board/agenda/views/elements/pns.rb
@@ -0,0 +1,51 @@
+#
+# Determine status of podling name
+#
+
+class PodlingNameSearch < React
+  def render
+    _span.pns title: 'podling name search' do
+      if Server.podlingnamesearch
+        if not @results
+          _span "\u2718"
+        elsif @results.resolution == 'Fixed'
+          _a "\u2714", href: 'https://issues.apache.org/jira/browse/' +
+            @results.issue
+        else
+          _a "\uFE56", href: 'https://issues.apache.org/jira/browse/' +
+            @results.issue
+        end
+      end
+    end
+  end
+
+  # initial mount: fetch podlingnamesearch data unless already downloaded
+  def componentDidMount()
+    if Server.podlingnamesearch
+      self.check(self.props)
+    else
+      retrieve 'podlingnamesearch', :json do |results|
+        Server.podlingnamesearch = results
+        self.check(self.props)
+      end
+    end
+  end
+
+  # when properties (in particular: title) changes, lookup name again
+  def componentWillReceiveProps(newprops)
+    self.check(newprops)
+  end
+
+  # lookup name in the establish resolution against the podlingnamesearches
+  def check(props)
+    @results = nil
+    name = props.item.title[/Establish (.*)/, 1]
+    if name and Server.podlingnamesearch
+      for podling in Server.podlingnamesearch
+        if name == podling
+          @results = Server.podlingnamesearch[name]
+        end
+      end
+    end
+  end
+end
diff --git a/www/board/agenda/views/layout/header.js.rb b/www/board/agenda/views/layout/header.js.rb
index b5a882d..a3408fa 100644
--- a/www/board/agenda/views/layout/header.js.rb
+++ b/www/board/agenda/views/layout/header.js.rb
@@ -14,6 +14,10 @@ class Header < React
     _header.navbar.navbar_fixed_top class: @@item.color do
       _div.navbar_brand @@item.title
 
+      if @@item.attach =~ /^7/ and @@item.title =~ /^Establish /
+        _PodlingNameSearch item: @@item
+      end
+
       _span.clock! "\u231B" if clock_counter > 0
 
       _ul.nav.nav_pills.navbar_right do

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

Mime
View raw message