mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 19:34:40 +08:00
Restyling the recipe dropdown
Roughing in some recipe execution concepts... --HG-- branch : recipe
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
using Orchard.Recipes.Models;
|
using Orchard.Recipes.Models;
|
||||||
@@ -21,21 +22,25 @@ namespace Orchard.Recipes.Services {
|
|||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var executionId = Guid.NewGuid().ToString("n");
|
||||||
var recipeContext = new RecipeContext { Recipe = recipe };
|
var recipeContext = new RecipeContext { Recipe = recipe };
|
||||||
|
|
||||||
// TODO: Run each step inside a transaction boundary.
|
// TODO: Run each step inside a transaction boundary.
|
||||||
// TODO: Output should go into a report.
|
// TODO: Enqueue steps for the step executor.
|
||||||
// TODO: Eventually return a guid.tostring("n") execution id
|
|
||||||
foreach (var recipeStep in recipe.RecipeSteps) {
|
foreach (var recipeStep in recipe.RecipeSteps) {
|
||||||
recipeContext.RecipeStep = recipeStep;
|
recipeContext.RecipeStep = recipeStep;
|
||||||
recipeContext.Executed = false;
|
recipeContext.Executed = false;
|
||||||
foreach (var handler in _recipeHandlers) {
|
foreach (var recipeHandler in _recipeHandlers) {
|
||||||
handler.ExecuteRecipeStep(recipeContext);
|
recipeHandler.ExecuteRecipeStep(recipeContext);
|
||||||
}
|
}
|
||||||
if (!recipeContext.Executed) {
|
if (!recipeContext.Executed) {
|
||||||
Logger.Error("Could not execute recipe step '{0}' because the recipe handler was not found.", recipeContext.RecipeStep.Name);
|
Logger.Error("Could not execute recipe step '{0}' because the recipe handler was not found.", recipeContext.RecipeStep.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: figure out shell settings and shell descriptor for processing engine to run under
|
||||||
|
// _processingEngine.AddTask(null, null, "IRecipeStepEvents_DoWork", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -216,11 +216,6 @@ namespace Orchard.Setup.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void CreateTenantData(SetupContext context, IWorkContextScope environment) {
|
private void CreateTenantData(SetupContext context, IWorkContextScope environment) {
|
||||||
var recipeManager = environment.Resolve<IRecipeManager>();
|
|
||||||
if (context.Recipe != null) {
|
|
||||||
recipeManager.Execute(Recipes().Where(r => r.Name == context.Recipe).FirstOrDefault());
|
|
||||||
}
|
|
||||||
|
|
||||||
// create superuser
|
// create superuser
|
||||||
var membershipService = environment.Resolve<IMembershipService>();
|
var membershipService = environment.Resolve<IMembershipService>();
|
||||||
var user =
|
var user =
|
||||||
@@ -349,6 +344,11 @@ Modules are created by other users of Orchard just like you so if you feel up to
|
|||||||
menuItem.As<MenuPart>().OnMainMenu = true;
|
menuItem.As<MenuPart>().OnMainMenu = true;
|
||||||
menuItem.As<MenuItemPart>().Url = "";
|
menuItem.As<MenuItemPart>().Url = "";
|
||||||
|
|
||||||
|
var recipeManager = environment.Resolve<IRecipeManager>();
|
||||||
|
if (context.Recipe != null) {
|
||||||
|
recipeManager.Execute(Recipes().Where(r => r.Name == context.Recipe).FirstOrDefault());
|
||||||
|
}
|
||||||
|
|
||||||
//null check: temporary fix for running setup in command line
|
//null check: temporary fix for running setup in command line
|
||||||
if (HttpContext.Current != null) {
|
if (HttpContext.Current != null) {
|
||||||
authenticationService.SignIn(user, true);
|
authenticationService.SignIn(user, true);
|
||||||
|
@@ -128,8 +128,10 @@ input[type="password"] {
|
|||||||
width:98%;
|
width:98%;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
width:100%;
|
padding:3px;
|
||||||
|
border:1px solid #bdbcbc;
|
||||||
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.primaryAction, .button.primaryAction, .button.primaryAction:link, .button.primaryAction:visited {
|
button.primaryAction, .button.primaryAction, .button.primaryAction:link, .button.primaryAction:visited {
|
||||||
|
@@ -193,11 +193,15 @@
|
|||||||
<Compile Include="Mvc\ViewEngines\Razor\IRazorCompilationEvents.cs" />
|
<Compile Include="Mvc\ViewEngines\Razor\IRazorCompilationEvents.cs" />
|
||||||
<Compile Include="Recipes\Models\Recipe.cs" />
|
<Compile Include="Recipes\Models\Recipe.cs" />
|
||||||
<Compile Include="Recipes\Models\RecipeContext.cs" />
|
<Compile Include="Recipes\Models\RecipeContext.cs" />
|
||||||
|
<Compile Include="Recipes\Models\RecipeJournal.cs" />
|
||||||
<Compile Include="Recipes\Models\RecipeStep.cs" />
|
<Compile Include="Recipes\Models\RecipeStep.cs" />
|
||||||
<Compile Include="Recipes\Services\IRecipeHandler.cs" />
|
<Compile Include="Recipes\Services\IRecipeHandler.cs" />
|
||||||
<Compile Include="Recipes\Services\IRecipeHarvester.cs" />
|
<Compile Include="Recipes\Services\IRecipeHarvester.cs" />
|
||||||
|
<Compile Include="Recipes\Services\IRecipeJournal.cs" />
|
||||||
<Compile Include="Recipes\Services\IRecipeManager.cs" />
|
<Compile Include="Recipes\Services\IRecipeManager.cs" />
|
||||||
<Compile Include="Recipes\Services\IRecipeParser.cs" />
|
<Compile Include="Recipes\Services\IRecipeParser.cs" />
|
||||||
|
<Compile Include="Recipes\Services\IRecipeStepExecutor.cs" />
|
||||||
|
<Compile Include="Recipes\Services\IRecipeStepQueue.cs" />
|
||||||
<Compile Include="Security\IEncryptionService.cs" />
|
<Compile Include="Security\IEncryptionService.cs" />
|
||||||
<Compile Include="Security\CurrentUserWorkContext.cs" />
|
<Compile Include="Security\CurrentUserWorkContext.cs" />
|
||||||
<Compile Include="Security\Providers\DefaultEncryptionService.cs" />
|
<Compile Include="Security\Providers\DefaultEncryptionService.cs" />
|
||||||
|
19
src/Orchard/Recipes/Models/RecipeJournal.cs
Normal file
19
src/Orchard/Recipes/Models/RecipeJournal.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Orchard.Recipes.Models {
|
||||||
|
public class RecipeJournal {
|
||||||
|
public string ExecutionId { get; set; }
|
||||||
|
public RecipeJournalStatus Status { get; set; }
|
||||||
|
public IEnumerable<JournalMessage> Messages { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JournalMessage {
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RecipeJournalStatus {
|
||||||
|
Running,
|
||||||
|
Complete,
|
||||||
|
Failed
|
||||||
|
}
|
||||||
|
}
|
11
src/Orchard/Recipes/Services/IRecipeJournal.cs
Normal file
11
src/Orchard/Recipes/Services/IRecipeJournal.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using Orchard.Recipes.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Recipes.Services {
|
||||||
|
public interface IRecipeJournal {
|
||||||
|
void StartExecution(string executionId);
|
||||||
|
void ExecutionComplete(string executionId);
|
||||||
|
void ExecutionFailed(string executionId);
|
||||||
|
void WriteJournalEntry(string executionId, string message);
|
||||||
|
RecipeJournal GetRecipeJournal(string executionId);
|
||||||
|
}
|
||||||
|
}
|
5
src/Orchard/Recipes/Services/IRecipeStepExecutor.cs
Normal file
5
src/Orchard/Recipes/Services/IRecipeStepExecutor.cs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
namespace Orchard.Recipes.Services {
|
||||||
|
public interface IRecipeStepExecutor : IDependency {
|
||||||
|
bool ExecuteNextStep();
|
||||||
|
}
|
||||||
|
}
|
9
src/Orchard/Recipes/Services/IRecipeStepQueue.cs
Normal file
9
src/Orchard/Recipes/Services/IRecipeStepQueue.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
using Orchard.Recipes.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Recipes.Services {
|
||||||
|
public interface IRecipeStepQueue : IDependency {
|
||||||
|
void Enqueue(RecipeStep step, string executionId);
|
||||||
|
Tuple<RecipeStep, string> Dequeue();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user