mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Added better UI for Data migration developer tools
--HG-- branch : dev
This commit is contained in:
@@ -1,23 +1,38 @@
|
|||||||
using System.Web.Mvc;
|
using System;
|
||||||
|
using System.Web.Mvc;
|
||||||
using Orchard.Data.Migration.Generator;
|
using Orchard.Data.Migration.Generator;
|
||||||
using Orchard.DevTools.ViewModels;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.DevTools.Controllers {
|
namespace Orchard.DevTools.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
public class DataMigrationController : Controller {
|
public class DataMigrationController : Controller {
|
||||||
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
|
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
|
||||||
|
|
||||||
public DataMigrationController(ISchemaCommandGenerator schemaCommandGenerator) {
|
public DataMigrationController(ISchemaCommandGenerator schemaCommandGenerator, IOrchardServices orchardServices) {
|
||||||
_schemaCommandGenerator = schemaCommandGenerator;
|
_schemaCommandGenerator = schemaCommandGenerator;
|
||||||
|
Services = orchardServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IOrchardServices Services { get; set; }
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
var model = new DataMigrationIndexViewModel ();
|
return View(new BaseViewModel());
|
||||||
|
|
||||||
_schemaCommandGenerator.UpdateDatabase();
|
|
||||||
|
|
||||||
return View(model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult UpdateDatabase() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
_schemaCommandGenerator.UpdateDatabase();
|
||||||
|
Services.Notifier.Information(T("Database updated successfuly"));
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
Services.Notifier.Error(T("An error occured while updating the database: {0}", ex.Message));
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -86,7 +86,6 @@
|
|||||||
<Compile Include="Settings\DevToolsSettings.cs" />
|
<Compile Include="Settings\DevToolsSettings.cs" />
|
||||||
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
|
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
|
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DataMigrationIndexViewModel.cs" />
|
|
||||||
<Compile Include="ViewModels\MetadataIndexViewModel.cs" />
|
<Compile Include="ViewModels\MetadataIndexViewModel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
using Orchard.Mvc.ViewModels;
|
|
||||||
|
|
||||||
namespace Orchard.DevTools.ViewModels {
|
|
||||||
public class DataMigrationIndexViewModel : BaseViewModel {
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +1,5 @@
|
|||||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<Orchard.DevTools.ViewModels.DataMigrationIndexViewModel>" %>
|
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<BaseViewModel>"%>
|
||||||
|
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||||
|
<h1><%: Html.TitleForPage(T("Data migration").ToString()) %></h1>
|
||||||
|
<p><%: Html.ActionLink(T("Update database").ToString(), "UpdateDatabase", "DataMigration") %></p>
|
||||||
|
|
||||||
<style title="text/css">
|
|
||||||
ul
|
|
||||||
{
|
|
||||||
margin-left: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<h1>Data Migration</h1>
|
|
||||||
|
@@ -4,4 +4,4 @@
|
|||||||
<p><%: Html.ActionLink(T("Contents").ToString(), "Index", "Content") %></p>
|
<p><%: Html.ActionLink(T("Contents").ToString(), "Index", "Content") %></p>
|
||||||
<p><%: Html.ActionLink(T("Metadata").ToString(), "Index", "Metadata") %></p>
|
<p><%: Html.ActionLink(T("Metadata").ToString(), "Index", "Metadata") %></p>
|
||||||
<p><%: Html.ActionLink(T("Test Unauthorized Request").ToString(), "NotAuthorized", "Home")%></p>
|
<p><%: Html.ActionLink(T("Test Unauthorized Request").ToString(), "NotAuthorized", "Home")%></p>
|
||||||
|
<p><%: Html.ActionLink(T("Data migration").ToString(), "Index", "DataMigration")%></p>
|
||||||
|
Reference in New Issue
Block a user