diff --git a/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Contracts/IServersRepository.cs b/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Contracts/IServersRepository.cs
index 4401a5e..770a646 100644
--- a/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Contracts/IServersRepository.cs
+++ b/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Contracts/IServersRepository.cs
@@ -14,5 +14,7 @@ public interface IServersRepository
Server GetServerDetail(int id);
void UpdateServer(int id, Server server);
+
+ Server AddServer(Server server);
}
}
diff --git a/src/Server/DeploymentFramework/Database/Deployment/ServersRepository.cs b/src/Server/DeploymentFramework/Database/Deployment/ServersRepository.cs
index 15ad300..2a61622 100644
--- a/src/Server/DeploymentFramework/Database/Deployment/ServersRepository.cs
+++ b/src/Server/DeploymentFramework/Database/Deployment/ServersRepository.cs
@@ -34,5 +34,10 @@ public void UpdateServer(int id, Server server)
x => x.Name,
x => x.AgentUrl);
}
+
+ public Server AddServer(Server server)
+ {
+ return Context.Servers.Add(server);
+ }
}
}
diff --git a/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs b/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs
index f11558a..5b03af5 100644
--- a/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs
+++ b/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs
@@ -78,6 +78,15 @@ public static string ActiveTo {
}
}
+ ///
+ /// Looks up a localized string similar to Add new server.
+ ///
+ public static string AddNewServer {
+ get {
+ return ResourceManager.GetString("AddNewServer", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Agent URL.
///
@@ -231,6 +240,15 @@ public static string Neither_Filter {
}
}
+ ///
+ /// Looks up a localized string similar to New server.
+ ///
+ public static string NewServer {
+ get {
+ return ResourceManager.GetString("NewServer", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to No.
///
diff --git a/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx b/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx
index e6ea34a..7ddb018 100644
--- a/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx
+++ b/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx
@@ -123,6 +123,9 @@
Aktivní do
+
+ Přidat nový server
+
URL agenta
@@ -174,6 +177,9 @@
Nezáleží
+
+ Nový server
+
Ne
diff --git a/src/Server/DeploymentFramework/Resources/StringResources.resx b/src/Server/DeploymentFramework/Resources/StringResources.resx
index bef8c5e..474489b 100644
--- a/src/Server/DeploymentFramework/Resources/StringResources.resx
+++ b/src/Server/DeploymentFramework/Resources/StringResources.resx
@@ -123,6 +123,9 @@
Active to
+
+ Add new server
+
Agent URL
@@ -174,6 +177,9 @@
Neither
+
+ New server
+
No
diff --git a/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs b/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs
index 5fa53b4..35c5ae2 100644
--- a/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs
+++ b/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs
@@ -4,6 +4,7 @@
using System.Web;
using System.Web.Mvc;
using Baud.Deployment.BusinessLogic.Domain.Deployment.Contracts;
+using Baud.Deployment.BusinessLogic.Domain.Deployment.Entities;
using Baud.Deployment.Web.Areas.Deployment.Models.Servers;
using Baud.Deployment.Web.Framework.Security;
using Baud.Deployment.Web.Framework.Web;
@@ -91,5 +92,32 @@ public virtual ActionResult Edit(int id, FormCollection form)
return RedirectToAction(Actions.Detail(id));
}
}
+
+ public virtual ActionResult Add()
+ {
+ return View();
+ }
+
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public virtual ActionResult Add(FormCollection form)
+ {
+ using (var uow = _deploymentUow())
+ {
+ var server = new Server
+ {
+ Name = form.Get("Name"),
+ AgentUrl = form.Get("AgentUrl"),
+ Created = DateTime.Now,
+ CreatedBy = -2
+ };
+
+ uow.Servers.AddServer(server);
+ uow.Commit();
+
+ // TODO add confirmation toast message
+ return RedirectToAction(Actions.Detail(server.ID));
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Add.cshtml b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Add.cshtml
new file mode 100644
index 0000000..76d652b
--- /dev/null
+++ b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Add.cshtml
@@ -0,0 +1,24 @@
+@model Baud.Deployment.BusinessLogic.Domain.Deployment.Entities.Server
+@using Baud.Deployment.Resources
+
+@{
+ ViewBag.Title = StringResources.NewServer;
+}
+
+
@ViewBag.Title
+
+@using (var f = Html.BeginCustomForm())
+{
+ using (var s = f.BeginSection())
+ {
+ @s.FieldFor(m => m.Name)
+ @s.FieldFor(m => m.AgentUrl)
+ }
+
+ @Html.GuardedActionLink(StringResources.BackToList, MVC.Deployment.Servers.Index(), new SimpleHtmlAttributes("class", "btn btn-default"))
+
+ using (var n = f.BeginNavigation())
+ {
+ @n.Submit(StringResources.Save)
+ }
+}
diff --git a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Index.cshtml b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Index.cshtml
index 38c368d..4de1c73 100644
--- a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Index.cshtml
+++ b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Index.cshtml
@@ -24,6 +24,8 @@
}
+@Html.GuardedActionLink(StringResources.AddNewServer, MVC.Deployment.Servers.Add())
+
@if (Model.Any())
{
@@ -53,3 +55,4 @@ else
{
@StringResources.NoData
}
+
diff --git a/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs b/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs
index 1721133..74928cc 100644
--- a/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs
+++ b/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs
@@ -92,6 +92,7 @@ public class ActionNamesClass
public readonly string Index = "Index";
public readonly string Detail = "Detail";
public readonly string Edit = "Edit";
+ public readonly string Add = "Add";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -100,6 +101,7 @@ public class ActionNameConstants
public const string Index = "Index";
public const string Detail = "Detail";
public const string Edit = "Edit";
+ public const string Add = "Add";
}
@@ -113,10 +115,12 @@ public class ViewsClass
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
+ public readonly string Add = "Add";
public readonly string Detail = "Detail";
public readonly string Edit = "Edit";
public readonly string Index = "Index";
}
+ public readonly string Add = "~/Areas/Deployment/Views/Servers/Add.cshtml";
public readonly string Detail = "~/Areas/Deployment/Views/Servers/Detail.cshtml";
public readonly string Edit = "~/Areas/Deployment/Views/Servers/Edit.cshtml";
public readonly string Index = "~/Areas/Deployment/Views/Servers/Index.cshtml";
@@ -178,6 +182,29 @@ public override System.Web.Mvc.ActionResult Edit(int id, System.Web.Mvc.FormColl
return callInfo;
}
+ [NonAction]
+ partial void AddOverride(T4MVC_System_Web_Mvc_ActionResult callInfo);
+
+ [NonAction]
+ public override System.Web.Mvc.ActionResult Add()
+ {
+ var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Add);
+ AddOverride(callInfo);
+ return callInfo;
+ }
+
+ [NonAction]
+ partial void AddOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Web.Mvc.FormCollection form);
+
+ [NonAction]
+ public override System.Web.Mvc.ActionResult Add(System.Web.Mvc.FormCollection form)
+ {
+ var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Add);
+ ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "form", form);
+ AddOverride(callInfo, form);
+ return callInfo;
+ }
+
}
}
diff --git a/src/Server/DeploymentFramework/Web/T4MVC.cs b/src/Server/DeploymentFramework/Web/T4MVC.cs
index 3d67c53..45877ff 100644
--- a/src/Server/DeploymentFramework/Web/T4MVC.cs
+++ b/src/Server/DeploymentFramework/Web/T4MVC.cs
@@ -94,17 +94,10 @@ public static class Scripts {
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); }
public static readonly string _references_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/_references.min.js") ? Url("_references.min.js") : Url("_references.js");
public static readonly string bootstrap_bundle_min_js = Url("bootstrap-bundle.min.js");
- public static readonly string bootstrap_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/bootstrap.min.js") ? Url("bootstrap.min.js") : Url("bootstrap.js");
- public static readonly string bootstrap_min_js = Url("bootstrap.min.js");
- public static readonly string jquery_1_10_2_intellisense_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery-1.10.2.intellisense.min.js") ? Url("jquery-1.10.2.intellisense.min.js") : Url("jquery-1.10.2.intellisense.js");
- public static readonly string jquery_1_10_2_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery-1.10.2.min.js") ? Url("jquery-1.10.2.min.js") : Url("jquery-1.10.2.js");
- public static readonly string jquery_1_10_2_min_js = Url("jquery-1.10.2.min.js");
- public static readonly string jquery_1_10_2_min_map = Url("jquery-1.10.2.min.map");
public static readonly string jquery_bundle_min_js = Url("jquery-bundle.min.js");
public static readonly string jquery_validate_unobtrusive_bootstrap_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery.validate.unobtrusive.bootstrap.min.js") ? Url("jquery.validate.unobtrusive.bootstrap.min.js") : Url("jquery.validate.unobtrusive.bootstrap.js");
public static readonly string jquery_validate_unobtrusive_chameleon_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery.validate.unobtrusive.chameleon.min.js") ? Url("jquery.validate.unobtrusive.chameleon.min.js") : Url("jquery.validate.unobtrusive.chameleon.js");
public static readonly string modernizer_min_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/modernizer-min.min.js") ? Url("modernizer-min.min.js") : Url("modernizer-min.js");
- public static readonly string modernizr_2_6_2_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/modernizr-2.6.2.min.js") ? Url("modernizr-2.6.2.min.js") : Url("modernizr-2.6.2.js");
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -112,8 +105,6 @@ public static class Content {
private const string URLPATH = "~/Content";
public static string Url() { return T4MVCHelpers.ProcessVirtualPath(URLPATH); }
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); }
- public static readonly string bootstrap_css = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/bootstrap.min.css") ? Url("bootstrap.min.css") : Url("bootstrap.css");
- public static readonly string bootstrap_min_css = Url("bootstrap.min.css");
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public static class dist {
private const string URLPATH = "~/Content/dist";
diff --git a/src/Server/DeploymentFramework/Web/Web.csproj b/src/Server/DeploymentFramework/Web/Web.csproj
index d4ca66e..3c2c5ff 100644
--- a/src/Server/DeploymentFramework/Web/Web.csproj
+++ b/src/Server/DeploymentFramework/Web/Web.csproj
@@ -438,6 +438,7 @@
+