diff --git a/README.md b/README.md index 643b98a3..54a5a29a 100644 --- a/README.md +++ b/README.md @@ -199,12 +199,12 @@ Below are examples of how to use the API for starting a remote control session. $WebSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession   - $Response = Invoke-WebRequest -Uri "https://localhost:44351/api/Login" -WebSession $WebSession -Method Post -Body " + $Response = Invoke-WebRequest -Uri "https://localhost:44351/api/Login" -WebSession $WebSession -Method Post -Body ' { - 'Email': 'email@example.com', - 'Password': 'P@ssword1' + "Email": "email@example.com", + "Password": "P@ssword1" } - " -ContentType "application/json" + ' -ContentType "application/json" if ($Response.StatusCode -eq 200) { diff --git a/Server/Data/DataService.cs b/Server/Data/DataService.cs index 7d7e4f3a..8627ed67 100644 --- a/Server/Data/DataService.cs +++ b/Server/Data/DataService.cs @@ -247,9 +247,6 @@ namespace Remotely.Server.Data public bool DoesUserHaveAccessToDevice(string deviceID, RemotelyUser remotelyUser) { - var targetDevice = RemotelyContext.Devices - .FirstOrDefault(x => x.ID == deviceID && x.OrganizationID == remotelyUser.OrganizationID); - return RemotelyContext.Devices.Any(x => x.ID == deviceID && x.OrganizationID == remotelyUser.OrganizationID); } diff --git a/Server/Pages/EditDevice.cshtml b/Server/Pages/EditDevice.cshtml index 6f1cb2a3..96336c59 100644 --- a/Server/Pages/EditDevice.cshtml +++ b/Server/Pages/EditDevice.cshtml @@ -54,6 +54,19 @@ else +
+ Monitoring +
+
+ +
+ +
+
+ minutes +
+
+
diff --git a/Server/Pages/EditDevice.cshtml.cs b/Server/Pages/EditDevice.cshtml.cs index 51cfdc4c..7800a48a 100644 --- a/Server/Pages/EditDevice.cshtml.cs +++ b/Server/Pages/EditDevice.cshtml.cs @@ -37,6 +37,19 @@ namespace Remotely.Server.Pages PopulateViewModel(deviceID); } + public IActionResult OnPost(string deviceID) + { + if (!ModelState.IsValid) + { + PopulateViewModel(deviceID); + return Page(); + } + + DataService.UpdateDevice(deviceID, Input.Tags, Input.Alias, Input.DeviceGroupID); + + return RedirectToPage("EditDevice", new { deviceID, success = true }); + } + private void PopulateViewModel(string deviceID) { var user = DataService.GetUserByName(User.Identity.Name); @@ -53,22 +66,14 @@ namespace Remotely.Server.Pages var groups = DataService.GetDeviceGroupsForUserName(User.Identity.Name); DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID))); } - - public IActionResult OnPost(string deviceID) - { - if (!ModelState.IsValid) - { - PopulateViewModel(deviceID); - return Page(); - } - - DataService.UpdateDevice(deviceID, Input.Tags, Input.Alias, Input.DeviceGroupID); - - return RedirectToPage("EditDevice", new { deviceID, success = true }); - } - public class InputModel { + public double? AlertOfflineMinutes { get; set; } + + public double? AlertMemoryPercentage { get; set; } + + public double? AlertSystemDrivePercentage { get; set; } + [StringLength(100)] public string Alias { get; set; } diff --git a/Server/Startup.cs b/Server/Startup.cs index 4d405abb..04d73b1c 100644 --- a/Server/Startup.cs +++ b/Server/Startup.cs @@ -155,6 +155,7 @@ namespace Remotely.Server services.AddScoped();; services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddSingleton(); services.AddSingleton(); }