Added better UI for Data migration developer tools

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-07-06 11:35:38 -07:00
parent fb87fb9dd4
commit 48c00c30a4
5 changed files with 28 additions and 24 deletions

View File

@@ -1,23 +1,38 @@
using System.Web.Mvc;
using System;
using System.Web.Mvc;
using Orchard.Data.Migration.Generator;
using Orchard.DevTools.ViewModels;
using Orchard.Localization;
using Orchard.Mvc.ViewModels;
using Orchard.UI.Notify;
namespace Orchard.DevTools.Controllers {
[ValidateInput(false)]
public class DataMigrationController : Controller {
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
public DataMigrationController(ISchemaCommandGenerator schemaCommandGenerator) {
public DataMigrationController(ISchemaCommandGenerator schemaCommandGenerator, IOrchardServices orchardServices) {
_schemaCommandGenerator = schemaCommandGenerator;
Services = orchardServices;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
public ActionResult Index() {
var model = new DataMigrationIndexViewModel ();
_schemaCommandGenerator.UpdateDatabase();
return View(model);
return View(new BaseViewModel());
}
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");
}
}
}

View File

@@ -86,7 +86,6 @@
<Compile Include="Settings\DevToolsSettings.cs" />
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
<Compile Include="ViewModels\DataMigrationIndexViewModel.cs" />
<Compile Include="ViewModels\MetadataIndexViewModel.cs" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,6 +0,0 @@
using Orchard.Mvc.ViewModels;
namespace Orchard.DevTools.ViewModels {
public class DataMigrationIndexViewModel : BaseViewModel {
}
}

View File

@@ -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>

View File

@@ -4,4 +4,4 @@
<p><%: Html.ActionLink(T("Contents").ToString(), "Index", "Content") %></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("Data migration").ToString(), "Index", "DataMigration")%></p>