mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
API Changes
This commit is contained in:
parent
cb3babd1ee
commit
a84b410cea
|
@ -9,13 +9,6 @@ public class RouteConfig
|
|||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
routes.MapHttpRoute("API", "api/{action}/{id}",
|
||||
new
|
||||
{
|
||||
controller = "api",
|
||||
action = "GetBuilds",
|
||||
id = UrlParameter.Optional
|
||||
});
|
||||
routes.AppendTrailingSlash = true;
|
||||
routes.MapMvcAttributeRoutes();
|
||||
}
|
||||
|
|
|
@ -19,21 +19,22 @@ public apiController() : base()
|
|||
bModel = new Build();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<BuildModel>> GetBuilds()
|
||||
{
|
||||
return await bModel.SelectInBuildOrder();
|
||||
}
|
||||
|
||||
[Route("/api/GetWin10Labs/")]
|
||||
public async Task<IEnumerable<string>> GetWin10Labs()
|
||||
{
|
||||
List<string> labs = new List<string>();
|
||||
labs.AddRange(await bModel.SelectBuildLabs(6, 4));
|
||||
labs.AddRange(await bModel.SelectBuildLabs(10, 0));
|
||||
|
||||
return labs.GroupBy(l => l).Select(l => l.Key).Where(l => l.All(c => c != '(')).ToArray();
|
||||
return labs
|
||||
.GroupBy(l => l)
|
||||
.Select(l => l.Key)
|
||||
.Where(l => l.All(c => c != '('))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("/api/AddWin10Builds/")]
|
||||
public async Task<bool> AddWin10Builds(NewBuild apiModel)
|
||||
{
|
||||
if (apiModel == null)
|
||||
|
@ -60,6 +61,7 @@ public async Task<bool> AddWin10Builds(NewBuild apiModel)
|
|||
}
|
||||
}
|
||||
|
||||
[Route("/api/GetSearchResult/{query}/")]
|
||||
public async Task<IEnumerable<SearchResult>> GetSearchResult(string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
|
|
|
@ -19,7 +19,7 @@ $(function () {
|
|||
}
|
||||
|
||||
bfsTimeout = setTimeout(function (object) {
|
||||
bfsAjax = $.ajax("/api/GetSearchResult/?query=" + $("#search-input").val()).done(function (data) {
|
||||
bfsAjax = $.ajax("/api/GetSearchResult/" + $("#search-input").val() + '/').done(function (data) {
|
||||
var template = $.templates("#result-template");
|
||||
var content = $("<div class='list-group'></div>");
|
||||
|
||||
|
@ -29,7 +29,7 @@ $(function () {
|
|||
$("#search-results").html(content);
|
||||
|
||||
$("#search-results a.list-group-item").click(function () {
|
||||
ga('send', 'pageview', '/api/GetSearchResult/?query=' + $("#search-input").val());
|
||||
ga('send', 'pageview', '/api/GetSearchResult/' + $("#search-input").val() + '/');
|
||||
});
|
||||
});
|
||||
}, 200);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</ListView.ItemTemplate>
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<ItemsWrapGrid ScrollViewer.HorizontalScrollMode="Enabled" />
|
||||
<ItemsStackPanel Orientation="Vertical" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
</ListView>
|
||||
|
|
Loading…
Reference in New Issue
Block a user