status with colored box

minor fixes
This commit is contained in:
2017-02-02 13:56:26 +02:00
parent 2cdc6a54b3
commit 4fbf5f7d13
10 changed files with 79 additions and 15 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 30 KiB

@@ -71,3 +71,31 @@ body {
top:45%;
position:relative;
}
.statusIcon{
width: 10px;
height: 10px;
border:1px solid #444;
margin-top: 3px;
}
/*idle*/
.statusIcon_0 {
background-color: lightgray;
}
/*starting*/
.statusIcon_1 {
background-color: lightgreen;
}
/*copy folders files*/
.statusIcon_2, .statusIcon_3{
background-color: forestgreen;
}
/*error*/
.statusIcon_4 {
background-color: firebrick;
}
@@ -26,10 +26,10 @@
<table class="table table-hover table-fixed table-condensed table-striped anyLoadingTable">
<thead>
<tr>
<th>Computer IP</th>
<th>Config ID</th>
<th width="10%">Computer IP</th>
<th width="25%">Config ID</th>
<th width="1%"></th>
<th width="30%">Status</th>
<th width="40%">Status</th>
<th>Progress</th>
<th width="15%">Last Report</th>
</tr>
@@ -39,7 +39,7 @@
<tr *ngFor="let agent of list | paginate: { id: 'pagedList', itemsPerPage: pageSize, currentPage: currentPage, totalItems: totalPages }">
<td>{{agent.ip}}</td>
<td>{{agent.configurationId ? agent.configurationId : '---'}}</td>
<td>{{agent.statusType}}</td>
<td style="vertical-align:top; text-align:right;"><div class="statusIcon statusIcon_{{agent.statusType}}"></div></td>
<td>{{agent.statusDescription}}</td>
<td>
<!--agent.statusPercent-->
@@ -6,5 +6,7 @@ namespace LanBackup.WebApp.Models.Telemetry
{
void TrackException(Exception ex);
void TrackEvent(string v);
bool IsEnabled { get; set; }
}
}
@@ -7,19 +7,36 @@ namespace LanBackup.WebApp.Models.Telemetry
{
private TelemetryClient _telemetryClient;
private bool isEnabled;
public bool IsEnabled
{
get
{
return isEnabled;
}
set
{
isEnabled = value;
}
}
public TelemetryLogger(TelemetryClient telemetryClient)
{
this._telemetryClient = telemetryClient;
this.IsEnabled = telemetryClient.IsEnabled();
}
public void TrackEvent(string eventmsg)
{
this._telemetryClient.TrackEvent(eventmsg);
if(this.IsEnabled)
this._telemetryClient.TrackEvent(eventmsg);
}
public void TrackException(Exception ex)
{
this._telemetryClient.TrackException(ex);
if(this.IsEnabled)
this._telemetryClient.TrackException(ex);
}
}
+9 -8
View File
@@ -7,7 +7,6 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using LanBackup.WebApp.Data;
using Microsoft.EntityFrameworkCore;
using LanBackup.DataCore;
using LanBackup.WebApp.Models;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
@@ -21,11 +20,9 @@ using LanBackup.WebApp.Hubs;
using LanBackup.WebApp.Middleware;
using System.Linq;
using AutoMapper;
using LanBackup.ModelsCore;
using LanBackup.WebApp.Models.DTO;
using LanBackup.WebApp.Controllers;
using Microsoft.AspNetCore.Http;
using LanBackup.WebApp.Models.Telemetry;
using Microsoft.ApplicationInsights.Extensibility;
namespace LanBackup.WebApp
{
@@ -33,6 +30,7 @@ namespace LanBackup.WebApp
{
public const string AuthenticationSchemeName = "MyAuthScheme";
private bool isApplicationInsightEnabled = false;
public Startup(IHostingEnvironment env)
{
@@ -52,6 +50,8 @@ namespace LanBackup.WebApp
builder.AddEnvironmentVariables();
Configuration = builder.Build();
this.isApplicationInsightEnabled = Configuration.GetSection("AppSettings").GetValue<bool>("InstrumentationEnabled");
}
public IConfigurationRoot Configuration { get; }
@@ -62,6 +62,7 @@ namespace LanBackup.WebApp
//AppInsighttelemetry
services.AddApplicationInsightsTelemetry(Configuration);
TelemetryConfiguration.Active.DisableTelemetry = !Configuration.GetSection("AppSettings").GetValue<bool>("InstrumentationEnabled");
//conf telemetry logger
services.AddSingleton<ITelemetryLogger, TelemetryLogger>();
@@ -138,7 +139,8 @@ namespace LanBackup.WebApp
loggerFactory.AddFile(Configuration["FileLogging:Path"]);
// Add Application Insights monitoring to the request pipeline as a very first middleware.
app.UseApplicationInsightsRequestTelemetry();
if(this.isApplicationInsightEnabled)
app.UseApplicationInsightsRequestTelemetry();
//conf CORS
app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
@@ -162,7 +164,8 @@ namespace LanBackup.WebApp
app.UseExceptionHandler("/Home/Error");
}
// Add Application Insights exceptions handling to the request pipeline. - after error page and any other error handling middleware:
app.UseApplicationInsightsExceptionTelemetry();
if(this.isApplicationInsightEnabled)
app.UseApplicationInsightsExceptionTelemetry();
app.UseStaticFiles();
@@ -206,8 +209,6 @@ namespace LanBackup.WebApp
RolesData.SeedDbWithData(app.ApplicationServices).Wait();
}
@@ -22,7 +22,6 @@
function setClientSetting(setting, val)
{
clientSettings[setting] = val;
clientSettings.admin_email = val;
}
setClientSetting('admin_email', '@ClientConfiguration.Instance.ClientSettings.AdminEmail');
setClientSetting('instrumentationEnabled', '@ClientConfiguration.Instance.ClientSettings.InstrumentationEnabled');
+3
View File
@@ -4,6 +4,9 @@
"InstrumentationEnabled": false,
"InstrumentationKey": "YOUR_OWN_KEY"
},
"AppSettings": {
"InstrumentationEnabled": false
},
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-LanBackup.WebApp-d5f6c3b5-64d7-4d41-8000-1e69f75536f7;Trusted_Connection=True;MultipleActiveResultSets=true",
"BackupsConnectionString": "Server=(localdb)\\mssqllocaldb;Database=BackupsLAN;Trusted_Connection=True;"
@@ -5,6 +5,20 @@ namespace LanBackup.WebApp.Tests.IntegrationTests
{
internal class MockTelemetry : ITelemetryLogger
{
private bool isEnabled;
public bool IsEnabled
{
get
{
return isEnabled;
}
set
{
isEnabled = value;
}
}
public void TrackEvent(string eventmsg)
{
//DO NOTHING