Skip to content

Commit cd70b5c

Browse files
committed
Logs in dashboard display as raw file instead of list
1 parent 1ded960 commit cd70b5c

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

BlogEngine/BlogEngine.Core/Data/ViewModels/DashboardVM.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ public List<QuickNote> Notes
102102
/// <summary>
103103
/// Log items counter
104104
/// </summary>
105-
public List<SelectOption> Logs
105+
public string Logs
106106
{
107107
get
108108
{
109-
return GetLogFile().ToList();
109+
return GetLogFile();
110110
}
111111
}
112112

@@ -216,7 +216,7 @@ private void LoadTrash()
216216
Trash = _trash;
217217
}
218218

219-
IEnumerable<SelectOption> GetLogFile()
219+
IEnumerable<SelectOption> GetLogs()
220220
{
221221
string fileLocation = HostingEnvironment.MapPath(Path.Combine(BlogConfig.StorageLocation, "logger.txt"));
222222
var items = new List<SelectOption>();
@@ -259,6 +259,24 @@ IEnumerable<SelectOption> GetLogFile()
259259
}
260260
}
261261

262+
string GetLogFile()
263+
{
264+
string fileLocation = HostingEnvironment.MapPath(Path.Combine(BlogConfig.StorageLocation, "logger.txt"));
265+
var items = new List<SelectOption>();
266+
267+
if (File.Exists(fileLocation))
268+
{
269+
using (var sw = new StreamReader(fileLocation))
270+
{
271+
return sw.ReadToEnd();
272+
}
273+
}
274+
else
275+
{
276+
return string.Empty;
277+
}
278+
}
279+
262280
#endregion
263281
}
264282
}

BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
[assembly: CLSCompliant(false)]
2020
[assembly: ComVisible(false)]
2121
[assembly: AllowPartiallyTrustedCallers]
22-
[assembly: AssemblyVersion("3.1.4.0")]
22+
[assembly: AssemblyVersion("3.1.4.1")]
2323
[assembly: SecurityRules(SecurityRuleSet.Level1)]

BlogEngine/BlogEngine.NET/admin/app/dashboard/dashboardView.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
<h4 class="modal-title">{{lbl.logFile}}</h4>
88
</div>
99
<div class="modal-body logs-list">
10-
<ul class="list-group">
11-
<li class="list-group-item" data-ng-repeat="log in vm.Logs">
12-
<div ng-bind-html="log.OptionValue"></div>
13-
</li>
14-
</ul>
10+
<div class="form-group">
11+
<textarea ng-bind="vm.Logs" rows="12" maxlength="450" class="form-control" id="txtLogs"></textarea>
12+
</div>
1513
<div class="modal-buttons text-right">
1614
<button type="button" data-ng-if="vm.Logs.length > 0" data-ng-click="purgeLog()" class="btn btn-hasicon btn-danger"><i class="fa fa-trash"></i> {{lbl.purge}}</button>
1715
<button type="button" class="btn btn-default" data-dismiss="modal">{{lbl.close}}</button>
@@ -46,7 +44,7 @@ <h4 class="modal-title">{{lbl.trash}}</h4>
4644
<div class="page-header clearfix">
4745
<div class="page-title pull-left">{{lbl.dashboard}}</div>
4846
<a ng-click="openTrash()" ng-if="vm.Trash.length > 0" class="icon-header-dashboard icon-header-trash pull-right" angular-tooltip tooltip="lbl.trash"><i class="fa fa-trash-o"></i> <span>{{vm.Trash.length}}</span></a>
49-
<a ng-click="openLogFile()" ng-if="vm.Logs.length > 0" class="icon-header-dashboard icon-header-logs pull-right" angular-tooltip tooltip="lbl.logs"><i class="fa fa-warning"></i> <span>{{vm.Logs.length}}</span></a>
47+
<a ng-click="openLogFile()" ng-if="vm.Logs.length > 0" class="icon-header-dashboard icon-header-logs pull-right" angular-tooltip tooltip="lbl.logs"><i class="fa fa-warning"></i></a>
5048
</div>
5149
<div class="content-inner content-dashboard">
5250
<div class="version-alert" id="versionMsg">

0 commit comments

Comments
 (0)