Adding a front-end controller for recipes that returns recipe execution status from the journal so we can poll it when finishing setup.

--HG--
branch : recipe
This commit is contained in:
Suha Can
2011-02-16 17:48:28 -08:00
parent 4218725a77
commit ddf29e6c08
3 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using System.Web.Mvc;
using Orchard.Localization;
using Orchard.Recipes.Services;
namespace Orchard.Recipes.Controllers {
public class RecipesController : Controller {
private readonly IRecipeJournal _recipeJournal;
public RecipesController(IRecipeJournal recipeJournal) {
_recipeJournal = recipeJournal;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
public ActionResult RecipeExecutionStatus (string executionId) {
var recipeStatus = _recipeJournal.GetRecipeStatus(executionId);
var model = recipeStatus;
return View(model);
}
}
}

View File

@@ -51,6 +51,7 @@
<Content Include="web.config" /> <Content Include="web.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Controllers\RecipesController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RecipeHandlers\CleanUpInactiveRecipeHandler.cs" /> <Compile Include="RecipeHandlers\CleanUpInactiveRecipeHandler.cs" />
<Compile Include="RecipeHandlers\CommandRecipeHandler.cs" /> <Compile Include="RecipeHandlers\CommandRecipeHandler.cs" />
@@ -60,6 +61,7 @@
<Compile Include="RecipeHandlers\ModuleRecipeHandler.cs" /> <Compile Include="RecipeHandlers\ModuleRecipeHandler.cs" />
<Compile Include="RecipeHandlers\SettingsRecipeHandler.cs" /> <Compile Include="RecipeHandlers\SettingsRecipeHandler.cs" />
<Compile Include="RecipeHandlers\ThemeRecipeHandler.cs" /> <Compile Include="RecipeHandlers\ThemeRecipeHandler.cs" />
<Compile Include="Routes.cs" />
<Compile Include="Services\RecipeHarvester.cs" /> <Compile Include="Services\RecipeHarvester.cs" />
<Compile Include="Services\RecipeJournalManager.cs" /> <Compile Include="Services\RecipeJournalManager.cs" />
<Compile Include="Services\RecipeManager.cs" /> <Compile Include="Services\RecipeManager.cs" />

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Mvc.Routes;
namespace Orchard.Recipes {
public class Routes : IRouteProvider {
public void GetRoutes(ICollection<RouteDescriptor> routes) {
foreach (var routeDescriptor in GetRoutes())
routes.Add(routeDescriptor);
}
public IEnumerable<RouteDescriptor> GetRoutes() {
return new[] {
new RouteDescriptor { Priority = 5,
Route = new Route(
"Recipes/Status/{executionId}",
new RouteValueDictionary {
{"area", "Orchard.Recipes"},
{"controller", "Recipes"},
{"action", "RecipeExecutionStatus"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "Orchard.Recipes"}
},
new MvcRouteHandler())
}
};
}
}
}