mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-22 03:37:25 +08:00
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:
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -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" />
|
||||||
|
32
src/Orchard.Web/Modules/Orchard.Recipes/Routes.cs
Normal file
32
src/Orchard.Web/Modules/Orchard.Recipes/Routes.cs
Normal 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())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user