Skip to content

Commit 03b5eb8

Browse files
committed
User feedback that the Azure connection was not valid
1 parent abc5365 commit 03b5eb8

File tree

3 files changed

+61
-34
lines changed

3 files changed

+61
-34
lines changed

src/UmbracoFileSystemProviders.Azure.Installer/Configurator/Controllers/Configure.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ configApp.controller("Loader", function ($scope, $http, $log) {
1515
e.preventDefault();
1616

1717
$http.post(postDataUrl, $scope.parameters).success(function (data) {
18-
$scope.saved = true;
19-
if (typeof data === 'string') {
20-
$scope.status = JSON.parse(data);
18+
19+
var status;
20+
if (typeof data === "string") {
21+
status = JSON.parse(data);
2122
} else {
22-
$scope.status = data;
23+
status = data;
2324
}
25+
26+
$scope.status = status;
27+
28+
if (status !== "ConnectionError") {
29+
$scope.saved = true;
30+
}
31+
2432
});
2533

2634
}

src/UmbracoFileSystemProviders.Azure.Installer/Configurator/Views/Configure.ascx

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,55 @@
44

55
<div ng-app ="UFSPLoader">
66
<div ng-controller="Loader">
7-
<div>
8-
<img src="/App_Plugins/UmbracoFileSystemProviders/Azure/Install/azure-logo-32.png"/>
7+
<div class="row">
8+
<div class="span1">
9+
<img src="/App_Plugins/UmbracoFileSystemProviders/Azure/Install/azure-logo-32.png"/>
10+
</div>
11+
<div><h4>Umbraco Azure File System Provider</h4></div>
912
</div>
10-
<fieldset ng-show="!saved">
11-
<legend>Please enter the required parameters for the Azure storage provider below</legend>
12-
<form name="paramForm" class="form-horizontal" role="form">
13-
<div ng-repeat="param in parameters" class="control-group">
14-
<ng-form name="form">
15-
<label class="control-label" for="param.Key">{{ capitalizeFirstLetter(param.Key) }}</label>
16-
<div class="controls">
17-
<input
18-
class ="input-block-level"
19-
dynamic-name="param.Key"
20-
type="text"
21-
ng-model="param.Value"
22-
required
23-
>
24-
</div>
25-
<span data-ng-show=" {{'form.'+param.Key+'.$dirty && form.'+param.Key+'.$error.required'}}">Required!</span>
26-
</ng-form>
27-
</div>
28-
<button preventDefault class="btn btn-primary" ng-disabled="paramForm.$invalid" ng-click="submitForm($event)">Save</button>
29-
</form>
30-
</fieldset>
31-
<div ng-show="saved && status === 'Ok'">
32-
<h3>The Azure storage provider was sucessfully configured and your media is now as light as candyfloss</h3>
13+
<div class="row">
14+
<div><hr /></div>
3315
</div>
34-
<div ng-show="saved && status != 'Ok'">
35-
<h3>Oh no, something went wrong saving, please check Umbraco log files for exceptions</h3>
16+
<div class="row" ng-show="!saved">
17+
<div>
18+
<fieldset>
19+
<legend><h4>To complete installation, please enter the required parameters for the Azure storage provider below</h4></legend>
20+
<form name="paramForm" class="form-horizontal" role="form">
21+
<div ng-repeat="param in parameters" class="control-group">
22+
<ng-form name="form">
23+
<label class="control-label" for="param.Key">{{ capitalizeFirstLetter(param.Key) }}</label>
24+
<div class="controls">
25+
<input
26+
class ="input-block-level"
27+
dynamic-name="param.Key"
28+
type="text"
29+
ng-model="param.Value"
30+
required
31+
>
32+
</div>
33+
<span data-ng-show=" {{'form.'+param.Key+'.$dirty && form.'+param.Key+'.$error.required'}}">Required!</span>
34+
</ng-form>
35+
</div>
36+
<button preventDefault class="btn btn-primary" ng-disabled="paramForm.$invalid" ng-click="submitForm($event)">Save</button>
37+
</form>
38+
</fieldset>
39+
</div>
40+
</div>
41+
<div class="row" ng-show="!saved">
42+
<div><hr /></div>
43+
</div>
44+
45+
<div class="row">
46+
<div class="alert alert-success" ng-show="saved && status === 'Ok'">
47+
The Azure storage provider was sucessfully configured and your media is now as light as candyfloss
48+
</div>
49+
<div class="alert alert-error" ng-show="saved && status != 'Ok'">
50+
<strong>Oh no</strong>, something went wrong saving, please check Umbraco log files for exceptions
51+
</div>
52+
<div class="alert alert-error" ng-show="!saved && status === 'ConnectionError'">
53+
<strong>Oh no</strong>, there was something wrong with your Azure connection string, please check and try again, more info in the Umbraco log files
54+
</div>
3655
</div>
56+
3757
</div>
3858
</div>

src/UmbracoFileSystemProviders.Azure.Installer/InstallerController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,9 @@ internal static IEnumerable<Parameter> GetParametersFromXml(string xmlPath)
166166

167167
private bool TestAzureCredentials(string connectionString, string containerName)
168168
{
169-
bool useEmulator = ConfigurationManager.AppSettings[Azure.Constants.Configuration.UseStorageEmulatorKey] != null
169+
var useEmulator = ConfigurationManager.AppSettings[Azure.Constants.Configuration.UseStorageEmulatorKey] != null
170170
&& ConfigurationManager.AppSettings[Azure.Constants.Configuration.UseStorageEmulatorKey]
171171
.Equals("true", StringComparison.InvariantCultureIgnoreCase);
172-
173172
try
174173
{
175174
CloudStorageAccount cloudStorageAccount;
@@ -185,7 +184,7 @@ private bool TestAzureCredentials(string connectionString, string containerName)
185184
var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
186185
var blobContainer = cloudBlobClient.GetContainerReference(containerName);
187186

188-
// this should fully check that the connection works
187+
// this should fully check that the connection works, the result is not relevant
189188
var blobExists = blobContainer.Exists();
190189
}
191190
catch (Exception e)

0 commit comments

Comments
 (0)