Skip to content
This repository was archived by the owner on Nov 10, 2017. It is now read-only.

Commit 669d448

Browse files
committed
Issue #1 fixed.
1 parent a95ae83 commit 669d448

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/Sitecore.Azure.Diagnostics.UI/sitecore/Shell/Applications/Blobs/BlobLister/BlobListerForm.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using Sitecore.Azure.Diagnostics.Storage;
34
using Sitecore.Diagnostics;
45
using Sitecore.Exceptions;
@@ -94,7 +95,7 @@ protected override void OnLoad([NotNull] EventArgs e)
9495
this.FileLister.Controls.Add(item);
9596

9697
item.ID = Control.GetUniqueID("I");
97-
item.Header = blob.Parent != null ? blob.Parent.Uri.MakeRelativeUri(blob.Uri).ToString() : blob.Name;
98+
item.Header = blob.Uri.Segments.Last();
9899
item.Icon = "Applications/16x16/document.png";
99100
item.ServerProperties["Blob"] = blob.Name;
100101
item.ColumnValues["size"] = MainUtil.FormatSize(blob.Properties.Length);

src/Sitecore.Azure.Diagnostics.UI/sitecore/Shell/Applications/Reports/LogViewer/LogViewerForm.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Linq;
34
using System.Web;
45
using Sitecore.Azure.Diagnostics.Storage;
56
using Sitecore.Diagnostics;
@@ -127,7 +128,7 @@ public void Delete([NotNull] ClientPipelineArgs args)
127128
}
128129

129130
var blob = LogStorageManager.GetBlob(blobName);
130-
blobName = blob.Parent != null ? blob.Parent.Uri.MakeRelativeUri(blob.Uri).ToString() : blob.Name;
131+
blobName = blob.Uri.Segments.Last();
131132
SheerResponse.Confirm(Translate.Text(Texts.ARE_YOU_SURE_YOU_WANT_TO_DELETE_0, blobName));
132133

133134
args.WaitForPostBack();

src/Sitecore.Azure.Diagnostics/Storage/AzureBlobStorageProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public virtual ICollection<ICloudBlob> ListBlobs(CloudBlobContainer container, s
332332
string startPattern = searchPattern.Split(maskSymbol).First();
333333
string endPattern = searchPattern.Split(maskSymbol).Last();
334334

335-
filteredBlobList = blobList.Where(w => w.Name.StartsWith(startPattern) && w.Name.EndsWith(endPattern)).ToList();
335+
filteredBlobList = blobList.Where(w => w.Uri.Segments.Last().StartsWith(startPattern) && w.Uri.Segments.Last().EndsWith(endPattern)).ToList();
336336
}
337337

338338
return filteredBlobList;

src/Sitecore.Azure.Diagnostics/Tasks/BlobCleaner.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,11 @@ protected void Cleanup(CloudBlobContainer container)
104104
var candidateBlobs = this.GetCandidateBlobs(container, this.BlobSearchPattern);
105105
if (candidateBlobs.Any())
106106
{
107-
Log.Info(string.Format("Scheduling.BlobsCleanupAgent: The '{0}' cloud blobs candidate are going to be deleted.", candidateBlobs.Count()), this);
108107
this.DeleteBlobs(candidateBlobs);
109108
}
110109
else
111110
{
112-
Log.Info(string.Format("Scheduling.BlobsCleanupAgent: The '{0}' cloud blob container does not have any blobs that match the '{1}' search pattern.", container.Name, this.BlobSearchPattern), this);
111+
Log.Info(string.Format("Scheduling.BlobsCleanupAgent: The '{0}' cloud blob container does not have any out-to-date blobs that match the '{1}' search pattern.", container.Name, this.BlobSearchPattern), this);
113112
}
114113
}
115114

@@ -125,9 +124,9 @@ protected ICollection<ICloudBlob> GetCandidateBlobs(CloudBlobContainer container
125124
Assert.ArgumentNotNull(searchPattern, "searchPattern");
126125

127126
var blobList = LogStorageManager.ListBlobs(container, searchPattern);
128-
var candidateBlobList = new List<ICloudBlob>();
127+
Log.Info(string.Format("Scheduling.BlobsCleanupAgent: The '{0}' cloud blob container includes '{1}' blobs that match the '{2}' search pattern.", container.Name, blobList.Count(), searchPattern), this);
129128

130-
Log.Info(string.Format("Scheduling.BlobsCleanupAgent: Getting cloud blobs candidate for cleaning up."), this);
129+
var candidateBlobList = new List<ICloudBlob>();
131130

132131
foreach (ICloudBlob blob in blobList)
133132
{
@@ -141,6 +140,11 @@ protected ICollection<ICloudBlob> GetCandidateBlobs(CloudBlobContainer container
141140
}
142141
}
143142
}
143+
144+
if (candidateBlobList.Any())
145+
{
146+
Log.Info(string.Format("Scheduling.BlobsCleanupAgent: The '{0}' cloud blob container includes '{1}' out-to-date blobs that match the '{2}' search pattern.", container.Name, candidateBlobList.Count(), searchPattern), this);
147+
}
144148

145149
return candidateBlobList;
146150
}

0 commit comments

Comments
 (0)