mirror of
https://github.com/farcasclaudiu/LanBackup.git
synced 2026-06-28 15:00:58 +03:00
status with colored box
minor fixes
This commit is contained in:
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%;
|
top:45%;
|
||||||
position:relative;
|
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">
|
<table class="table table-hover table-fixed table-condensed table-striped anyLoadingTable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Computer IP</th>
|
<th width="10%">Computer IP</th>
|
||||||
<th>Config ID</th>
|
<th width="25%">Config ID</th>
|
||||||
<th width="1%"></th>
|
<th width="1%"></th>
|
||||||
<th width="30%">Status</th>
|
<th width="40%">Status</th>
|
||||||
<th>Progress</th>
|
<th>Progress</th>
|
||||||
<th width="15%">Last Report</th>
|
<th width="15%">Last Report</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<tr *ngFor="let agent of list | paginate: { id: 'pagedList', itemsPerPage: pageSize, currentPage: currentPage, totalItems: totalPages }">
|
<tr *ngFor="let agent of list | paginate: { id: 'pagedList', itemsPerPage: pageSize, currentPage: currentPage, totalItems: totalPages }">
|
||||||
<td>{{agent.ip}}</td>
|
<td>{{agent.ip}}</td>
|
||||||
<td>{{agent.configurationId ? agent.configurationId : '---'}}</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.statusDescription}}</td>
|
||||||
<td>
|
<td>
|
||||||
<!--agent.statusPercent-->
|
<!--agent.statusPercent-->
|
||||||
|
|||||||
@@ -6,5 +6,7 @@ namespace LanBackup.WebApp.Models.Telemetry
|
|||||||
{
|
{
|
||||||
void TrackException(Exception ex);
|
void TrackException(Exception ex);
|
||||||
void TrackEvent(string v);
|
void TrackEvent(string v);
|
||||||
|
|
||||||
|
bool IsEnabled { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,36 @@ namespace LanBackup.WebApp.Models.Telemetry
|
|||||||
{
|
{
|
||||||
private TelemetryClient _telemetryClient;
|
private TelemetryClient _telemetryClient;
|
||||||
|
|
||||||
|
private bool isEnabled;
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isEnabled = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public TelemetryLogger(TelemetryClient telemetryClient)
|
public TelemetryLogger(TelemetryClient telemetryClient)
|
||||||
{
|
{
|
||||||
this._telemetryClient = telemetryClient;
|
this._telemetryClient = telemetryClient;
|
||||||
|
this.IsEnabled = telemetryClient.IsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackEvent(string eventmsg)
|
public void TrackEvent(string eventmsg)
|
||||||
{
|
{
|
||||||
this._telemetryClient.TrackEvent(eventmsg);
|
if(this.IsEnabled)
|
||||||
|
this._telemetryClient.TrackEvent(eventmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackException(Exception ex)
|
public void TrackException(Exception ex)
|
||||||
{
|
{
|
||||||
this._telemetryClient.TrackException(ex);
|
if(this.IsEnabled)
|
||||||
|
this._telemetryClient.TrackException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using LanBackup.WebApp.Data;
|
using LanBackup.WebApp.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using LanBackup.DataCore;
|
using LanBackup.DataCore;
|
||||||
using LanBackup.WebApp.Models;
|
using LanBackup.WebApp.Models;
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
@@ -21,11 +20,9 @@ using LanBackup.WebApp.Hubs;
|
|||||||
using LanBackup.WebApp.Middleware;
|
using LanBackup.WebApp.Middleware;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using LanBackup.ModelsCore;
|
|
||||||
using LanBackup.WebApp.Models.DTO;
|
|
||||||
using LanBackup.WebApp.Controllers;
|
using LanBackup.WebApp.Controllers;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using LanBackup.WebApp.Models.Telemetry;
|
using LanBackup.WebApp.Models.Telemetry;
|
||||||
|
using Microsoft.ApplicationInsights.Extensibility;
|
||||||
|
|
||||||
namespace LanBackup.WebApp
|
namespace LanBackup.WebApp
|
||||||
{
|
{
|
||||||
@@ -33,6 +30,7 @@ namespace LanBackup.WebApp
|
|||||||
{
|
{
|
||||||
|
|
||||||
public const string AuthenticationSchemeName = "MyAuthScheme";
|
public const string AuthenticationSchemeName = "MyAuthScheme";
|
||||||
|
private bool isApplicationInsightEnabled = false;
|
||||||
|
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IHostingEnvironment env)
|
||||||
{
|
{
|
||||||
@@ -52,6 +50,8 @@ namespace LanBackup.WebApp
|
|||||||
builder.AddEnvironmentVariables();
|
builder.AddEnvironmentVariables();
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
|
|
||||||
|
this.isApplicationInsightEnabled = Configuration.GetSection("AppSettings").GetValue<bool>("InstrumentationEnabled");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; }
|
public IConfigurationRoot Configuration { get; }
|
||||||
@@ -62,6 +62,7 @@ namespace LanBackup.WebApp
|
|||||||
|
|
||||||
//AppInsighttelemetry
|
//AppInsighttelemetry
|
||||||
services.AddApplicationInsightsTelemetry(Configuration);
|
services.AddApplicationInsightsTelemetry(Configuration);
|
||||||
|
TelemetryConfiguration.Active.DisableTelemetry = !Configuration.GetSection("AppSettings").GetValue<bool>("InstrumentationEnabled");
|
||||||
|
|
||||||
//conf telemetry logger
|
//conf telemetry logger
|
||||||
services.AddSingleton<ITelemetryLogger, TelemetryLogger>();
|
services.AddSingleton<ITelemetryLogger, TelemetryLogger>();
|
||||||
@@ -138,7 +139,8 @@ namespace LanBackup.WebApp
|
|||||||
loggerFactory.AddFile(Configuration["FileLogging:Path"]);
|
loggerFactory.AddFile(Configuration["FileLogging:Path"]);
|
||||||
|
|
||||||
// Add Application Insights monitoring to the request pipeline as a very first middleware.
|
// Add Application Insights monitoring to the request pipeline as a very first middleware.
|
||||||
app.UseApplicationInsightsRequestTelemetry();
|
if(this.isApplicationInsightEnabled)
|
||||||
|
app.UseApplicationInsightsRequestTelemetry();
|
||||||
|
|
||||||
//conf CORS
|
//conf CORS
|
||||||
app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
|
app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
|
||||||
@@ -162,7 +164,8 @@ namespace LanBackup.WebApp
|
|||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
}
|
}
|
||||||
// Add Application Insights exceptions handling to the request pipeline. - after error page and any other error handling middleware:
|
// 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();
|
app.UseStaticFiles();
|
||||||
@@ -206,8 +209,6 @@ namespace LanBackup.WebApp
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RolesData.SeedDbWithData(app.ApplicationServices).Wait();
|
RolesData.SeedDbWithData(app.ApplicationServices).Wait();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
function setClientSetting(setting, val)
|
function setClientSetting(setting, val)
|
||||||
{
|
{
|
||||||
clientSettings[setting] = val;
|
clientSettings[setting] = val;
|
||||||
clientSettings.admin_email = val;
|
|
||||||
}
|
}
|
||||||
setClientSetting('admin_email', '@ClientConfiguration.Instance.ClientSettings.AdminEmail');
|
setClientSetting('admin_email', '@ClientConfiguration.Instance.ClientSettings.AdminEmail');
|
||||||
setClientSetting('instrumentationEnabled', '@ClientConfiguration.Instance.ClientSettings.InstrumentationEnabled');
|
setClientSetting('instrumentationEnabled', '@ClientConfiguration.Instance.ClientSettings.InstrumentationEnabled');
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
"InstrumentationEnabled": false,
|
"InstrumentationEnabled": false,
|
||||||
"InstrumentationKey": "YOUR_OWN_KEY"
|
"InstrumentationKey": "YOUR_OWN_KEY"
|
||||||
},
|
},
|
||||||
|
"AppSettings": {
|
||||||
|
"InstrumentationEnabled": false
|
||||||
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-LanBackup.WebApp-d5f6c3b5-64d7-4d41-8000-1e69f75536f7;Trusted_Connection=True;MultipleActiveResultSets=true",
|
"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;"
|
"BackupsConnectionString": "Server=(localdb)\\mssqllocaldb;Database=BackupsLAN;Trusted_Connection=True;"
|
||||||
|
|||||||
@@ -5,6 +5,20 @@ namespace LanBackup.WebApp.Tests.IntegrationTests
|
|||||||
{
|
{
|
||||||
internal class MockTelemetry : ITelemetryLogger
|
internal class MockTelemetry : ITelemetryLogger
|
||||||
{
|
{
|
||||||
|
private bool isEnabled;
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isEnabled = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TrackEvent(string eventmsg)
|
public void TrackEvent(string eventmsg)
|
||||||
{
|
{
|
||||||
//DO NOTHING
|
//DO NOTHING
|
||||||
|
|||||||
Reference in New Issue
Block a user