svn path=/trunk/mvcwrench/; revision=150614
This commit is contained in:
Jonathan Pobst 2010-02-01 03:33:31 +00:00
Родитель 3e2dc2b606
Коммит c324bc229b
11 изменённых файлов: 232 добавлений и 47 удалений

Просмотреть файл

@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using System.Web.Mvc;
using MvcWrench.MonkeyWrench.Public;
using System.Text;
namespace MvcWrench.Controllers
{
@ -34,12 +35,21 @@ namespace MvcWrench.Controllers
{
public ActionResult Index ()
{
List<BugzillaEntry> bugs = (List<BugzillaEntry>)Cache.Instance.Get ("buglist");
if (bugs == null) {
bugs = BugzillaInterface.GetLatestBugs ();
Cache.Instance.Add ("buglist", bugs, 3 * 60);
List<BugzillaEntry> bugs;
try {
bugs = (List<BugzillaEntry>)Cache.Instance.Get ("buglist");
if (bugs == null) {
bugs = BugzillaInterface.GetLatestBugs ();
//bugs = new List<BugzillaEntry> ();
Cache.Instance.Add ("buglist", bugs, 3 * 60);
}
} catch (Exception ex) {
bugs = new List<BugzillaEntry> ();
//throw;
}
Revision[] recent_revisions = (Revision[])Cache.Instance.Get ("recent_revisions");
@ -53,8 +63,37 @@ namespace MvcWrench.Controllers
}
}
ViewData["Revisions"] = recent_revisions;
string bugcounts = (string)Cache.Instance.Get ("bugcounts");
if (bugcounts == null) {
try {
MonkeyWrench.Public.Public ws = new MvcWrench.MonkeyWrench.Public.Public ();
string[] counts = ws.GetLatestBugCounts (7);
StringBuilder sb = new StringBuilder ();
foreach (string item in counts)
sb.AppendFormat ("{0},", (int)(int.Parse (item.Split (',')[0]) / 25f));
sb.Remove (sb.Length - 1, 1);
sb.Append ("|");
foreach (string item in counts)
sb.AppendFormat ("{0},", (int)(int.Parse (item.Split (',')[1]) / 25f));
sb.Remove (sb.Length - 1, 1);
bugcounts = sb.ToString ();
Cache.Instance.Add ("bugcounts", bugcounts, 60 * 60);
} catch (Exception) {
bugcounts = null;
}
}
ViewData["Revisions"] = recent_revisions;
ViewData["BugCounts"] = bugcounts;
return View ("Home", bugs);
}
}

Просмотреть файл

@ -26,8 +26,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Syndication;
using System.Net;
//using System.ServiceModel.Syndication;
using System.Xml;
namespace MvcWrench
@ -45,18 +45,20 @@ namespace MvcWrench
string url = @"https://bugzilla.novell.com/buglist.cgi?chfield=[Bug%20creation]&chfieldfrom=7d&chfieldto=Now&classification=Mono&product=Mono%20Tasks&product=Mono%3A%20Class%20Libraries%20&product=Mono%3A%20Compilers&product=Mono%3A%20Debugger&product=Mono%3A%20Doctools&product=Mono%3A%20Runtime&product=Mono%3A%20Tools&query_format=advanced&ctype=rss";
SyndicationFeed feed = null;
using (XmlTextReader r = new XmlTextReader (url))
feed = SyndicationFeed.Load (r);
IEnumerable<SyndicationItem> items = feed.Items.OrderByDescending (p => p.Id).Take (count);
XmlDocument doc = new XmlDocument ();
using (WebClient wc = new WebClient ()) {
string xml = wc.DownloadString (url);
doc.LoadXml (xml);
}
bugs = new List<BugzillaEntry> ();
foreach (var item in items)
foreach (XmlElement item in doc["feed"].GetElementsByTagName ("entry"))
bugs.Add (new BugzillaEntry (item));
bugs = bugs.OrderByDescending (p => p.Number).Take (count).ToList ();
cache.Add ("bugs", bugs, 10 * 60);
}
@ -80,15 +82,46 @@ namespace MvcWrench
{
}
public BugzillaEntry (SyndicationItem entry)
//public BugzillaEntry (SyndicationItem entry)
//{
// Url = entry.Id;
// Title = entry.Title.Text;
// Number = Url.Substring (Url.Length - 6);
// Date = entry.LastUpdatedTime;
// XmlDocument doc = new XmlDocument ();
// doc.LoadXml (entry.Summary.Text);
// Product = GetData (doc, "bz_feed_product");
// Component = GetData (doc, "bz_feed_component");
// Reporter = GetData (doc, "bz_feed_reporter");
// AssignedTo = GetData (doc, "bz_feed_assignee");
// string status = GetData (doc, "bz_feed_bug_status");
// switch (status.ToLowerInvariant ()) {
// case "new":
// case "assigned":
// Status = BugzillaStatus.New;
// break;
// case "reopened":
// Status = BugzillaStatus.Reopened;
// break;
// case "resolved":
// Status = BugzillaStatus.Resolved;
// break;
// }
//}
public BugzillaEntry (XmlElement xe)
{
Url = entry.Id;
Title = entry.Title.Text;
Url = xe["id"].InnerText;
Title = xe["title"].InnerText;
Number = Url.Substring (Url.Length - 6);
Date = entry.LastUpdatedTime;
Date = DateTimeOffset.Parse (xe["updated"].InnerText);
XmlDocument doc = new XmlDocument ();
doc.LoadXml (entry.Summary.Text);
doc.LoadXml (xe["summary"].InnerText);
Product = GetData (doc, "bz_feed_product");
Component = GetData (doc, "bz_feed_component");
@ -110,7 +143,7 @@ namespace MvcWrench
break;
}
}
private string GetData (XmlDocument doc, string type)
{
XmlElement xe = (XmlElement)doc.SelectSingleNode (string.Format ("//table/tr[@class = \"{0}\"]", type));

Двоичные данные
Media/bug_link.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 847 B

Просмотреть файл

@ -18,11 +18,17 @@ img
border: none;
}
a
a, a:visited
{
color: #000000;
text-decoration: none;
}
a:hover
{
text-decoration: underline
}
pre
{
font-size: 10pt;
@ -79,6 +85,11 @@ pre
color: #FFF;
}
#topmenu a:hover
{
text-decoration: none;
}
#topmenu a img
{
margin: 0px 7px 0px 0px;
@ -267,15 +278,9 @@ pre
background-repeat: no-repeat;
background-position: right;
padding-right: 15px;
text-decoration: none;
color: #454545;
}
.breadcrumb a:hover
{
text-decoration: underline;
}
.clearer
{
clear: both;
@ -314,11 +319,6 @@ pre
color: #000;
}
.statusstrip li a:hover
{
text-decoration: underline;
}
.statusstrip li.notrun a
{
color: #777;
@ -579,11 +579,6 @@ li.row-header { background-image: none; background-color: #FFFFFF; font-weight:
color: #000000;
}
.buglist table tr td a:hover
{
text-decoration: underline;
}
.buglist table tr td
{
font-size: 12px;
@ -608,9 +603,10 @@ li.row-header { background-image: none; background-color: #FFFFFF; font-weight:
text-align: center;
}
.bugtitle
.bugtitle, .bugtitle a
{
text-align: center;
font-size: 16px;
font-weight: bold;
}
color: #000000;
}

Просмотреть файл

@ -18,9 +18,9 @@
<td style="width: 150px"><%= item.Name %></td>
<td class="center-text"><%= item.Results %></td>
<td class="center-text wide"><%= item.ElapsedTime.ToHoursMinSec ()%></td>
<td class="center-text wide"><%= string.IsNullOrEmpty (item.LogUrl) ? "" : item.ElapsedTime.ToHoursMinSec ()%></td>
<% if (string.IsNullOrEmpty (item.LogUrl)) { %>
<td class="icon-column"><img src="<%= Html.ResolveUrl ("~/Media/report.png") %>" alt="View Log" title="View Log" /></td>
<td class="icon-column">&nbsp;</td>
<% } else { %>
<td class="icon-column"><a href="<%= item.LogUrl %>"><img src="<%= Html.ResolveUrl ("~/Media/report.png") %>" alt="View Log" title="View Log" /></a></td>
<% } %>

Просмотреть файл

@ -1,14 +1,24 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div class="bugchart">
Open Mono Bugs - Last 7 Days
<div class="bugtitle"><a href="http://www.mono-project.com/Bugs">Open Mono Bugs - Last 7 Days</a></div>
<img style="margin-top:10px;" src="http://chart.apis.google.com/chart?
chs=300x175
&amp;chd=t:77,73,71,78,74,69,65|21,19,16,13,18,18,12
&amp;chd=t:<%= (string)Model %>
&amp;cht=lc
&amp;chco=76A4FB,A5E368
&amp;chm=b,E9F2FF,0,1,0|B,E2EED7,1,2,0
&amp;chdl=Bugs|Bugs With Patches
&amp;chdlp=b"
alt="Open Mono Bugs - Last 7 Days" />
<table style="margin-left: 58px; margin-top: 10px;">
<tr>
<td><a href="http://mono-project.com/Bugs"><img src="Media/bug_link.png" alt="Bugzilla" /></a></td>
<td style="font-size: .85em;"><a href="http://mono-project.com/Bugs">Bugzilla</a></td>
<td style="font-size: .85em;"> | </td>
<td><a href="http://tinyurl.com/ydqpoyn"><img src="Media/bug_link.png" alt="Bugs with Patches" /></a></td>
<td style="font-size: .85em;"><a href="http://tinyurl.com/ydqpoyn"> Bugs with Patches</a></td>
</tr>
</table>
</div>

Просмотреть файл

@ -1,6 +1,6 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<MvcWrench.BugzillaEntry>>" %>
<div class="buglist">
<div class="bugtitle">Latest Reported Bugs</div>
<div class="bugtitle"><a href="http://www.mono-project.com/Bugs">Latest Reported Bugs</a></div>
<table cellspacing="5">
<% foreach (var item in Model) { %>
<tr>

Просмотреть файл

@ -11,7 +11,7 @@
<% Html.RenderPartial ("RecentRevisions", ViewData["Revisions"]); %>
</td>
<td>
<% Html.RenderPartial ("BugChart", Model); %>
<% if (!string.IsNullOrEmpty ((string)ViewData["BugCounts"])) Html.RenderPartial ("BugChart", (string)ViewData["BugCounts"]); %>
<% Html.RenderPartial ("BugList", Model); %>
</td>
</tr>

Просмотреть файл

@ -11,7 +11,7 @@
<div class="name"><%= item.Author %></div>
<div class="date"><%= item.Time.ToString () %></div>
</div>
<pre><%= item.SvnLog %></pre>
<pre><%= Html.Encode (item.SvnLog.TrimEnd ()) %></pre>
</div>
</div>
<% } %>

Просмотреть файл

@ -111,6 +111,25 @@
<s:element minOccurs="0" maxOccurs="1" name="FileDiff" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="GetLatestBugCounts">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="limit" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetLatestBugCountsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetLatestBugCountsResult" type="tns:ArrayOfString" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="GetRecentDataSoapIn">
@ -137,6 +156,12 @@
<wsdl:message name="GetProductLatestRevisionsSoapOut">
<wsdl:part name="parameters" element="tns:GetProductLatestRevisionsResponse" />
</wsdl:message>
<wsdl:message name="GetLatestBugCountsSoapIn">
<wsdl:part name="parameters" element="tns:GetLatestBugCounts" />
</wsdl:message>
<wsdl:message name="GetLatestBugCountsSoapOut">
<wsdl:part name="parameters" element="tns:GetLatestBugCountsResponse" />
</wsdl:message>
<wsdl:portType name="PublicSoap">
<wsdl:operation name="GetRecentData">
<wsdl:input message="tns:GetRecentDataSoapIn" />
@ -154,6 +179,10 @@
<wsdl:input message="tns:GetProductLatestRevisionsSoapIn" />
<wsdl:output message="tns:GetProductLatestRevisionsSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetLatestBugCounts">
<wsdl:input message="tns:GetLatestBugCountsSoapIn" />
<wsdl:output message="tns:GetLatestBugCountsSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PublicSoap" type="tns:PublicSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
@ -193,6 +222,15 @@
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetLatestBugCounts">
<soap:operation soapAction="http://tempuri.org/GetLatestBugCounts" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="PublicSoap12" type="tns:PublicSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
@ -232,6 +270,15 @@
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetLatestBugCounts">
<soap12:operation soapAction="http://tempuri.org/GetLatestBugCounts" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Public">
<wsdl:port name="PublicSoap" binding="tns:PublicSoap">

Просмотреть файл

@ -37,6 +37,8 @@ namespace MvcWrench.MonkeyWrench.Public {
private System.Threading.SendOrPostCallback GetProductLatestRevisionsOperationCompleted;
private System.Threading.SendOrPostCallback GetLatestBugCountsOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
@ -87,6 +89,9 @@ namespace MvcWrench.MonkeyWrench.Public {
/// <remarks/>
public event GetProductLatestRevisionsCompletedEventHandler GetProductLatestRevisionsCompleted;
/// <remarks/>
public event GetLatestBugCountsCompletedEventHandler GetLatestBugCountsCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetRecentData", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public BuildRevision[] GetRecentData(string product) {
@ -205,6 +210,35 @@ namespace MvcWrench.MonkeyWrench.Public {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetLatestBugCounts", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string[] GetLatestBugCounts(int limit) {
object[] results = this.Invoke("GetLatestBugCounts", new object[] {
limit});
return ((string[])(results[0]));
}
/// <remarks/>
public void GetLatestBugCountsAsync(int limit) {
this.GetLatestBugCountsAsync(limit, null);
}
/// <remarks/>
public void GetLatestBugCountsAsync(int limit, object userState) {
if ((this.GetLatestBugCountsOperationCompleted == null)) {
this.GetLatestBugCountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetLatestBugCountsOperationCompleted);
}
this.InvokeAsync("GetLatestBugCounts", new object[] {
limit}, this.GetLatestBugCountsOperationCompleted, userState);
}
private void OnGetLatestBugCountsOperationCompleted(object arg) {
if ((this.GetLatestBugCountsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetLatestBugCountsCompleted(this, new GetLatestBugCountsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -654,6 +688,32 @@ namespace MvcWrench.MonkeyWrench.Public {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
public delegate void GetLatestBugCountsCompletedEventHandler(object sender, GetLatestBugCountsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLatestBugCountsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetLatestBugCountsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((string[])(this.results[0]));
}
}
}
}
#pragma warning restore 1591