You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2017/09/20 20:39:23 UTC
[whimsy] branch master updated: Refactor and provide indication of
unsupported URLs
This is an automated email from the ASF dual-hosted git repository.
curcuru 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 59860a7 Refactor and provide indication of unsupported URLs
59860a7 is described below
commit 59860a71d9b50fbeb699f60a74dd48805b2a3815
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Wed Sep 20 16:39:18 2017 -0400
Refactor and provide indication of unsupported URLs
---
www/site.cgi | 124 +++++++++++++++++++++++++++++++++++------------------------
1 file changed, 74 insertions(+), 50 deletions(-)
diff --git a/www/site.cgi b/www/site.cgi
index 3e09dce..a1f62bf 100755
--- a/www/site.cgi
+++ b/www/site.cgi
@@ -116,6 +116,74 @@ def label(analysis, links, col, name)
end
end
+def displayProject(project, links, cols, analysis)
+ _whimsy_panel_table(
+ title: "Site Check For Project - #{links['display_name']}",
+ helpblock: -> {
+ _a href: '../', aria_label: 'Home to site checker' do
+ _span.glyphicon.glyphicon_home :aria_hidden
+ end
+ _span.glyphicon.glyphicon_menu_right
+ _ ' Results for project: '
+ _a links['display_name'], href: links['uri']
+ _ ' Check Results column is the actual text found on the project homepage for this check.'
+ }
+ ) do
+ _table.table.table_striped do
+ _tbody do
+ _thead do
+ _tr do
+ _th! 'Check Type'
+ _th! 'Check Results'
+ _th! 'Check Description'
+ end
+ end
+ cols.each do |col|
+ cls = label(analysis, links, col, project)
+ _tr do
+ _td do
+ _a col.capitalize, href: "../check/#{col}"
+ end
+
+ if links[col] =~ /^https?:/
+ _td class: cls do
+ _a links[col], href: links[col]
+ end
+ else
+ _td links[col], class: cls
+ end
+
+ _td do
+ if cls == 'label-warning'
+ _ 'Expected to match the regular expression: '
+ _code CHECKS[col].source
+ _ ''
+ else
+ _ ''
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+def displayError(path)
+ _whimsy_panel_table(
+ title: "ERROR",
+ helpblock: -> {
+ _a href: '../', aria_label: 'Home to site checker' do
+ _span.glyphicon.glyphicon_home :aria_hidden
+ end
+ _span.glyphicon.glyphicon_menu_right
+ _span.text_danger "ERROR: The path #{path} is not a recognized command for this tool, sorry! "
+ }
+ ) do
+ _p.bold 'ERROR - please try again.'
+ end
+end
+
_html do
_head do
_style %{
@@ -154,56 +222,10 @@ _html do
if path_info =~ %r{/project/(.+)}
# details for an individual project
project = $1
- links = sites[project]
- _whimsy_panel_table(
- title: "Site Check For Project - #{links['display_name']}",
- helpblock: -> {
- _a href: '../', aria_label: 'Home to site checker' do
- _span.glyphicon.glyphicon_home :aria_hidden
- end
- _span.glyphicon.glyphicon_menu_right
- _ ' Results for project: '
- _a links['display_name'], href: links['uri']
- _ ' Check Results column is the actual text found on the project homepage for this check.'
- }
- ) do
- _table.table.table_striped do
- _tbody do
- _thead do
- _tr do
- _th! 'Check Type'
- _th! 'Check Results'
- _th! 'Check Description'
- end
- end
- cols.each do |col|
- cls = label(analysis, links, col, project)
- _tr do
- _td do
- _a col.capitalize, href: "../check/#{col}"
- end
-
- if links[col] =~ /^https?:/
- _td class: cls do
- _a links[col], href: links[col]
- end
- else
- _td links[col], class: cls
- end
-
- _td do
- if cls == 'label-warning'
- _ 'Expected to match the regular expression: '
- _code CHECKS[col].source
- _ ''
- else
- _ ''
- end
- end
- end
- end
- end
- end
+ if sites[project]
+ displayProject(project, sites[project], cols, analysis)
+ else
+ displayError(path_info)
end
elsif path_info =~ %r{/check/(.+)}
# details for a single check
@@ -222,6 +244,8 @@ _html do
_ ' '
_a DOCS[col][1], href: DOCS[col][0]
end
+ else
+ _span.text_danger "WARNING: the site checker may not understand type: #{col}, results may not be complete/available."
end
}
) do
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].