Add Application Insights, Search Overhaul p2

This commit is contained in:
Thomas Hounsell 2014-12-03 10:54:14 +00:00
parent e3a28b505f
commit 509de0dc50
11 changed files with 119 additions and 38 deletions

3
.gitignore vendored
View File

@ -6,6 +6,9 @@
*.user
*.sln.docstates
# Application Insights config
ApplicationInsights.config
# Publish Profiles
[Pp]roperties/[Pp]ublish[Pp]rofiles/

View File

@ -20,6 +20,7 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<ApplicationInsightsResourceId>/subscriptions/4af45631-0e5c-4253-9e38-d0c47f9c5b32/resourcegroups/Default-ApplicationInsights-CentralUS/providers/microsoft.insights/components/BuildFeed</ApplicationInsightsResourceId>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -44,14 +45,28 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Elmah, Version=1.2.14706.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\elmah.corelibrary.1.2.2\lib\Elmah.dll</HintPath>
<Reference Include="Microsoft.ApplicationInsights">
<HintPath>..\packages\Microsoft.ApplicationInsights.0.11.1-build00694\lib\net40\Microsoft.ApplicationInsights.dll</HintPath>
</Reference>
<Reference Include="Elmah.Mvc">
<HintPath>..\packages\Elmah.MVC.2.1.1\lib\net40\Elmah.Mvc.dll</HintPath>
<Reference Include="Microsoft.ApplicationInsights.Extensibility.RuntimeTelemetry">
<HintPath>..\packages\Microsoft.ApplicationInsights.RuntimeTelemetry.0.11.1-build00694\lib\net45\Microsoft.ApplicationInsights.Extensibility.RuntimeTelemetry.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationInsights.Extensibility.Web">
<HintPath>..\packages\Microsoft.ApplicationInsights.Web.0.11.1-build00694\lib\net45\Microsoft.ApplicationInsights.Extensibility.Web.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Diagnostics.Tracing.EventSource">
<HintPath>..\packages\Microsoft.Diagnostics.Tracing.EventSource.Redist.1.0.24\lib\net40\Microsoft.Diagnostics.Tracing.EventSource.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -76,6 +91,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http.Formatting">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.2\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
@ -181,6 +197,7 @@
<Content Include="content\tile\wide.png" />
<Content Include="content\Web.config" />
<Content Include="Areas\admin\Views\base\index.cshtml" />
<Content Include="ApplicationInsights.config" />
<None Include="Properties\PublishProfiles\Milestone 1 FTP.pubxml" />
<None Include="Scripts\jquery-2.1.1.intellisense.js" />
<Content Include="googleacffc6da14c53e15.html" />
@ -194,6 +211,8 @@
<Content Include="Scripts\jquery.validate.min.js" />
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
<Content Include="Scripts\jsrender.js" />
<Content Include="Scripts\jsrender.min.js" />
<Content Include="Scripts\_references.js" />
<Content Include="content\tile\square.png" />
<Content Include="content\tile\tiny.png" />
@ -221,6 +240,7 @@
<Content Include="Views\support\thanks_register.cshtml" />
<Content Include="Views\support\rss.cshtml" />
<Content Include="Views\support\sitemap.cshtml" />
<Content Include="Scripts\jsrender.min.js.map" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
@ -258,6 +278,16 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<Import Project="..\packages\Microsoft.ApplicationInsights.0.11.1-build00694\tools\net40\Microsoft.ApplicationInsights.targets" Condition="Exists('..\packages\Microsoft.ApplicationInsights.0.11.1-build00694\tools\net40\Microsoft.ApplicationInsights.targets')" />
<Target Name="EnsureApplicationInsightsImported" BeforeTargets="BeforeBuild" Condition="'$(ApplicationInsightsImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.ApplicationInsights.0.11.1-build00694\tools\net40\Microsoft.ApplicationInsights.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." />
<Error Condition="Exists('..\packages\Microsoft.ApplicationInsights.0.11.1-build00694\tools\net40\Microsoft.ApplicationInsights.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -27,8 +27,39 @@ public IEnumerable<string> GetWin10Labs()
public IEnumerable<SearchResult> GetSearchResult(string query)
{
if (string.IsNullOrWhiteSpace(query))
{
return new SearchResult[0];
}
List<SearchResult> results = new List<SearchResult>();
var sourceResults = from s in Enum.GetValues(typeof(BuildFeed.Models.TypeOfSource)).Cast<BuildFeed.Models.TypeOfSource>().Select(s => DisplayHelpers.GetDisplayTextForEnum(s))
where s.Contains(query)
orderby s.IndexOf(query) ascending
select new SearchResult()
{
Url = Url.Route("Source Root", new { controller = "build", action = "source", source = s }),
Label = s.Replace(query, "<strong>" + query + "</strong>"),
Group = "Source"
};
results.AddRange(sourceResults);
var versionResults = from v in Build.SelectBuildVersions()
where string.Format("{0}.{1}", v.Major, v.Minor).StartsWith(query)
orderby v.Major descending, v.Minor descending
select new SearchResult()
{
Url = Url.Route("Version Root", new { controller = "build", action = "version", major = v.Major, minor = v.Minor }),
Label = string.Format("{0}.{1}", v.Major, v.Minor).Replace(query, "<strong>" + query + "</strong>"),
Group = "Version"
};
results.AddRange(versionResults);
var yearResults = from y in Build.SelectBuildYears()
where y.ToString().Contains(query)
orderby y descending
@ -68,6 +99,17 @@ b.BuildTime descending
results.AddRange(buildResults);
if (results.Count == 0)
{
results.Add(new SearchResult()
{
Url = "/",
Label = "No Results found",
Group = ""
});
}
return results.Take(6);
}
}

View File

@ -70,7 +70,7 @@ public async Task<ActionResult> added()
Title = build.FullBuildString,
Link = new RssUrl(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("info", new { controller = "Build", id = build.Id }))),
Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("info", new { controller = "Build", id = build.Id })) },
PubDate = build.Added
// PubDate = build.Added - MUST FIX TO USE CORRECT FORMAT BEFORE RE-ENABLING
}).ToList()
}
};

View File

@ -3,4 +3,4 @@
/// <reference path="jquery.validate.unobtrusive.js" />
/// <reference path="jquery.validate.js" />
/// <reference path="bfs.js" />
/// <reference path="jsrender.js" />
/// <reference path="jsrender.min.js" />

View File

@ -1,5 +1,5 @@
$(function () {
$("#search-input").change(function () {
$("#search-input").keyup(function () {
var search = $(this);
$(this).parent().find(".list-group").remove();
$.ajax("/api/GetSearchResult/?query=" + $(this).val()).done(function (data) {

View File

@ -108,6 +108,12 @@
@Html.TextBox("search-input", "", new { @class = "form-control" })
</div>
</div>
@if (ViewBag.Action != "index")
{
<div class="list-group">
@Html.ActionLink("Return to full listing", "index", new { controller = "build", area = "", page = 1 }, new { @class = "list-group-item" })
</div>
}
<div class="list-group">
@if (User.Identity.IsAuthenticated)
{

View File

@ -16,6 +16,16 @@
@Styles.Render("~/content/css")
<title>@ViewBag.Title</title>
@RenderSection("head", false)
<script type="text/javascript">
var appInsights = window.appInsights || function (config) {
function s(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } } var t = { config: config }, r = document, f = window, e = "script", o = r.createElement(e), i, u; for (o.src = config.url || "//az416426.vo.msecnd.net/scripts/a/ai.0.js", r.getElementsByTagName(e)[0].parentNode.appendChild(o), t.cookie = r.cookie, t.queue = [], i = ["Event", "Exception", "Metric", "PageView", "Trace"]; i.length;) s("track" + i.pop()); return config.disableExceptionTracking || (i = "onerror", s("_" + i), u = f[i], f[i] = function (config, r, f, e, o) { var s = u && u(config, r, f, e, o); return s !== !0 && t["_" + i](config, r, f, e, o), s }), t
}({
instrumentationKey: "4632419f-7a2f-4ab5-8374-34384b650f42"
});
window.appInsights = appInsights;
appInsights.trackPageView();
</script>
</head>
<body>
<script>

View File

@ -15,6 +15,16 @@
<meta name="application-name" content="BuildFeed" />
<title>Error | BuildFeed</title>
<script type="text/javascript">
var appInsights = window.appInsights || function (config) {
function s(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } } var t = { config: config }, r = document, f = window, e = "script", o = r.createElement(e), i, u; for (o.src = config.url || "//az416426.vo.msecnd.net/scripts/a/ai.0.js", r.getElementsByTagName(e)[0].parentNode.appendChild(o), t.cookie = r.cookie, t.queue = [], i = ["Event", "Exception", "Metric", "PageView", "Trace"]; i.length;) s("track" + i.pop()); return config.disableExceptionTracking || (i = "onerror", s("_" + i), u = f[i], f[i] = function (config, r, f, e, o) { var s = u && u(config, r, f, e, o); return s !== !0 && t["_" + i](config, r, f, e, o), s }), t
}({
instrumentationKey: "4632419f-7a2f-4ab5-8374-34384b650f42"
});
window.appInsights = appInsights;
appInsights.trackPageView();
</script>
</head>
<body>
<script>

View File

@ -4,14 +4,6 @@
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
@ -22,13 +14,6 @@
<add key="data:ServerPort" value="6379" />
<add key="data:ServerDB" value="1" />
<add key="RouteDebugger:Enabled" value="false" />
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="hounsell" />
<add key="elmah.mvc.route" value="elmah" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
@ -45,11 +30,6 @@
<add name="BuildFeedMemberProvider" type="BuildFeed.Auth.RedisMembershipProvider" />
</providers>
</membership>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -90,15 +70,10 @@
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" preCondition="managedHandler" />
</modules>
<urlCompression doDynamicCompression="true" />
</system.webServer>
<elmah>
<security allowRemoteAccess="yes" />
</elmah>
</configuration>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
<package id="elmah.corelibrary" version="1.2.2" targetFramework="net45" />
<package id="Elmah.MVC" version="2.1.1" targetFramework="net45" />
<package id="jQuery" version="2.1.1" targetFramework="net45" />
<package id="jQuery.Validation" version="1.13.1" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights" version="0.11.1-build00694" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.RuntimeTelemetry" version="0.11.1-build00694" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.Web" version="0.11.1-build00694" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
@ -13,6 +14,10 @@
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.Diagnostics.Tracing.EventSource.Redist" version="1.0.24" targetFramework="net45" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net45" />