Continuo cleanup da Blazorise's components

This commit is contained in:
Samuele Locatelli
2022-02-22 16:24:32 +01:00
parent e345e61d8a
commit fef6d4ccfc
13 changed files with 81 additions and 79 deletions
-8
View File
@@ -188,14 +188,6 @@ namespace MP.Prog
.AddEntityFrameworkStores<UserIdentityDbContext>();
#endif
#if false
services.AddBlazorise(options =>
{
options.ChangeTextOnKeyPress = true; // optional
})
.AddBootstrapProviders()
.AddFontAwesomeIcons();
#endif
//// Elmah
//services.AddElmah();
//string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;";
+18 -7
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blazorise.Charts;
using Microsoft.AspNetCore.Components;
using MP.Stats.Data;
@@ -85,8 +84,10 @@ namespace MP.Stats.Components
AspectRatio = 1
};
#if false
protected PieChart<double> PieVC = new PieChart<double>();
protected LineChart<double> TimeSerieVC = new LineChart<double>();
protected LineChart<double> TimeSerieVC = new LineChart<double>();
#endif
#endregion Protected Fields
@@ -134,6 +135,7 @@ namespace MP.Stats.Components
#region Private Methods
#if false
private PieChartDataset<double> GetBarChartDataset()
{
var answ = new PieChartDataset<double>
@@ -145,7 +147,8 @@ namespace MP.Stats.Components
HoverBorderWidth = 3
};
return answ;
}
}
#endif
private List<string> GetBarChartLabels()
{
@@ -153,6 +156,7 @@ namespace MP.Stats.Components
return answ;
}
#if false
/// <summary>
/// Elenco 2 linee x controli KO /KO
/// </summary>
@@ -170,7 +174,8 @@ namespace MP.Stats.Components
BorderDash = new List<int> { }
};
return answ;
}
}
#endif
private List<string> GetLineChartLabels()
{
@@ -208,7 +213,9 @@ namespace MP.Stats.Components
protected List<string> getLineColors(float alpha)
{
List<string> answ = new List<string>();
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
#if false
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
#endif
return answ;
}
@@ -220,6 +227,7 @@ namespace MP.Stats.Components
protected List<string> getPieColors(float alpha)
{
List<string> answ = new List<string>();
#if false
foreach (var item in ParetoData)
{
if (item.label == EsitoOK)
@@ -230,12 +238,14 @@ namespace MP.Stats.Components
{
answ.Add(ChartColor.FromRgba(254, 82, 65, alpha));
}
}
}
#endif
return answ;
}
protected async Task HandleRedraw()
{
#if false
if (PieVC != null)
{
await PieVC.Clear();
@@ -245,7 +255,8 @@ namespace MP.Stats.Components
{
await TimeSerieVC.Clear();
await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
}
}
#endif
}
#endregion Protected Methods
+2 -2
View File
@@ -21,10 +21,10 @@
<div class="col-10">
<div class="row">
<div class="col-6">
<BarChart @ref="ParetoGuasti" TItem="double" OptionsObject="barChartOptions" />
@*<BarChart @ref="ParetoGuasti" TItem="double" OptionsObject="barChartOptions" />*@
</div>
<div class="col-6">
<LineChart @ref="NumGuasti" TItem="double" OptionsObject="lineChartOptions" />
@*<LineChart @ref="NumGuasti" TItem="double" OptionsObject="lineChartOptions" />*@
</div>
</div>
</div>
+17 -8
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blazorise.Charts;
using Microsoft.AspNetCore.Components;
using MP.Stats.Data;
@@ -82,9 +81,9 @@ namespace MP.Stats.Components
AspectRatio = 3.5
};
protected LineChart<double> NumGuasti = new LineChart<double>();
protected List<double> NumGuasti = new List<double>();
protected BarChart<double> ParetoGuasti = new BarChart<double>();
protected List<double> ParetoGuasti = new List<double>();
#endregion Protected Fields
@@ -132,6 +131,7 @@ namespace MP.Stats.Components
#region Private Methods
#if false
private BarChartDataset<double> GetBarChartDataset()
{
var answ = new BarChartDataset<double>
@@ -143,7 +143,8 @@ namespace MP.Stats.Components
HoverBorderWidth = 5
};
return answ;
}
}
#endif
private List<string> GetBarChartLabels()
{
@@ -151,6 +152,7 @@ namespace MP.Stats.Components
return answ;
}
#if false
private LineChartDataset<double> GetLineChartDataset()
{
var answ = new LineChartDataset<double>
@@ -164,7 +166,8 @@ namespace MP.Stats.Components
BorderDash = new List<int> { }
};
return answ;
}
}
#endif
private List<string> GetLineChartLabels()
{
@@ -202,6 +205,7 @@ namespace MP.Stats.Components
protected List<string> backgroundColors(int numRecords, float alpha)
{
List<string> answ = new List<string>();
#if false
// verde...
for (int i = 0; i < numRecords / 3; i++)
{
@@ -215,7 +219,8 @@ namespace MP.Stats.Components
while (answ.Count < numRecords)
{
answ.Add(ChartColor.FromRgba(255, 99, 132, alpha));
}
}
#endif
return answ;
}
@@ -224,13 +229,17 @@ namespace MP.Stats.Components
{
if (ParetoGuasti != null)
{
#if false
await ParetoGuasti.Clear();
await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset());
await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset());
#endif
}
if (NumGuasti != null)
{
#if false
await NumGuasti.Clear();
await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
#endif
}
}
+15 -6
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blazorise.Charts;
using Microsoft.AspNetCore.Components;
using MP.Stats.Data;
@@ -81,9 +80,11 @@ namespace MP.Stats.Components
AspectRatio = 3.5
};
#if false
protected LineChart<double> NumGuasti = new LineChart<double>();
protected BarChart<double> ParetoGuasti = new BarChart<double>();
protected BarChart<double> ParetoGuasti = new BarChart<double>();
#endif
#endregion Protected Fields
@@ -131,6 +132,7 @@ namespace MP.Stats.Components
#region Private Methods
#if false
private BarChartDataset<double> GetBarChartDataset()
{
var answ = new BarChartDataset<double>
@@ -142,7 +144,8 @@ namespace MP.Stats.Components
HoverBorderWidth = 5
};
return answ;
}
}
#endif
private List<string> GetBarChartLabels()
{
@@ -150,6 +153,7 @@ namespace MP.Stats.Components
return answ;
}
#if false
private LineChartDataset<double> GetLineChartDataset()
{
var answ = new LineChartDataset<double>
@@ -163,7 +167,8 @@ namespace MP.Stats.Components
BorderDash = new List<int> { }
};
return answ;
}
}
#endif
private List<string> GetLineChartLabels()
{
@@ -201,6 +206,7 @@ namespace MP.Stats.Components
protected List<string> backgroundColors(int numRecords, float alpha)
{
List<string> answ = new List<string>();
#if false
// rosso...
for (int i = 0; i < numRecords / 3; i++)
{
@@ -214,13 +220,15 @@ namespace MP.Stats.Components
while (answ.Count < numRecords)
{
answ.Add(ChartColor.FromRgba(54, 82, 235, alpha));
}
}
#endif
return answ;
}
protected async Task HandleRedraw()
{
#if false
if (ParetoGuasti != null)
{
await ParetoGuasti.Clear();
@@ -230,7 +238,8 @@ namespace MP.Stats.Components
{
await NumGuasti.Clear();
await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
}
}
#endif
}
#endregion Protected Methods
+2 -2
View File
@@ -21,10 +21,10 @@
<div class="col-10">
<div class="row">
<div class="col-2">
<PieChart @ref="PieVC" TItem="double" OptionsObject="pieChartOptions" />
@* <PieChart @ref="PieVC" TItem="double" OptionsObject="pieChartOptions" />*@
</div>
<div class="col-10">
<LineChart @ref="TimeSerieVC" TItem="double" OptionsObject="lineChartOptions" />
@* <LineChart @ref="TimeSerieVC" TItem="double" OptionsObject="lineChartOptions" />*@
</div>
</div>
</div>
+18 -7
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blazorise.Charts;
using Microsoft.AspNetCore.Components;
using MP.Stats.Data;
@@ -85,8 +84,10 @@ namespace MP.Stats.Components
AspectRatio = 1
};
#if false
protected PieChart<double> PieVC = new PieChart<double>();
protected LineChart<double> TimeSerieVC = new LineChart<double>();
protected LineChart<double> TimeSerieVC = new LineChart<double>();
#endif
#endregion Protected Fields
@@ -134,6 +135,7 @@ namespace MP.Stats.Components
#region Private Methods
#if false
private PieChartDataset<double> GetBarChartDataset()
{
var answ = new PieChartDataset<double>
@@ -145,7 +147,8 @@ namespace MP.Stats.Components
HoverBorderWidth = 3
};
return answ;
}
}
#endif
private List<string> GetBarChartLabels()
{
@@ -153,6 +156,7 @@ namespace MP.Stats.Components
return answ;
}
#if false
/// <summary>
/// Elenco 2 linee x controli KO /KO
/// </summary>
@@ -170,7 +174,8 @@ namespace MP.Stats.Components
BorderDash = new List<int> { }
};
return answ;
}
}
#endif
private List<string> GetLineChartLabels()
{
@@ -208,6 +213,7 @@ namespace MP.Stats.Components
protected List<string> backgroundColors(int numRecords, float alpha)
{
List<string> answ = new List<string>();
#if false
// verde...
for (int i = 0; i < numRecords / 3; i++)
{
@@ -221,7 +227,8 @@ namespace MP.Stats.Components
while (answ.Count < numRecords)
{
answ.Add(ChartColor.FromRgba(180, 180, 35, alpha));
}
}
#endif
return answ;
}
@@ -234,12 +241,15 @@ namespace MP.Stats.Components
protected List<string> getLineColors(float alpha)
{
List<string> answ = new List<string>();
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
#if false
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
#endif
return answ;
}
protected async Task HandleRedraw()
{
#if false
if (PieVC != null)
{
await PieVC.Clear();
@@ -249,7 +259,8 @@ namespace MP.Stats.Components
{
await TimeSerieVC.Clear();
await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
}
}
#endif
}
#endregion Protected Methods
+1 -2
View File
@@ -1,5 +1,4 @@
@using Blazorise.Components
@using MP.Stats.Data
@using MP.Stats.Data
<EditForm Model="@SelFilter">
<div class="d-flex justify-content-between">
-4
View File
@@ -175,10 +175,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazorise" Version="0.9.5.5" />
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.5.5" />
<PackageReference Include="Blazorise.Charts" Version="0.9.5.5" />
<PackageReference Include="Blazorise.Components" Version="0.9.5.5" />
<PackageReference Include="ElmahCore" Version="2.1.1" />
<PackageReference Include="ElmahCore.Common" Version="2.1.1" />
<PackageReference Include="ElmahCore.Sql" Version="2.1.1" />
+7 -5
View File
@@ -11,11 +11,9 @@ using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.Data;
using MP.Stats;
using MP.Stats.Shared;
using Blazorise;
using Blazorise.Charts;
using MP.Data;
namespace MP.Stats.Pages
{
@@ -66,10 +64,12 @@ namespace MP.Stats.Pages
}
}
#if false
PieChart<double> pieChart;
LineChart<double> lineChart;
HorizontalBarChart<double> barChartHoriz;
BarChart<double> barChart;
BarChart<double> barChart;
#endif
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
@@ -182,8 +182,10 @@ namespace MP.Stats.Pages
#endif
string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" };
#if false
List<string> backgroundColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 0.2f), ChartColor.FromRgba(54, 162, 235, 0.2f), ChartColor.FromRgba(255, 206, 86, 0.2f), ChartColor.FromRgba(75, 192, 192, 0.2f), ChartColor.FromRgba(153, 102, 255, 0.2f), ChartColor.FromRgba(255, 159, 64, 0.2f) };
List<string> borderColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) };
List<string> borderColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) };
#endif
private List<int> RandomizeData()
{
-17
View File
@@ -17,13 +17,6 @@
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet"href="css/site.css" />
<link rel="stylesheet"href="lib/font-awesome/css/all.css" />
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<!-- inside of head section -->
@*<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />*@
<link href="MP.Stats.styles.css" rel="stylesheet" />
</head>
<body>
@@ -40,16 +33,6 @@
<a class="dismiss">🗙</a>
</div>
<!-- inside of body section and after the div/app tag -->
@*<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>*@
@*<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>*@
@*<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>*@
@*<script src="_content/Blazorise/blazorise.js"></script>
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js"></script>
<script src="_content/Blazorise.Charts/blazorise.charts.js"></script>*@
<script src="_framework/blazor.server.js"></script>
<script src="lib/Chart.js/chart.js"></script>
<script src="lib/luxon/luxon.js"></script>
-8
View File
@@ -1,4 +1,3 @@
using Blazorise;
using ElmahCore.Mvc;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -8,7 +7,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MP.Stats.Data;
using System.Globalization;
using Blazorise.Bootstrap;
namespace MP.Stats
{
@@ -77,12 +75,6 @@ namespace MP.Stats
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddBlazorise(options =>
{
options.ChangeTextOnKeyPress = true; // optional
})
.AddBootstrapProviders();
// Elmah
services.AddElmah();
//string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;";
+1 -3
View File
@@ -7,6 +7,4 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using MP.Stats
@using MP.Stats.Shared
@using Blazorise
@using Blazorise.Charts
@using MP.Stats.Shared