mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 23:42:36 -07:00
Small changes around how we work with custom events in the analytics
This commit is contained in:
parent
7b57e3fffc
commit
63e0d0e531
14 changed files with 1498 additions and 1340 deletions
|
@ -32,7 +32,6 @@ using System;
|
|||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
|
@ -52,6 +51,7 @@ using PlexRequests.Api.Interfaces;
|
|||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Helpers.Analytics;
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
using PlexRequests.Services.Interfaces;
|
||||
using PlexRequests.Services.Notification;
|
||||
|
@ -60,6 +60,7 @@ using PlexRequests.Store.Repository;
|
|||
using PlexRequests.UI.Helpers;
|
||||
using PlexRequests.UI.Models;
|
||||
|
||||
using Action = PlexRequests.Helpers.Analytics.Action;
|
||||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
|
@ -89,6 +90,7 @@ namespace PlexRequests.UI.Modules
|
|||
private ISettingsService<ScheduledJobsSettings> ScheduledJobSettings { get; }
|
||||
private ISlackApi SlackApi { get; }
|
||||
private IJobRecord JobRecorder { get; }
|
||||
private IAnalytics Analytics { get; }
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public AdminModule(ISettingsService<PlexRequestSettings> prService,
|
||||
|
@ -111,7 +113,7 @@ namespace PlexRequests.UI.Modules
|
|||
ISettingsService<LogSettings> logs,
|
||||
ICacheProvider cache, ISettingsService<SlackNotificationSettings> slackSettings,
|
||||
ISlackApi slackApi, ISettingsService<LandingPageSettings> lp,
|
||||
ISettingsService<ScheduledJobsSettings> scheduler, IJobRecord rec) : base("admin", prService)
|
||||
ISettingsService<ScheduledJobsSettings> scheduler, IJobRecord rec, IAnalytics analytics) : base("admin", prService)
|
||||
{
|
||||
PrService = prService;
|
||||
CpService = cpService;
|
||||
|
@ -137,6 +139,7 @@ namespace PlexRequests.UI.Modules
|
|||
LandingSettings = lp;
|
||||
ScheduledJobSettings = scheduler;
|
||||
JobRecorder = rec;
|
||||
Analytics = analytics;
|
||||
|
||||
this.RequiresClaims(UserClaims.Admin);
|
||||
|
||||
|
@ -237,7 +240,7 @@ namespace PlexRequests.UI.Modules
|
|||
return View["Settings", settings];
|
||||
}
|
||||
|
||||
private Response SaveAdmin()
|
||||
private async Task<Response> SaveAdmin()
|
||||
{
|
||||
var model = this.Bind<PlexRequestSettings>();
|
||||
var valid = this.Validate(model);
|
||||
|
@ -254,6 +257,8 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
}
|
||||
var result = PrService.SaveSettings(model);
|
||||
|
||||
await Analytics.TrackEventAsync(Category.Admin, Action.Save, "PlexRequestSettings", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
return Response.AsJson(result
|
||||
? new JsonResponseModel { Result = true }
|
||||
: new JsonResponseModel { Result = false, Message = "We could not save to the database, please try again" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue