aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-11-04 21:35:07 +0200
committerRoy <Roy.mail.net@gmail.com>2022-11-04 21:35:07 +0200
commit8431040bf909ba65d5ce242b5fd2cc91005ba679 (patch)
treed6d60f676426d291cbb848b01a1245c1bc7f1348 /Software
parent7722d51930bcc1240b0c5e3ad54c9be7da73309d (diff)
downloadTango-8431040bf909ba65d5ce242b5fd2cc91005ba679.tar.gz
Tango-8431040bf909ba65d5ce242b5fd2cc91005ba679.zip
Statistics Provider & Service Communication.
Diffstat (limited to 'Software')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj4
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs85
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs7
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/IStatisticsProvider.cs4
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsFilterData.cs21
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsModel.cs10
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj1
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs56
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj1
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs4
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
13 files changed, 168 insertions, 36 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj
index 8562c73ca..70aba2f5c 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj
@@ -111,6 +111,10 @@
</None>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\..\PPC\Tango.PPC.Shared\Tango.PPC.Shared.csproj">
+ <Project>{208c8bd8-72c6-4e3c-acaa-351091a2acc7}</Project>
+ <Name>Tango.PPC.Shared</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj">
<Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project>
<Name>Tango.AutoComplete</Name>
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
index bfcc9cbd2..2a14b7de1 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
@@ -1,17 +1,74 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.BL.Enumerations;
using Tango.FSE.Common;
+using Tango.FSE.Common.AutoComplete;
using Tango.FSE.Common.Navigation;
+using Tango.PPC.Shared.Statistics;
+using Tango.SharedUI.Components;
using Tango.SharedUI.Helpers;
namespace Tango.FSE.Statistics.ViewModels
{
public class MainViewVM : FSEViewModel
{
+ private RequiredFiltersData _filtersData;
+ public RequiredFiltersData FiltersData
+ {
+ get { return _filtersData; }
+ set { _filtersData = value; RaisePropertyChangedAuto(); }
+ }
+
+ private SelectedObjectCollection<JobRunStatus> _jobRunSelectedStatuses;
+ public SelectedObjectCollection<JobRunStatus> JobRunSelectedStatuses
+ {
+ get { return _jobRunSelectedStatuses; }
+ set { _jobRunSelectedStatuses = value; RaisePropertyChangedAuto(); }
+ }
+
+ private SelectedObjectCollection<ThreadFilterData> _selectedThreads;
+ public SelectedObjectCollection<ThreadFilterData> SelectedThreads
+ {
+ get { return _selectedThreads; }
+ set { _selectedThreads = value; RaisePropertyChangedAuto(); }
+ }
+
+ public AutoCompleteSource<String> JobsAutoCompleteProvider { get; set; }
+
+ public MainViewVM()
+ {
+ JobRunSelectedStatuses = new SelectedObjectCollection<JobRunStatus>(new ObservableCollection<JobRunStatus>()
+ {
+ JobRunStatus.Aborted,
+ JobRunStatus.Completed,
+ JobRunStatus.Failed,
+
+ }, new ObservableCollection<JobRunStatus>()
+ {
+ JobRunStatus.Aborted,
+ JobRunStatus.Completed,
+ JobRunStatus.Failed,
+
+ });
+ JobRunSelectedStatuses.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(JobRunSelectedStatuses));
+ JobRunSelectedStatuses.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(JobRunSelectedStatuses));
+
+ FiltersData = new RequiredFiltersData();
+
+ JobsAutoCompleteProvider = new AutoCompleteSource<string>(AutoCompleteJobs);
+ }
+
+ private List<String> AutoCompleteJobs(string key)
+ {
+ key = key ?? String.Empty;
+ return FiltersData.Jobs.Where(x => x.ToLower().Contains(key.ToLower())).ToList();
+ }
+
public override void OnApplicationStarted()
{
InvokeUI(() =>
@@ -28,5 +85,33 @@ namespace Tango.FSE.Statistics.ViewModels
});
});
}
+
+ public async override void OnNavigatedTo()
+ {
+ base.OnNavigatedTo();
+ await LoadFiltersData();
+ await LoadStatistics();
+ }
+
+ private async Task LoadFiltersData()
+ {
+ FiltersData = await StatisticsProvider.GetRequiredFiltersData();
+ SelectedThreads = new SelectedObjectCollection<ThreadFilterData>(FiltersData.Rmls.ToObservableCollection(), new ObservableCollection<ThreadFilterData>());
+ }
+
+ private async Task LoadStatistics()
+ {
+ Filters filters = new Filters();
+ filters.StartDateUTC = DateTime.Now.AddYears(-1).ToUniversalTime();
+ filters.EndDateUTC = DateTime.Now.ToUniversalTime();
+ filters.EndStatuses = JobRunSelectedStatuses.SynchedSource.Cast<int>().ToList();
+ filters.IncludeHeadCleaning = false;
+ filters.JobName = null;
+ filters.MinLength = 0;
+ filters.MaxLength = 10000;
+ filters.RmlGuids = SelectedThreads.SynchedSource.Select(x => x.Guid).ToList();
+
+ var model = await StatisticsProvider.GetStatistics(filters);
+ }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
index f18f940ce..6b53971d6 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
@@ -46,6 +46,7 @@ using Tango.FSE.Common.DemoMode;
using Tango.FSE.Common.FileAssociation;
using Tango.FSE.Common.Insights;
using Tango.FSE.Common.Build;
+using Tango.FSE.Common.Statistics;
namespace Tango.FSE.Common
{
@@ -256,6 +257,12 @@ namespace Tango.FSE.Common
public IBuildProvider BuildProvider { get; set; }
/// <summary>
+ /// Gets or sets the statistics data provider.
+ /// </summary>
+ [TangoInject]
+ public IStatisticsProvider StatisticsProvider { get; set; }
+
+ /// <summary>
/// Gets or sets the FSE service.
/// </summary>
[TangoInject]
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/IStatisticsProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/IStatisticsProvider.cs
index 2f72b3b32..66f9f53a3 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/IStatisticsProvider.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/IStatisticsProvider.cs
@@ -3,11 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.PPC.Shared.Statistics;
namespace Tango.FSE.Common.Statistics
{
public interface IStatisticsProvider
{
- Task<StatisticsModel> GetStatistics();
+ Task<RequiredFiltersData> GetRequiredFiltersData();
+ Task<StatisticsModel> GetStatistics(Filters filters);
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsFilterData.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsFilterData.cs
deleted file mode 100644
index aa04574b0..000000000
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsFilterData.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FSE.Common.Statistics
-{
- public class StatisticsFilterData
- {
- public List<String> Rmls { get; set; }
-
- public List<String> Jobs { get; set; }
-
- public StatisticsFilterData()
- {
- Rmls = new List<string>();
- Jobs = new List<string>();
- }
- }
-}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsModel.cs
index d23105b30..242bca621 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsModel.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Statistics/StatisticsModel.cs
@@ -3,18 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Tango.BL.DTO;
-using Tango.BL.Entities;
+using Tango.PPC.Shared.Statistics;
namespace Tango.FSE.Common.Statistics
{
public class StatisticsModel
{
- public List<JobRun> JobRuns { get; set; }
-
- public StatisticsModel()
- {
- JobRuns = new List<JobRun>();
- }
+ public StatisticsResult StatisticsResult { get; set; }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
index 47fb9a46e..f5e8e48dc 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
@@ -323,7 +323,6 @@
<Compile Include="SQL\RemoteSqlCommandMode.cs" />
<Compile Include="SQL\RemoteSqlCommandResult.cs" />
<Compile Include="Statistics\IStatisticsProvider.cs" />
- <Compile Include="Statistics\StatisticsFilterData.cs" />
<Compile Include="Statistics\StatisticsModel.cs" />
<Compile Include="Storage\IStorageProvider.cs" />
<Compile Include="Storage\IStorageResult.cs" />
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs
new file mode 100644
index 000000000..f5b44b25d
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.DI;
+using Tango.FSE.Common;
+using Tango.FSE.Common.Connection;
+using Tango.FSE.Common.Statistics;
+using Tango.PPC.Shared.Statistics;
+using Tango.Transport;
+
+namespace Tango.FSE.UI.Statistics
+{
+ public class DefaultStatisticsProvider : FSEExtendedObject, IStatisticsProvider
+ {
+ [TangoInject]
+ public IMachineProvider MachineProvider { get; set; }
+
+ public async Task<RequiredFiltersData> GetRequiredFiltersData()
+ {
+ try
+ {
+ LogManager.Log("Retrieving remote machine statistics required filters data...");
+
+ var response = await MachineProvider.MachineOperator.SendGenericRequest<GetStatisticsRequiredFiltersRequest, GetStatisticsRequiredFiltersResponse>(new GetStatisticsRequiredFiltersRequest());
+ return response.FiltersData;
+ }
+ catch (Exception ex)
+ {
+ throw LogManager.Log(ex, "Error retrieving remote machine statistics required filters data.");
+ }
+ }
+
+ public async Task<StatisticsModel> GetStatistics(Filters filters)
+ {
+ try
+ {
+ LogManager.Log("Retrieving remote machine statistics data...");
+
+ var response = await MachineProvider.MachineOperator.SendGenericRequest<GetStatisticsRequest, GetStatisticsResponse>(
+ new GetStatisticsRequest() { Filters = filters },
+ new TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(60) });
+
+ StatisticsModel model = new StatisticsModel();
+ model.StatisticsResult = response.Result;
+
+ return model;
+ }
+ catch (Exception ex)
+ {
+ throw LogManager.Log(ex, "Error retrieving remote machine statistics data.");
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
index 4147629ab..12b2ffc5a 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
@@ -383,6 +383,7 @@
<Compile Include="Resolution\DefaultResolutionService.cs" />
<Compile Include="RemoteJob\DefaultRemoteJobProvider.cs" />
<Compile Include="SQL\DefaultRemoteSqlProvider.cs" />
+ <Compile Include="Statistics\DefaultStatisticsProvider.cs" />
<Compile Include="Storage\DefaultStorageProvider.cs" />
<Compile Include="Storage\ExplorerControlDialog.xaml.cs">
<DependentUpon>ExplorerControlDialog.xaml</DependentUpon>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
index f439a90aa..9345af720 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
@@ -80,6 +80,8 @@ using Tango.FSE.Common.RemoteJobUpload;
using Tango.FSE.UI.RemoteJobUpload;
using Tango.FSE.Common.HotFolder;
using Tango.FSE.UI.HotFolder;
+using Tango.FSE.Common.Statistics;
+using Tango.FSE.UI.Statistics;
namespace Tango.FSE.UI
{
@@ -127,6 +129,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Unregister<IBuildProvider>();
TangoIOC.Default.Unregister<IRemoteJobUploadProvider>();
TangoIOC.Default.Unregister<IHotFolderService>();
+ TangoIOC.Default.Unregister<IStatisticsProvider>();
TangoIOC.Default.Register<IBuildProvider, DefaultBuildProvider>();
@@ -169,6 +172,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Register<IDataStoreProvider, DefaultDataStoreProvider>();
TangoIOC.Default.Register<IRemoteJobUploadProvider, DefaultRemoteJobUploadProvider>();
TangoIOC.Default.Register<IHotFolderService, DefaultHotFolderService>();
+ TangoIOC.Default.Register<IStatisticsProvider, DefaultStatisticsProvider>();
TangoIOC.Default.Register<MainWindowVM>();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs
index 6260c9e5f..621c6d5eb 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs
@@ -88,12 +88,10 @@ namespace Tango.PPC.Common.Statistics
db_JobRuns = db_JobRuns.Where(x => x.JobName.ToLower().StartsWith(filters.JobName.ToLower()));
}
- db_JobRuns = db_JobRuns.Where(x => x.JobLength < filters.MinLength && x.JobLength >= filters.MaxLength);
+ db_JobRuns = db_JobRuns.Where(x => x.JobLength >= filters.MinLength && x.JobLength <= filters.MaxLength);
var jobRuns = await db_JobRuns.ToListAsync();
- jobRuns.ForEach(x => x.LiquidQuantityString = null);
-
var colorSpaces = await db.ColorSpaces.ToListAsync();
var rmls = await db.Rmls.ToListAsync();
var catalogs = await db.ColorCatalogs.ToListAsync();
@@ -123,7 +121,7 @@ namespace Tango.PPC.Common.Statistics
foreach (var liquidType in stop.LiquidVolumes)
{
PresentationLiquidVolume plt = new PresentationLiquidVolume();
- plt.LiquidType = (LiquidTypes)Enum.Parse(typeof(LiquidTypes), liquidType.LiquidTypeName);
+ plt.LiquidType = (LiquidTypes)Enum.Parse(typeof(LiquidTypes), liquidType.LiquidTypeName.Replace(" ",""));
plt.Volume = liquidType.Volume;
pbs.LiquidVolumes.Add(plt);
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
index 881e5bcef..ab7547dad 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
@@ -33,6 +33,7 @@ using Tango.PPC.Common.RemoteJob;
using Tango.PPC.Common.RemoteJobUpload;
using Tango.PPC.Common.RemoteNotifications;
using Tango.PPC.Common.SQL;
+using Tango.PPC.Common.Statistics;
using Tango.PPC.Common.Storage;
using Tango.PPC.Common.Synchronization;
using Tango.PPC.Common.SystemInfo;
@@ -109,6 +110,7 @@ namespace Tango.PPC.UI
TangoIOC.Default.Unregister<IBitManager>();
TangoIOC.Default.Unregister<IRemoteNotificationsService>();
TangoIOC.Default.Unregister<IRemoteJobUploadService>();
+ TangoIOC.Default.Unregister<IStatisticsService>();
if (App.StartupArgs != null && App.StartupArgs.Contains("-webDebug"))
{
@@ -156,6 +158,7 @@ namespace Tango.PPC.UI
TangoIOC.Default.Register<IBitManager, DefaultBitManager>();
TangoIOC.Default.Register<IRemoteNotificationsService, DefaultRemoteNotificationsService>();
TangoIOC.Default.Register<IRemoteJobUploadService, DefaultRemoteJobUploadService>();
+ TangoIOC.Default.Register<IStatisticsService, DefaultStatisticsService>();
TangoIOC.Default.Register<LoadingViewVM>();
TangoIOC.Default.Register<MainViewVM>();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>