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 @@ namespace BuildFeed
|
|||||||
public static void RegisterRoutes(RouteCollection routes)
|
public static void RegisterRoutes(RouteCollection routes)
|
||||||
{
|
{
|
||||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||||
routes.MapHttpRoute("API", "api/{action}/{id}",
|
|
||||||
new
|
|
||||||
{
|
|
||||||
controller = "api",
|
|
||||||
action = "GetBuilds",
|
|
||||||
id = UrlParameter.Optional
|
|
||||||
});
|
|
||||||
routes.AppendTrailingSlash = true;
|
routes.AppendTrailingSlash = true;
|
||||||
routes.MapMvcAttributeRoutes();
|
routes.MapMvcAttributeRoutes();
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,22 @@ namespace BuildFeed.Controllers
|
|||||||
bModel = new Build();
|
bModel = new Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<BuildModel>> GetBuilds()
|
[Route("/api/GetWin10Labs/")]
|
||||||
{
|
|
||||||
return await bModel.SelectInBuildOrder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<string>> GetWin10Labs()
|
public async Task<IEnumerable<string>> GetWin10Labs()
|
||||||
{
|
{
|
||||||
List<string> labs = new List<string>();
|
List<string> labs = new List<string>();
|
||||||
labs.AddRange(await bModel.SelectBuildLabs(6, 4));
|
labs.AddRange(await bModel.SelectBuildLabs(6, 4));
|
||||||
labs.AddRange(await bModel.SelectBuildLabs(10, 0));
|
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]
|
[HttpPost]
|
||||||
|
[Route("/api/AddWin10Builds/")]
|
||||||
public async Task<bool> AddWin10Builds(NewBuild apiModel)
|
public async Task<bool> AddWin10Builds(NewBuild apiModel)
|
||||||
{
|
{
|
||||||
if (apiModel == null)
|
if (apiModel == null)
|
||||||
@ -60,6 +61,7 @@ namespace BuildFeed.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("/api/GetSearchResult/{query}/")]
|
||||||
public async Task<IEnumerable<SearchResult>> GetSearchResult(string query)
|
public async Task<IEnumerable<SearchResult>> GetSearchResult(string query)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(query))
|
if (string.IsNullOrWhiteSpace(query))
|
||||||
|
@ -19,7 +19,7 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bfsTimeout = setTimeout(function (object) {
|
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 template = $.templates("#result-template");
|
||||||
var content = $("<div class='list-group'></div>");
|
var content = $("<div class='list-group'></div>");
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ $(function () {
|
|||||||
$("#search-results").html(content);
|
$("#search-results").html(content);
|
||||||
|
|
||||||
$("#search-results a.list-group-item").click(function () {
|
$("#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);
|
}, 200);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
<ListView.ItemsPanel>
|
<ListView.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<ItemsWrapGrid ScrollViewer.HorizontalScrollMode="Enabled" />
|
<ItemsStackPanel Orientation="Vertical" />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListView.ItemsPanel>
|
</ListView.ItemsPanel>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user