Skip to content

Commit 3fac2b4

Browse files
authored
Merge pull request #234 from Resgrid/develop
Develop
2 parents 2d4a780 + 9afc325 commit 3fac2b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+786
-308
lines changed

Core/Resgrid.Config/TelemetryConfig.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,32 @@ public static class TelemetryConfig
44
{
55
public static string Exporter = "";
66

7+
public static TelemetryExporters ExporterType = TelemetryExporters.None;
78
public static string PostHogUrl = "";
89
public static string PostHogApiKey = "";
10+
11+
public static string AptabaseUrl = "";
12+
public static string AptabaseWebApiKey = "";
13+
public static string AptabaseServicesApiKey = "";
14+
public static string AptabaseResponderApiKey = "";
15+
public static string AptabaseUnitApiKey = "";
16+
public static string AptabaseBigBoardApiKey = "";
17+
public static string AptabaseDispatchApiKey = "";
18+
19+
public static string GetAnalyticsKey()
20+
{
21+
if (ExporterType == TelemetryExporters.PostHog)
22+
return PostHogApiKey;
23+
else if (ExporterType == TelemetryExporters.Aptabase)
24+
return AptabaseWebApiKey;
25+
return string.Empty;
26+
}
27+
}
28+
29+
public enum TelemetryExporters
30+
{
31+
None = 0,
32+
PostHog = 1,
33+
Aptabase = 2
934
}
1035
}

Core/Resgrid.Localization/Areas/User/Department/Department.en.resx

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,33 @@
162162
<data name="UnitTTLHelp" xml:space="preserve">
163163
<value>In Minutes, how long locations are valid for to be shown in the map. I.e. a value of 60 would mean a marker for a unit would show on the maps for up to 60 minutes, afterwards would not be shown. Setting 0 disables TTL and a location, no matter how old, will be shown on the map.</value>
164164
</data>
165+
<data name="GroupDispatchSettingsHeader" xml:space="preserve">
166+
<value>Group Dispatch Settings</value>
167+
</data>
168+
<data name="UnitDispatchSettingsHeader" xml:space="preserve">
169+
<value>Unit Dispatch Settings</value>
170+
</data>
171+
<data name="UnitDispatchAlsoDispatchToAssignedPersonnelLabel" xml:space="preserve">
172+
<value>Also Dispatch To Assigned Personnel</value>
173+
</data>
174+
<data name="UnitDispatchAlsoDispatchToGroupLabel" xml:space="preserve">
175+
<value>Also Dispatch To Entire Group</value>
176+
</data>
177+
<data name="ShiftSettingsHeader" xml:space="preserve">
178+
<value>Shift Settings</value>
179+
</data>
180+
<data name="SaveShiftSettingsText" xml:space="preserve">
181+
<value>Successfully saved Shift Settings.</value>
182+
</data>
183+
<data name="ShiftSignupSettingsHeader" xml:space="preserve">
184+
<value>Shift Signup Settings</value>
185+
</data>
186+
<data name="ShiftSignupsMultipleGroupsHeader" xml:space="preserve">
187+
<value>Allow Signups For Multiple Groups</value>
188+
</data>
189+
<data name="PersonnelOnUnitSetUnitStatusLabel" xml:space="preserve">
190+
<value>Personnel on Unit Set Unit Status</value>
191+
</data>
165192
<data name="AccountOwner" xml:space="preserve">
166193
<value>Account Owner</value>
167194
</data>
@@ -477,16 +504,7 @@
477504
<data name="SavedModuleSettings" xml:space="preserve">
478505
<value>Department Module Settings Have Been Saved</value>
479506
</data>
480-
<data name="GroupDispatchSettingsHeader" xml:space="preserve">
481-
<value>Group Dispatch Settings</value>
482-
</data>
483-
<data name="UnitDispatchSettingsHeader" xml:space="preserve">
484-
<value>Unit Dispatch Settings</value>
485-
</data>
486-
<data name="UnitDispatchAlsoDispatchToAssignedPersonnelLabel" xml:space="preserve">
487-
<value>Also Dispatch To Assigned Personnel</value>
488-
</data>
489-
<data name="UnitDispatchAlsoDispatchToGroupLabel" xml:space="preserve">
490-
<value>Also Dispatch To Entire Group</value>
507+
<data name="PersonnelOnUnitSetUnitStatusHelp" xml:space="preserve">
508+
<value>When a unit submits a status and users are setup on roles, the users status will be set to On Unit.</value>
491509
</data>
492510
</root>

Core/Resgrid.Localization/Areas/User/Department/Department.es.resx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@
120120
<data name="DeleteDepartmentSettingsInfo" xml:space="preserve">
121121
<value />
122122
</data>
123+
<data name="GroupDispatchSettingsHeader" xml:space="preserve">
124+
<value />
125+
</data>
126+
<data name="UnitDispatchSettingsHeader" xml:space="preserve">
127+
<value />
128+
</data>
129+
<data name="UnitDispatchAlsoDispatchToAssignedPersonnelLabel" xml:space="preserve">
130+
<value />
131+
</data>
132+
<data name="UnitDispatchAlsoDispatchToGroupLabel" xml:space="preserve">
133+
<value />
134+
</data>
123135
<data name="AccountOwner" xml:space="preserve">
124136
<value>Propietario de la cuenta</value>
125137
</data>
@@ -378,16 +390,7 @@
378390
<data name="DeleteDepartmentSettingsHeader" xml:space="preserve">
379391
<value />
380392
</data>
381-
<data name="GroupDispatchSettingsHeader" xml:space="preserve">
382-
<value />
383-
</data>
384-
<data name="UnitDispatchSettingsHeader" xml:space="preserve">
385-
<value />
386-
</data>
387-
<data name="UnitDispatchAlsoDispatchToAssignedPersonnelLabel" xml:space="preserve">
388-
<value />
389-
</data>
390-
<data name="UnitDispatchAlsoDispatchToGroupLabel" xml:space="preserve">
393+
<data name="PersonnelOnUnitSetUnitStatusHelp" xml:space="preserve">
391394
<value />
392395
</data>
393396
</root>

Core/Resgrid.Localization/Areas/User/Department/Department.resx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,22 @@
174174
<data name="UnitDispatchAlsoDispatchToGroupLabel" xml:space="preserve">
175175
<value />
176176
</data>
177+
<data name="ShiftSettingsHeader" xml:space="preserve">
178+
<value />
179+
</data>
180+
<data name="SaveShiftSettingsText" xml:space="preserve">
181+
<value />
182+
</data>
183+
<data name="ShiftSignupSettingsHeader" xml:space="preserve">
184+
<value />
185+
</data>
186+
<data name="ShiftSignupsMultipleGroupsHeader" xml:space="preserve">
187+
<value />
188+
</data>
189+
<data name="PersonnelOnUnitSetUnitStatusLabel" xml:space="preserve">
190+
<value />
191+
</data>
192+
<data name="PersonnelOnUnitSetUnitStatusHelp" xml:space="preserve">
193+
<value />
194+
</data>
177195
</root>

Core/Resgrid.Model/ActionLog.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public class ActionLog : IEntity
5151
[ProtoMember(9)]
5252
public string Note { get; set; }
5353

54+
[ProtoMember(12)]
55+
public int? UnitStateId { get; set; }
56+
57+
[ProtoMember(13)]
58+
public string UnitName { get; set; }
59+
5460
[NotMapped]
5561
[ProtoMember(10)]
5662
public double Eta { get; set; }
@@ -103,6 +109,11 @@ public string GetActionText()
103109
return "Responding to Station";
104110
case ActionTypes.RespondingToScene:
105111
return "Responding to Scene";
112+
case ActionTypes.OnUnit:
113+
if (!String.IsNullOrWhiteSpace(UnitName))
114+
return $"On Unit ({UnitName})";
115+
else
116+
return "On Unit";
106117
default:
107118
throw new ArgumentOutOfRangeException();
108119
}
@@ -126,6 +137,8 @@ public string GetActionCss()
126137
return "label-success";
127138
case ActionTypes.RespondingToScene:
128139
return "label-success";
140+
case ActionTypes.OnUnit:
141+
return "label-success";
129142
default:
130143
throw new ArgumentOutOfRangeException();
131144
}
@@ -177,6 +190,8 @@ public static int GetWeightForAction(this ActionLog actionLog)
177190
return 1;
178191
else if (actionLog.ActionTypeId == (int)ActionTypes.RespondingToScene)
179192
return 1;
193+
else if (actionLog.ActionTypeId == (int)ActionTypes.OnUnit)
194+
return 2;
180195
else if (actionLog.ActionTypeId == (int)ActionTypes.OnScene)
181196
return 2;
182197
else if (actionLog.ActionTypeId == (int)ActionTypes.NotResponding)

Core/Resgrid.Model/ActionTypes.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ public enum ActionTypes
4747
/// User is Responding directly to a scene (For a Specific Call)
4848
/// </summary>
4949
[Display(Name = "Responding To Scene")]
50-
RespondingToScene = 6
50+
RespondingToScene = 6,
51+
52+
/// <summary>
53+
/// User is on a Unit and has a state submitted recently
54+
/// </summary>
55+
[Display(Name = "On Unit")]
56+
OnUnit = 7
5157
}
5258
}

Core/Resgrid.Model/DepartmentSettingTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ public enum DepartmentSettingTypes
3636
ModuleSettings = 32,
3737
UnitDispatchAlsoDispatchToAssignedPersonnel = 33,
3838
UnitDispatchAlsoDispatchToGroup = 34,
39+
PersonnelOnUnitSetUnitStatus = 35,
3940
}
4041
}

Core/Resgrid.Model/Services/IActionLogsService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,7 @@ Task<ActionLog> SetUserActionAsync(string userId, int departmentId, int actionTy
225225
Task<List<ActionLog>> GetActionLogsForCallAsync(int departmentId, int callId);
226226

227227
Task<List<ActionLog>> GetAllActionLogsInDateRangeAsync(int departmentId, DateTime startDate, DateTime endDate);
228+
229+
Task<ActionLog> CreateUnitLinkedStatus(string userId, int departmentId, int unitStateId, string unitName, CancellationToken cancellationToken = default(CancellationToken));
228230
}
229231
}

Core/Resgrid.Model/Services/IDepartmentSettingsService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ public interface IDepartmentSettingsService
272272

273273
Task<bool> GetUnitDispatchAlsoDispatchToGroupAsync(int departmentId);
274274

275+
Task<bool> GetPersonnelOnUnitSetUnitStatusAsync(int departmentId, bool bypassCache = false);
276+
275277
Task<DepartmentSetting> SetDepartmentModuleSettingsAsync(int departmentId, DepartmentModuleSettings settings, CancellationToken cancellationToken = default(CancellationToken));
276278
}
277279
}

Core/Resgrid.Services/ActionLogsService.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading;
5-
using System.Threading.Tasks;
6-
using Resgrid.Model.Providers;
1+
using Amazon.SimpleEmail.Model;
72
using Resgrid.Model;
83
using Resgrid.Model.Events;
4+
using Resgrid.Model.Providers;
95
using Resgrid.Model.Repositories;
106
using Resgrid.Model.Services;
117
using Resgrid.Providers.Bus;
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Linq;
11+
using System.Threading;
12+
using System.Threading.Tasks;
1213

1314
namespace Resgrid.Services
1415
{
@@ -406,5 +407,18 @@ public async Task<List<ActionLog>> GetActionLogsForCallAsync(int departmentId, i
406407
var items = await _actionLogsRepository.GetActionLogsForCallAndTypesAsync(callId, callEnabledStates);
407408
return items.ToList();
408409
}
410+
411+
public async Task<ActionLog> CreateUnitLinkedStatus(string userId, int departmentId, int unitStateId, string unitName, CancellationToken cancellationToken = default(CancellationToken))
412+
{
413+
var al = new ActionLog();
414+
al.ActionTypeId = (int)ActionTypes.OnUnit;
415+
al.DepartmentId = departmentId;
416+
al.UserId = userId;
417+
al.Timestamp = DateTime.UtcNow;
418+
al.UnitStateId = unitStateId;
419+
al.UnitName = unitName;
420+
421+
return await SaveActionLogAsync(al, cancellationToken);
422+
}
409423
}
410424
}

0 commit comments

Comments
 (0)