Skip to content

Commit a9b5e53

Browse files
committed
Added support for Azure configuration settings
Updated Install view to support backend changes Added nCrunch and R# config files
1 parent b964bcb commit a9b5e53

24 files changed

+291
-61
lines changed

.hgignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ glob:build/NuGet/*
7171
*.mdf
7272
*.ldf
7373
AppHarbourConfig.xml
74-
packages/*
74+
packages/*
75+
src/_NCrunch_FunnelWeb

src/FunnelWeb.Azure/ServiceConfiguration.Cloud.cscfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
<ServiceConfiguration serviceName="FunnelWeb.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*" schemaVersion="2012-05.1.7">
33
<Role name="FunnelWeb.Web">
44
<Instances count="1" />
5-
<ConfigurationSettings></ConfigurationSettings>
5+
<ConfigurationSettings>
6+
<Setting name="funnelweb.configuration.database.connection" value="" />
7+
<Setting name="funnelweb.configuration.database.schema" value="dbo" />
8+
<Setting name="funnelweb.configuration.authentication.username" value="test" />
9+
<Setting name="funnelweb.configuration.authentication.password" value="test" />
10+
<Setting name="funnelweb.configuration.database.provider" value="sql" />
11+
</ConfigurationSettings>
612
</Role>
713
</ServiceConfiguration>

src/FunnelWeb.Azure/ServiceConfiguration.Local.cscfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
<ServiceConfiguration serviceName="FunnelWeb.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*" schemaVersion="2012-05.1.7">
33
<Role name="FunnelWeb.Web">
44
<Instances count="1" />
5-
<ConfigurationSettings></ConfigurationSettings>
5+
<ConfigurationSettings>
6+
<Setting name="funnelweb.configuration.database.connection" value="database=FunnelWeb;server=.\SQLEXPRESS;trusted_connection=true;" />
7+
<Setting name="funnelweb.configuration.database.schema" value="dbo" />
8+
<Setting name="funnelweb.configuration.authentication.username" value="test" />
9+
<Setting name="funnelweb.configuration.authentication.password" value="test" />
10+
<Setting name="funnelweb.configuration.database.provider" value="sql" />
11+
</ConfigurationSettings>
612
</Role>
713
</ServiceConfiguration>

src/FunnelWeb.Azure/ServiceDefinition.build.csdef

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,12 @@
2121
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
2222
</Endpoints>
2323
<Imports></Imports>
24+
<ConfigurationSettings>
25+
<Setting name="funnelweb.configuration.database.connection" />
26+
<Setting name="funnelweb.configuration.database.schema" />
27+
<Setting name="funnelweb.configuration.authentication.username" />
28+
<Setting name="funnelweb.configuration.authentication.password" />
29+
<Setting name="funnelweb.configuration.database.provider" />
30+
</ConfigurationSettings>
2431
</WebRole>
2532
</ServiceDefinition>

src/FunnelWeb.Azure/ServiceDefinition.csdef

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
<Endpoints>
1212
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
1313
</Endpoints>
14-
<Imports></Imports>
14+
<Imports>
15+
</Imports>
16+
<ConfigurationSettings>
17+
<Setting name="funnelweb.configuration.database.connection" />
18+
<Setting name="funnelweb.configuration.database.schema" />
19+
<Setting name="funnelweb.configuration.authentication.username" />
20+
<Setting name="funnelweb.configuration.authentication.password" />
21+
<Setting name="funnelweb.configuration.database.provider" />
22+
</ConfigurationSettings>
1523
</WebRole>
1624
</ServiceDefinition>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<ProjectConfiguration>
2+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
3+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
4+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
5+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
6+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
7+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
8+
<RunPreBuildEvents>false</RunPreBuildEvents>
9+
<RunPostBuildEvents>false</RunPostBuildEvents>
10+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
11+
<InstrumentAssembly>true</InstrumentAssembly>
12+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
13+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
14+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
15+
<DefaultTestTimeout>60000</DefaultTestTimeout>
16+
<UseBuildConfiguration />
17+
<ProxyProcessPath />
18+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
19+
</ProjectConfiguration>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<ProjectConfiguration>
2+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
3+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
4+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
5+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
6+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
7+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
8+
<RunPreBuildEvents>false</RunPreBuildEvents>
9+
<RunPostBuildEvents>false</RunPostBuildEvents>
10+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
11+
<InstrumentAssembly>true</InstrumentAssembly>
12+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
13+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
14+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
15+
<DefaultTestTimeout>60000</DefaultTestTimeout>
16+
<UseBuildConfiguration />
17+
<ProxyProcessPath />
18+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
19+
</ProjectConfiguration>

src/FunnelWeb.Web/Areas/Admin/Controllers/InstallController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public virtual ActionResult Index()
4242
model.ConnectionString = connectionString;
4343
model.Schema = databaseProvider.Value.SupportSchema ? schema : null;
4444
model.DatabaseProviderSupportsSchema = databaseProvider.Value.SupportSchema;
45+
model.IsSettingsReadOnly = ConnectionStringProvider.ReadOnlyReason != null;
46+
model.ReadOnlyReason = ConnectionStringProvider.ReadOnlyReason;
4547

4648
if (model.CanConnect)
4749
{

src/FunnelWeb.Web/Areas/Admin/Views/Install/Index.cshtml

Lines changed: 105 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
var verb = Model.IsInstall ? "install" : "upgrade";
1010
var proceed = Model.IsInstall ? "Proceed with Installation" : "Proceed with Upgrade";
1111
}
12-
<h1>
13-
FunnelWeb @properNoun
12+
<h1>FunnelWeb @properNoun
1413
</h1>
1514
<p class='important'>
1615
Welcome to your FunnelWeb installation!
@@ -20,72 +19,123 @@
2019
the database. You will see this page any time you upgrade FunnelWeb.
2120
</p>
2221

23-
<h2>Change Database Provider</h2>
24-
@using (Html.BeginForm("ChangeProvider", "Install", FormMethod.Post, new { Area = "Admin" }))
22+
@if (Model.IsSettingsReadOnly)
2523
{
24+
<h2>Settings Read Only</h2>
25+
@Model.ReadOnlyReason
26+
27+
if (Model.CanConnect)
28+
{
29+
<p class='good'>
30+
The connection string below appears to work. Ready to go.
31+
</p>
32+
}
33+
else
34+
{
35+
<p class='bad'>
36+
The connection string below is invalid. You will need to change it before proceeding
37+
with this @verb. The error was:
38+
</p>
39+
<pre>@Model.ConnectionError</pre>
40+
}
41+
42+
<h3>Current Settings</h3>
43+
2644
<div class="form-body">
2745
<div class="editor-label">
28-
@Html.LabelFor(m => m.DatabaseProvider)
46+
@Html.LabelFor(m => m.DatabaseProvider):
2947
</div>
3048
<div class="editor-field">
31-
@Html.DropDownListFor(
32-
m => m.DatabaseProvider,
33-
Model.DatabaseProviders.Select(provider=>new SelectListItem
34-
{
35-
Text = provider,
36-
Value = provider,
37-
Selected = provider == Model.DatabaseProvider
38-
}))
39-
<input type="submit" id="changeProvider" class="submit" value="Change Provider" />
49+
@Html.TextBoxFor(
50+
m => m.DatabaseProvider,
51+
new{ @readonly = true})
4052
</div>
53+
54+
<div class="editor-label">
55+
@Html.LabelFor(m => m.ConnectionString):
4156
</div>
42-
}
43-
<h2>
44-
Change Connection String</h2>
45-
@if (Model.CanConnect)
46-
{
47-
<p class='good'>
48-
The connection string below appears to work. However, you can change it if you wish
49-
to use an alternative database.
50-
</p>
51-
}
52-
else
53-
{
54-
<p class='bad'>
55-
The connection string below is invalid. You will need to change it before proceeding
56-
with this @verb. The error was:
57-
</p>
58-
<pre>@Model.ConnectionError</pre>
59-
}
60-
61-
@using (Html.BeginForm("Test", "Install", FormMethod.Post, new { Area = "Admin" }))
62-
{
63-
<div class="form-body">
57+
<div class="editor-field">
58+
@Html.TextAreaFor(m => m.ConnectionString, new{ @readonly = true})
59+
</div>
60+
@if (Model.DatabaseProviderSupportsSchema)
61+
{
6462
<div class="editor-label">
65-
@Html.LabelFor(m => m.ConnectionString)
63+
@Html.LabelFor(m => m.Schema):
6664
</div>
6765
<div class="editor-field">
68-
@Html.TextAreaFor(m => m.ConnectionString, Html.AttributesFor(m => m.ConnectionString))
69-
@Html.ValidationMessageFor(m => m.ConnectionString)
70-
@Html.HintFor(m => m.ConnectionString)
66+
@Html.TextBoxFor(m => m.Schema, new{ @readonly = true})
7167
</div>
72-
@if (Model.DatabaseProviderSupportsSchema)
73-
{
68+
}
69+
</div>
70+
}
71+
else
72+
{
73+
<h2>Change Database Provider</h2>
74+
using (Html.BeginForm("ChangeProvider", "Install", FormMethod.Post, new { Area = "Admin" }))
75+
{
76+
<div class="form-body">
7477
<div class="editor-label">
75-
@Html.LabelFor(m => m.Schema)
78+
@Html.LabelFor(m => m.DatabaseProvider)
7679
</div>
7780
<div class="editor-field">
78-
@Html.TextBoxFor(m => m.Schema, Html.AttributesFor(m => m.ConnectionString))
79-
@Html.ValidationMessageFor(m => m.Schema)
80-
@Html.HintFor(m => m.Schema)
81+
@Html.DropDownListFor(
82+
m => m.DatabaseProvider,
83+
Model.DatabaseProviders.Select(provider => new SelectListItem
84+
{
85+
Text = provider,
86+
Value = provider,
87+
Selected = provider == Model.DatabaseProvider
88+
}))
89+
<input type="submit" id="changeProvider" class="submit" value="Change Provider" />
8190
</div>
82-
}
83-
<div class="editor-label">
8491
</div>
85-
<div class="editor-field">
86-
<input type="submit" id="submit" class="submit" value="Save and Test" />
92+
}
93+
<h2>Change Connection String</h2>
94+
if (Model.CanConnect)
95+
{
96+
<p class='good'>
97+
The connection string below appears to work. However, you can change it if you wish
98+
to use an alternative database.
99+
</p>
100+
}
101+
else
102+
{
103+
<p class='bad'>
104+
The connection string below is invalid. You will need to change it before proceeding
105+
with this @verb. The error was:
106+
</p>
107+
<pre>@Model.ConnectionError</pre>
108+
}
109+
using (Html.BeginForm("Test", "Install", FormMethod.Post, new { Area = "Admin" }))
110+
{
111+
<div class="form-body">
112+
<div class="editor-label">
113+
@Html.LabelFor(m => m.ConnectionString)
114+
</div>
115+
<div class="editor-field">
116+
@Html.TextAreaFor(m => m.ConnectionString, Html.AttributesFor(m => m.ConnectionString))
117+
@Html.ValidationMessageFor(m => m.ConnectionString)
118+
@Html.HintFor(m => m.ConnectionString)
119+
</div>
120+
@if (Model.DatabaseProviderSupportsSchema)
121+
{
122+
<div class="editor-label">
123+
@Html.LabelFor(m => m.Schema)
124+
</div>
125+
<div class="editor-field">
126+
@Html.TextBoxFor(m => m.Schema, Html.AttributesFor(m => m.ConnectionString))
127+
@Html.ValidationMessageFor(m => m.Schema)
128+
@Html.HintFor(m => m.Schema)
129+
</div>
130+
}
131+
<div class="editor-label">
132+
</div>
133+
<div class="editor-field">
134+
<input type="submit" id="submit" class="submit" value="Save and Test" />
135+
</div>
87136
</div>
88-
</div>
137+
}
138+
89139
}
90140
@if (Model.CanConnect)
91141
{
@@ -111,9 +161,11 @@ else
111161
{
112162
<text>
113163
<p class='good'>
114-
Your database is up to date. No @verb is necessary.</p>
164+
Your database is up to date. No @verb is necessary.
165+
</p>
115166
<p class='important'>
116-
<a href="@Url.Content("~/")">Sweet!</a></p>
167+
<a href="@Url.Content("~/")">Sweet!</a>
168+
</p>
117169
</text>
118170
}
119171
else

src/FunnelWeb.Web/Areas/Admin/Views/Install/IndexModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ public class IndexModel
2828
public string DatabaseProvider { get; set; }
2929

3030
public bool DatabaseProviderSupportsSchema { get; set; }
31+
32+
public bool IsSettingsReadOnly { get; set; }
33+
34+
public string ReadOnlyReason { get; set; }
3135
}
3236
}

0 commit comments

Comments
 (0)