Skip to content

Commit

Permalink
codeRR v1.1-beta01
Browse files Browse the repository at this point in the history
  • Loading branch information
jgauffin committed Oct 18, 2017
1 parent c3934fd commit 536c084
Show file tree
Hide file tree
Showing 27 changed files with 158 additions and 573 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void IConfigurationSection.Load(IDictionary<string, string> items)
AccountPassword = items.GetString("AccountPassword", "");
SmtpHost = items.GetString("SmtpHost");
PortNumber = items.GetInteger("PortNumber");
UseSsl = items.GetBoolean("UseSsl");
UseSsl = items.GetBoolean("UseSSL");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public override T Load<T>()
var items = new Dictionary<string, string>();
while (reader.Read())
{
items[reader.GetString(0)] = reader.GetString(1);
var name = reader.GetString(0);
var dbValue = reader.GetValue(1);
var value = dbValue is DBNull ? null : (string) dbValue;
items[name] = value;
}

if (items.Count == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Coderr.Server.SqlServer/SqlServerTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void CheckConnectionString(string connectionString)
else
connectionString = connectionString.Substring(0, pos) + "1" + connectionString.Substring(endPos);
}

SqlConnection.ClearAllPools();
var con = new SqlConnection(connectionString);
con.Open();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="form-group disabled suboption">
@Html.LabelFor(x => x.ContactEmail, new {@class = "control-label"})
@Html.TextBoxFor(x => x.ContactEmail, new {@class = "form-control", disabled = ""})
@Html.TextBoxFor(x => x.ContactEmail, new {@class = "form-control"})
<small>Email address that we may contact if we need any further information (will also receive notifications when your errors have been corrected).</small>
</div>
<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - codeRR</title>
<link href="/Content/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
Expand All @@ -14,7 +14,7 @@
<body>
<div class="navbar navbar-dark bg-dark">
<div class="container">
<span class="navbar-brand">codeRR - Admin area</span>
<span class="navbar-brand">codeRR - Administration area</span>
<span>
<a href="@Url.Content("~/#")">
<span class="fa fa-2x fa-home text-warning"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<h2>Database configuration</h2>

<p>
It's time to to configure the database. To do that you need
It's time to configure the database. To do that you need
to start by specifying which database to use. We expect that you have created
a database and configured an account for it.
</p>
Expand Down Expand Up @@ -35,7 +35,7 @@
</em>
</p>
<h3>Example</h3>
<pre><code>Data Source=(localdb)\ProjectsV12;Initial Catalog=codeRR;Integrated Security=True;Connect Timeout=30;</code></pre>
<pre><code>Data Source=yourDbServer;Initial Catalog=codeRR;Integrated Security=True;Connect Timeout=30;</code></pre>
</div>
</div>
</div>
Expand All @@ -44,6 +44,7 @@
{

<script type="text/javascript">
$('[data-name="nextLink"]').prop('disabled', 'true');
$('#saveButton')
.click(function(e) {
e.preventDefault();
Expand All @@ -52,13 +53,14 @@
.getJSON(
'@Url.RouteUrl(new {Area = "Installation", Controller = "Sql", Action = "Validate"})/?connectionString=' + conStr)
.done(function(data) {
if (data.result == "fail") {
if (data.result === "fail") {
$('#error').text(data.reason).show();
} else {
$('#error').hide();
$("#testConnection").removeClass("btn-primary");
$('#saveButton').removeAttr("disabled").addClass("btn-primary");
humane.log("Connection was successful. Click on the Next button to continue.");
$('[data-name="nextLink"]').prop('disabled', 'false');
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@

namespace codeRR.Server.Web.Areas.Installation.Controllers
{
[OutputCache(Duration = 0, NoStore = true)]
public class SqlController : Controller
{
private static int _counter;

[HttpPost]
[OutputCache(Duration = 0, NoStore = true)]
public ActionResult Connection()
{
return RedirectToAction("Tables");
}

[OutputCache(Duration = 0, NoStore = true)]
public ActionResult Index()
{
var constr = ConfigurationManager.ConnectionStrings["Db"];
if (!string.IsNullOrEmpty(constr?.ConnectionString))
{
ViewBag.ConnectionString = constr.ConnectionString ?? "";
}
else
{
ViewBag.ConnectionString = "";
Expand All @@ -30,11 +35,14 @@ public ActionResult Index()
}

[HttpGet]
[OutputCache(Duration = 0, NoStore = true)]
public ActionResult Tables()
{
ViewBag.GotException = false;
if (SetupTools.DbTools.GotUpToDateTables())
{
ViewBag.GotTables = true;
}
else
{
ViewBag.GotTables = false;
Expand All @@ -44,6 +52,7 @@ public ActionResult Tables()
}

[HttpPost]
[OutputCache(Duration = 0, NoStore = true)]
public ActionResult Tables(string go)
{
try
Expand All @@ -63,6 +72,7 @@ public ActionResult Tables(string go)
//return RedirectToRoute(new {Area = "Installation", Controller = "Setup", Action = "Done"});
}

[OutputCache(Duration = 0, NoStore = true)]
public ActionResult Validate()
{
try
Expand All @@ -77,7 +87,12 @@ public ActionResult Validate()
.Replace("\"", "\\\"")
.Replace("\r", "")
.Replace("\n", "\\n");
return Content(@"{ ""result"": ""fail"", ""reason"": """ + errMsg + @"""}", "application/json");
return Json(new
{
result = "fail",
reason = errMsg,
attempt = ++_counter
}, JsonRequestBehavior.AllowGet);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<h2>Error tracking</h2>
<p>
To correct bugs faster we have activated codeRR in the community server. By completing this
setup, you allow us to collect error information and sent it to our own hosted service.
setup, you allow us to collect error information and send it to our own hosted service.
</p>
<p>
You can optionally enter your email address to get notifications when the errors in your
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - codeRR</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/Content/bootstrap.min.css"/>
<link rel="stylesheet" href="@Url.Content("~/Content/bootstrap.min.css")"/>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@RenderSection("Styles", false)
<meta name="description" content="The description of my page"/>
<meta name="description" content="codeRR installation wizard"/>
</head>
<body class="full-width">

Expand Down
154 changes: 80 additions & 74 deletions src/Server/Coderr.Server.Web/Areas/Installation/Views/Sql/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,75 +1,81 @@
@{
ViewBag.Title = "Installation - Database configuration";
}
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>Database configuration</h2>

<p>
It's time to to configure the database. To do that you need
to start by specifying which database to use. We expect that you have created
a database and configured an account for it.
</p>
<p>
Modify the connectionString named <code>'Db'</code> in <code>web.config.</code> Click on 'Test Connection' to make sure that it works.
</p>
<form method="post" action="@Url.Action("Connection", "Sql")" style="width: 100%" class="form-inline" id="dbForm">
<div>
<br/><br/>
@Html.Raw(ViewBag.PrevLink)
<button id="saveButton" class="btn">Test Connection</button>
@Html.Raw(ViewBag.NextLink)
</div>
</form>
<br/>
<div class="alert alert-warning" id="error" style="display: none">
</div>
</div>
<div class="col-lg-6">
<h2>Limitation</h2>
<p>
<em>
Currently only Microsoft SQL Server 2012 and above is supported. Need any other DB? Feel free to Contribute
by taking the SqlServer class library and convert it to a library for your favorite DB engine.
</em>
</p>

<h3>Example</h3>
<pre><code>Data Source=(localdb)\ProjectsV12;Initial Catalog=codeRR;Integrated Security=True;Connect Timeout=30;</code></pre>

<h2>Tip!</h2>
<p>
Do you want to give permissions to the IIS app pool? Add <em>"IIS APPPOOL\YourAppPool"</em> as the windows account in SQL Server Management Studio.
</p>
<p>
For instance <code>IIS APPPOOL\DefaultAppPool</code>.
</p>
</div>
</div>
</div>

@section scripts
{

<script type="text/javascript">
$('#saveButton')
.click(function(e) {
e.preventDefault();
var conStr = encodeURIComponent($('[name="connectionString"]').val());
$
.getJSON(
'@Url.RouteUrl(new {Area = "Installation", Controller = "Sql", Action = "Validate"})/?connectionString=' + conStr)
.done(function(data) {
if (data.result == "fail") {
$('#error').text(data.reason).show();
} else {
$('#error').hide();
$("#testConnection").removeClass("btn-primary");
$('#saveButton').removeAttr("disabled").addClass("btn-primary");
humane.log("Connection was successful. Click on the Next button to continue.");
}
});
});
</script>
@{
ViewBag.Title = "Installation - Database configuration";
}
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>Database configuration</h2>
<p>
It's time to configure the database. To do that you need
to start by specifying which database to use. We expect that you have created
a database and configured an account for it.
</p>
<p>
Modify the connectionString named <code>'Db'</code> in <code>web.config.</code> Click on 'Test Connection' to make sure that it works.
</p>
<form method="post" action="@Url.Action("Connection", "Sql")" style="width: 100%" class="form-inline" id="dbForm">
<div>
<br /><br />
@Html.Raw(ViewBag.PrevLink)
<button id="testConnection" class="btn btn-primary">Test Connection</button>
@Html.Raw(ViewBag.NextLink)
</div>
</form>
<br />
<div class="alert alert-warning" id="error" style="display: none">
</div>
</div>
<div class="col-lg-6">
<h2>Limitation</h2>
<p>
<em>
Currently only Microsoft SQL Server 2012 and above is supported. Need any other DB? Feel free to Contribute
by taking the SqlServer class library and convert it to a library for your favorite DB engine.
</em>
</p>
<h3>Example</h3>
<pre><code>Data Source=(localdb)\ProjectsV12;Initial Catalog=codeRR;Integrated Security=True;Connect Timeout=30;</code></pre>
<h2>Tip!</h2>
<p>
Do you want to give permissions to the IIS app pool? Add <em>"IIS APPPOOL\YourAppPool"</em> as the windows account in SQL Server Management Studio.
</p>
<p>
For instance <code>IIS APPPOOL\DefaultAppPool</code>.
</p>
</div>
</div>
</div>
@section scripts
{
<script type="text/javascript">
$('[data-name="nextLink"]').addClass("disabled");
$('#testConnection')
.click(function(e) {
e.preventDefault();
var conStr = encodeURIComponent($('[name="connectionString"]').val());
var url =
'@Url.RouteUrl(new {Area = "Installation", Controller = "Sql", Action = "Validate"})/?connectionString=' +
conStr;
$.post(url,
function (data) {
if (data.result === "fail") {
var reason = data.reason.replace(/\\n/g, "<br>")
.replace(/\\'/g, "'")
.replace(/\\"/g, '"')
.replace(/\\\\/g, '\\')
.replace(/\\&/g, "&")
.replace(/\\r/g, "r")
.replace(/\\t/g, "\t")
.replace(/\\b/g, "\b")
.replace(/\\f/g, "\f");
$('#error').html(reason).show();
} else {
$('#error').hide();
$("#testConnection").removeClass("btn-primary").addClass('btn-default');
$('[data-name="nextLink"]').removeClass('disabled').addClass('btn-primary');
humane.log("Connection was successful. Click on the Next button to continue.");
}
});
});
</script>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

<div class="container">
<div class="col-lg-6">
<div class="col-lg-12">
<h2>Tables</h2>

<p>It's time to install all the tables. Keep your fingers crossed and press "Create Tables"</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static string GetNextWizardStepLink(this UrlHelper urlHelper)

var step = Steps[index];
return
$@"<a class=""btn btn- btn-default"" href=""{urlHelper.Content(step.VirtualPath)}"">{step.Name} &gt;&gt;</a>";
$@"<a class=""btn btn-outline-primary"" data-name=""nextLink"" href=""{urlHelper.Content(step.VirtualPath)}"">{step.Name} &gt;&gt;</a>";
}

public static string GetPreviousWizardStepLink(this UrlHelper urlHelper)
Expand All @@ -53,7 +53,7 @@ public static string GetPreviousWizardStepLink(this UrlHelper urlHelper)

var step = Steps[index];
return
$@"<a class=""btn btn-default"" href=""{urlHelper.Content(step.VirtualPath)}"">&lt;&lt; {step.Name}</a>";
$@"<a class=""btn btn-outline-dark"" href=""{urlHelper.Content(step.VirtualPath)}"">&lt;&lt; {step.Name}</a>";
}

private static int FindCurrentIndex(UrlHelper urlHelper)
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Coderr.Server.Web/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public ActionResult Index(string path)
if (!path.StartsWith("/views", StringComparison.OrdinalIgnoreCase))
return new HttpStatusCodeResult(403);

return PartialView(path);
return PartialView("~" + path);
}
}
}
10 changes: 0 additions & 10 deletions src/Server/Coderr.Server.Web/Nuget/ReadMe.txt

This file was deleted.

Loading

0 comments on commit 536c084

Please sign in to comment.